Created
May 12, 2011 15:10
-
-
Save drnic/968697 to your computer and use it in GitHub Desktop.
Installs a gem in a specific RVM ruby/gemset, and creates wrapper script to always use that specific ruby/gemset.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Installs a gem in a specific RVM ruby/gemset, and helps you create | |
# an alias to a CLI/bin script to always use that gemset. | |
# Wonderfully useful for utility scripts (engineyard's ey or github-gem's gh) | |
# | |
# USAGE: | |
# freeze_gem_cli engineyard ey | |
# freeze_gem_cli github gh ruby-1.8.7p334 | |
# | |
# Then add the suggested aliases to your .bash_profile | |
gem_name, gem_executable, rvmruby = ARGV[0..2] | |
puts "USAGE: freeze_gem_cli GEMNAME [EXEC] [RVMRUBY]" and exit 1 unless gem_name | |
gem_executable ||= gem_name | |
gemset_name = "#{gem_name}-cli-#{gem_executable}" | |
rvmruby ||= `rvm current`.strip | |
rvmgemset = "#{rvmruby}@#{gemset_name}" | |
def run_cmd(cmd) | |
puts cmd | |
puts `#{cmd}` | |
end | |
run_cmd "rvm --create #{rvmgemset} exec gem install #{gem_name}" | |
run_cmd "rvm wrapper #{rvmgemset} --no-prefix #{gem_executable}" |
"You get my drift?"
"No, but I do get your gist..."
;)
This is hard to ingist.
Cheers
Nic
http://engineyard.com
http://drnicwilliams.com
+1 (415) 322 9556
Engine Yard: Successful Rails Apps through Orchestration
…On May 12, 2011, at 5:50 PM, ***@***.*** wrote:
"You get my drift?"
"No, but I do get your gist..."
;)
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/968697
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And now you get the gist of what I was on about. Hazaar for gists! :)