Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS 

compare versions using rubygems

http://pivots.pivotallabs.com/users/chad/blog/articles/362-the-power-of-versions-monkey-patches-targeted-with-friggin-laser-beams-

   1  
   2  Gem::Version::Requirement.new(['> 0.9.0']).satisfied_by?(Gem::Version.new('0.11.0'))

Upgrade rubygems and/or specific gems themselves via capistrano

When a latest RubyGems is released (e.g. 0.9.5 recently) or Rails (e.g. 2.0.2) you might want to push those upgrades to all your production machines.

Add these two tasks to your deploy.rb capistrano file (add namespaces for cap2.0 if you like)

   1  
   2    desc "Updates RubyGems version"
   3    task :gem_update_system do
   4      sudo "gem update --system"
   5    end
   6  
   7      
   8    desc "Install a RubyGem from remote source"
   9    task :gem_install do
  10      puts "USAGE: GEM=gemname cap gems_install" and next unless ENV['GEM']
  11      sudo "gem install #{ENV['GEM']} --no-ri --no-rdoc"
  12    end


To upgrade rubygems and rails, for example:

   1  
   2  cap gem_update_system
   3  GEM=rails cap gem_install

rubygems update

   1  
   2  sudo gem update –system

Updating Rubygems and gems

// Update Rubygems to the latest version, and getting the latest gems, and then cleaning up.

   1  
   2  sudo gem update --system  # Update to latest Rubygems (if any)
   3  gem outdated  # Get list of outdated gems and update as necessary
   4  sudo gem install XXX --include-dependencies
   5  sudo gem clean  # Clean up outdated gems
« Newer Snippets
Older Snippets »
Showing 1-4 of 4 total  RSS