blt04 / puppet-rvm

A puppet module for installing and using RVM (Ruby Version Manager)
Other
242 stars 280 forks source link

Installing bundler for two Rubies #6

Closed matellis closed 13 years ago

matellis commented 13 years ago

If you install two versions of Ruby (say 1.8.7 and 1.9.2) and try to install bundler for each of them you get an error. Specifically:

rvm_system_ruby {
  'ruby-1.9.2-p180':
    ensure => 'present',
    default_use => false;
  'ruby-1.8.7-p334':
    ensure => 'present',
    default_use => false;
}

rvm_gem {
  'bundler':
    ruby_version => 'ruby-1.9.2-p180',
    ensure => '1.0.13',
    require => Rvm_system_ruby['ruby-1.9.2-p180'];
}

rvm_gem {
    'bundler':
    ruby_version => 'ruby-1.8.7-p334',
    ensure => '1.0.13',
    require => Rvm_system_ruby['ruby-1.8.7-p334'];
}

Won't work. If you change the name for them to be something like bundler187 and bundler192 then it can't find the right gem (of course).

Will this need a patch or am I missing something here?

blt04 commented 13 years ago

I haven't tried this yet, but would this work:

rvm_gem {
  'bundler192':
    name => 'bundler',
    ruby_version => 'ruby-1.9.2-p180',
    ensure => '1.0.13',
    require => Rvm_system_ruby['ruby-1.9.2-p180'];
}

rvm_gem {
  'bundler187':
    name => 'bundler',
    ruby_version => 'ruby-1.8.7-p334',
    ensure => '1.0.13',
    require => Rvm_system_ruby['ruby-1.8.7-p334'];
}
matellis commented 13 years ago

That gave an error on the second stanza saying it couldn't set the alias 'bundler' as it was already defined.

However this does work:

rvm_gem {
  'bundler':
    ruby_version => 'ruby-1.9.2-p180',
    ensure => '1.0.13',
    require => Rvm_system_ruby['ruby-1.9.2-p180'];
}

# TODO: This is a hack, see https://github.com/blt04/puppet-rvm/issues/6
rvm_gem {
    'bundler187':
        name => 'bundler',
    ruby_version => 'ruby-1.8.7-p334',
    ensure => '1.0.13',
    require => Rvm_system_ruby['ruby-1.8.7-p334'];
}

Feels a bit hacky. Hopefully all our third party software like Puppet will be Ruby 1.9.2. compliant by the time we want to deploy 1.9.3.

blt04 commented 13 years ago

Thanks for this bug report. 381a747 adds support for my first suggested syntax. You shouldn't have to use your hack, though it will still work.

matellis commented 13 years ago

That was fast! Thanks a lot.