RiotGamesCookbooks / rbenv-cookbook

Installs and configures rbenv
http://community.opscode.com/cookbooks/rbenv
Apache License 2.0
137 stars 109 forks source link

rbenv_gem for multplie versions #112

Open ramonskie opened 10 years ago

ramonskie commented 10 years ago

shouldn't it be possible that we install a gem on all ruby versions for example i want bundler on all my ruby versions i have the following versions

rbenv_ruby "1.9.3-p194" do
  ruby_version "1.9.3-p194"
  global true
end

rbenv_ruby "2.1.2" do
end

and i want bundler on all my versions so i want to do the following

rbenv_gem "bundler" do
end

for now i need to specify it for each version this should be needed or maby use a array of versions

flatrocks commented 9 years ago

Rather than complicate the gem for (what seems like) a seldom-needed option, how about:

['1.9.3-p194', '2.1.2'].each do |version|
  rbenv_gem "bundler for #{version}" do
     package_name 'bundler'
     ruby_version version
  end
end

This is pretty flexible, not much code, and it seems likely an array of ruby versions is already available in the parent recipe, simplifying this further. Otherwise, the rbenv gem is forced to maintain/discover the list of all installed versions, not sure that's necessary otherwise?