Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to Require Old Versions #8

Closed
kenmazaika opened this issue Jun 26, 2012 · 15 comments
Closed

Possible to Require Old Versions #8

kenmazaika opened this issue Jun 26, 2012 · 15 comments
Assignees

Comments

@kenmazaika
Copy link

Not sure if this is a bug, but it caused some inconsistencies in our deploy process with different team members (we ran cap deploy instead of bundle exec cap deploy)

*** LOCAL GEMS ***

rvm (1.11.3.3, 1.9.2)
Kens-MacBook-Pro:campaign_manager kmazaika$ irb
1.9.3-p0 :001 > require 'rubygems'
 => false 
1.9.3-p0 :002 > require 'capistrano'
re => true 
1.9.3-p0 :003 > require 'rvm'
 => true 
1.9.3-p0 :004 > RVM::Version
 => "1.11.3.3" 
1.9.3-p0 :001 > require 'rubygems'
 => false 
1.9.3-p0 :002 > require 'capistrano'
re => true 
1.9.3-p0 :003 > require 'rvm'
 => true 
1.9.3-p0 :004 > RVM::Version
 => "1.11.3.3" 
1.9.3-p0 :005 > exit
Kens-MacBook-Pro:campaign_manager kmazaika$ irb
1.9.3-p0 :001 > require 'rubygems'
 => false 
1.9.3-p0 :002 > require 'capistrano'
 => true 
1.9.3-p0 :003 > require 'rvm/capistrano'
LoadError: Please require this file from within a Capistrano recipe
    from /Users/kmazaika/.rvm/gems/ruby-1.9.3-p0@campaign_manager/gems/capistrano-2.12.0/lib/capistrano/configuration/loading.rb:18:in `instance'
    from /Users/kmazaika/.rvm/gems/ruby-1.9.3-p0@campaign_manager/gems/rvm-1.9.2/lib/rvm/capistrano.rb:7:in `<top (required)>'
    from /Users/kmazaika/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from /Users/kmazaika/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from /Users/kmazaika/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from (irb):3
    from /Users/kmazaika/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
1.9.3-p0 :005 > require 'rvm'
 => true 
1.9.3-p0 :006 > RVM::Version
 => RVM::Version 
1.9.3-p0 :007 > RVM::VERSION
 => "1.9.2" 

This caused some members on our team who had the old version of the rvm gem on their machine to be able to deploy successfully (because it would fallback to the old version), but users who did not have the old version of the gem to see an error message.

It might make sense to add a file into rvm such that:

require 'capistrano/rvm' will raise an error (instead of falling back to 1.9.2).

@ghost ghost assigned mpapis Jun 26, 2012
@mpapis
Copy link
Member

mpapis commented Jun 26, 2012

It does not make much sense to me, can you include gem list | grep rvm, rvm version.

How do you think require 'capistrano/rvm' would solve that problem, I do not see you calling it, and if it is not available it would raise an error too, right?

Why can you not update your environments, I see you are using unpatched ruby (p0), there is already p194 which includes bugfixes and security fixes, you should change to it first.

As for your application, you should put all the gems you use in Gemfile and use the rubygems-bundler gem which is included in new versions of RVM (or prefix all your commands with bundle exec)

@kenmazaika
Copy link
Author

Kens-MacBook-Pro:campaign_manager kmazaika$ gem list | grep rvm
rvm (1.11.3.3, 1.9.2)
Kens-MacBook-Pro:campaign_manager kmazaika$ rvm version

rvm 1.10.2 by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.beginrescueend.com/]

Yeah, the problem exists when running cap deploy not bundle exec cap deploy, and we don't use rubygems-bundler. I think a lot of people run capistrano commands globally instead of with bundler.

When requiring capistrano/rvm since it doesn't exist in the latest version, but does in a previous version it picks that up, and continues to use the old version of the rvm gem.

@mpapis
Copy link
Member

mpapis commented Jun 26, 2012

can you show me example of requiring capistrano/rvm in older version?

@mpapis
Copy link
Member

mpapis commented Jun 26, 2012

also I'm not sure that gem rvm 1.11.3 is compatible with older versions of rvm, please update rvm to at least 1.11.3 and test it again.

@kenmazaika
Copy link
Author

Requiring capistrano/rvm only works inside capistrano recipes. Otherwise it gives the exception I listed above.

So you're saying that the rvm gem needs to match the version of rvm installed on a local machine? Interesting but seems like an unrelated issue.

The problem I have is that it loads the older version of the gem after requiring it in that way, it does not include the latest installed.

@mpapis
Copy link
Member

mpapis commented Jun 26, 2012

rvm 1.11.3 was a breaking point for the gem integration, rvm-gem and rvm-capistrano were extracted, it is minimal version for the new gems, also in 1.11.3 rubygems-bundler will be automatically installed which makes sure you get proper versions loaded via bundler without using bundle exec, please update RVM to at least 1.11.3 and let me know if it solves your issue.

@kenmazaika
Copy link
Author

Upgrading caused the problem, it will not fix the problem.

When calling:

require 'capistrano/rvm' it will require the older version of the rvm gem. It would be good if people were requiring that file, would have it load the latest version of rvm and receive an error message instead of loading the old version.

@mpapis
Copy link
Member

mpapis commented Jun 26, 2012

I'm sorry I was not clear about it, please update RVM rvm get stable you are already using latest version of the rvm-gem.

@kenmazaika
Copy link
Author

This will not fix the problem.

@mpapis
Copy link
Member

mpapis commented Jun 26, 2012

will not or did not fixed ? have you tried ?

@kenmazaika
Copy link
Author

This is a problem with the gem, not the integration with rvm or rvm itself.

Do you understand the bug I'm reporting, or have I done a poor job of describing the problem?

@mpapis
Copy link
Member

mpapis commented Jun 26, 2012

  1. can you show me example of requiring capistrano/rvm in older version?
  2. please update rvm rvm get stable as this gem is not intended to work with older versions of RVM
  3. make sure you always use bundle exec as described in bundler documentation - you can also use my gem rubygems-bundler to avoid writing bundle exec, this gem should be installed in point 2.

@mpapis
Copy link
Member

mpapis commented Jul 17, 2012

closing as there is not enough information to continue, let me know if there is more information and I will reopen

@mpapis mpapis closed this as completed Jul 17, 2012
@kenmazaika
Copy link
Author

I provided an example in irb that reproduces the problem, and presented a solution that would fix it.

I don't see how jumping through unrelated hoops will help you diagnose the problem, as I've already explained exactly what the cause is.

If you do not agree the output in irb is a bug, that's fine to close a ticket.

@mpapis
Copy link
Member

mpapis commented Jul 18, 2012

@kenmazaika the irb output does not provide me enough information, please answer #8 (comment) so I can understand the problem better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants