Finally!

I finally launched The PCS Store’s web site! More features will be available to the public eye when they fill in the content. I don’t like showing people things that are available when they just bring up an error or a blank page. So as they fill in the Handset and Data Card details in the back-end, there will be additional screens and links available. A little about the app:

  • Ruby on Rails
    • RESTful controllers
    • Plugins
      • rspec
      • responds_to_parent
      • geokit
      • attachment_fu
    • Authentication for ‘Team Members’ and ‘Admin’ parts of the application leverages Net::IMAP so everyone can log in with their existing email username and password
  • Icons are from the Crystal Project (I started doing them myself but it was taking too damn long)
  • Info bubbles shamelessly copied from Panic (Transmit rocks!). Tried like hell to get them to be transparent in IE6 but to no avail so far…
  • Layout, logo and background are all me
  • Team Members section allows employees to gain access to important links and documentation
  • Admin section allows company execs to manage links, devices, documents, document categories

Stop deleting your files/images when you deploy!

This is one of those ‘Duh!’ moments we all have after the fact…When using something like the ‘file_column’ plugin for Rails, the default will upload your images to the RAILS_ROOT/public directory which is, of course, in Subversion. So it gets blown away when you ‘cap_deploy’ because you didn’t sync all the files that your users have uploaded to your local machine and commit to Subversion (which you wouldn’t do anyway since their images shouldn’t be in your repository…)Anyway, here’s how to get around it.

  1. SSH into your server and make a new ‘uploads’ directory under the ‘#{application}/shared/system’ folder:
    mkdir /path/to/your/railsapp/shared/system/uploads
  2. chmod it to 775:
    chmod 755 /path/to/your/railsapp/shared/system/uploads
  3. Edit your ‘RAILS_ROOT/config/deploy.rb’ file and add the following line INSIDE the ‘task :after_update_code do’ block:
    run "ln -s /path/to/your/#{application}/shared/system/uploads #{release_path}/public/uploads"
  4. (optional) If you are using ‘file_column’ plugin, change line 596 of ‘RAILS_ROOT/vendor/plugins/file_column/lib/filecolumn.rb’ to:
    :root_path => File.join(RAILS_ROOT, "public/uploads"),

    and change line 80 of ‘RAILS_ROOT/vendor/plugins/file_column/lib/file_column_helper.rb’ to:

    url << "/uploads/"
  5. ‘cap_deploy’ and you should be good to go!

Capistrano setup for MediaTemple Grid Server accounts

For the most part these tutorials work

however, some important things to change in the deploy.rb file that you get from http://gems.mediatemple.com/deploy.rb (PAY ATTENTION TO THE ‘%’!)

# ADD THIS!
set :user, "serveradmin%yourdomain.com"set :s_user, "serveradmin%25yourdomain.com"
# THEN REPLACE #{user} WITH #{s_user}
set :repository, "svn+ssh://#{s_user}@#{domain}/home/#{site}/data/gwirepo/greenwaysapp/trunk"

…then your ‘cap update_code’ will work. good luck.by the way, if you are wondering how to redeploy (ie. you’ve changed code and want it on the server), here are the steps:

  1. commit your work to the repository
  2. ‘cap deploy’
  3. there is no step 3 :)

again, good luck…