Rake: Install from local Gem-Dev-Dir as a remote global gem

1 minute read

Out Of Date Warning

This article was published on 02/12/2011, this means the content may be out of date or no longer relevant.
You should verify that the technical information in this article is still up to date before relying upon it for your own purposes.

For installing and updating a (private) gem that was developed locally, we defined a rake task.

def run(cmd)
  puts "CMD: #{cmd}"

desc "Install Gem auf pludoni Server"
task :install_remote => :build do
  file = `ls -t pkg/ |head -n 1`.gsub("\n"," ")
  server = ENV['SERVER'] || "root@pludoni.de"

  run "scp pkg/#{file} #{server}:/tmp/#{file}"
  run "ssh #{server} 'gem install -l /tmp/#{file}'"

Useful, if you develop private gems that are not gonna be published at rubyforge, because they are very company/app-specific. Gem-in-a-box is very easy to install and provides a nice way to distribute personal gems.

Reposted from notes.it-jobs-und-stellen.de