Accept operator in 'ruby' line at Gemfile #2228

Closed
wants to merge 3 commits into
from

Projects

None yet

6 participants

@sanemat
Contributor
sanemat commented Dec 29, 2012

Current ruby '1.9.3' is specific Ruby 1.9.3.

This accept ruby '>= 1.9.3', so both Ruby1.9.3 and Ruby2.0.0 is OK, as with other gem version.
engine_version also accepts op.

@indirect
Member

Not sure about this. I think if we do this, the actual ruby version would need to go into the lock.

@sanemat
Contributor
sanemat commented Dec 30, 2012

This is simular to below:
#2133
#2213

@sanemat
Contributor
sanemat commented Dec 30, 2012

My use case:

Set ruby directive, because heroku run ruby1.9.3 if this param set.
https://github.com/sanemat/gist-mail/blob/master/Gemfile#L3
ruby '1.9.3'

I want to run this script on ruby2.0.0 in my local environment, so I want ruby '>= 1.9.3'
I don't want lock ruby version especially travis-ci(rvm versions) and heroku(production, lock 1.9.3)

I came up with another solution now (pseudocode), ruby '1.9.3' if !development && !travis-ci

@hone
Member
hone commented Dec 30, 2012

I agree with Andre here. I think in order to support something like this you need lockfile support. Even though, there's a lot of questions. How should Heroku know to pull out 1.9.3? Why wouldn't it just pull the latest? Having more than one ruby version makes it really unclear what should be in production. I assume what is in the lock file should be the "production" blessed ruby. But, if that's the case do we not error out for the other things? Do we just return that value when running bundle platform --ruby?

@indirect
Member

Those questions would be answered by the lock file. That said, Bundler is never going to support the requested behavior of "2.0 in dev, 1.9 in production". That would be like Bundler having Gemfile support for rails 4 in dev and rails 3 in production. Not going to happen.

On Dec 30, 2012, at 11:22 AM, Terence Lee notifications@github.com wrote:

I agree with Andre here. I think in order to support something like this you need lockfile support. Even though, there's a lot of questions. How should Heroku know to pull out 1.9.3? Why wouldn't it just pull the latest? Having more than one ruby version makes it really unclear what should be in production.


Reply to this email directly or view it on GitHub.

@sanemat
Contributor
sanemat commented Jan 19, 2013

Thanks, but the implementation for lock against platform is too heavy for me.

@indirect
Member

@sanemat Sadly, we have to wait to add the Ruby version to the lockfile until Bundler 2.0, because the lockfile parser in Bundler 1.0 does not know how to ignore new sections. :( In the meantime, we will have to leave the Gemfile specifying a single version of ruby. Sorry about that!

@indirect indirect closed this Jan 20, 2013
@sheerun sheerun referenced this pull request in monterail/guidelines Mar 19, 2013
Merged

.rbenv-version, .ruby-version, .rvmrc #111

@sheerun
sheerun commented Mar 19, 2013

What about an possibility to ignore forcing ruby version? I'd like to use 2.0 in dev too.

@indirect
Member

@sheerun use a branch, just like you would for .ruby-version?

@sheerun
sheerun commented Mar 19, 2013

What do you mean by using a branch? I don't include .ruby-version in projects because it forces patch version. I like putting ruby to Gemfile, but I'd like to use different one on only my local machine.

@indirect
Member

Hmm, I thought .ruby-version allowed ruby versions without patchlevels. Huh. Anyway, if you want to put a Ruby version into your Gemfile, use that Ruby version. If you want to try a different Ruby version, create a new branch and change the Ruby version. Bundler isn't going to support both Ruby 2 and Ruby 1.9 in the same Bundle any more than it supports both Rails 3 and Rails 4 in the same Bundle. HTH!

@sheerun
sheerun commented Mar 20, 2013

If we're talking about dev gems, it's also annoying, that I can't set-up specific gem versions only on my machine. It would be useful for example when developing used gem locally


Many people [request such feature](https://github.com/carlhuda/bundler/issues/183).

I think it also concerns local Ruby version...
@indirect
Member

@sheerun you should read the documentation for the git locals feature. If you need to run different versions, you should create a branch and change the versions.

@sheerun
sheerun commented Mar 21, 2013

Thanks! Is it possible to change ruby version in such way too?

@indirect
Member

It is only possible to change gem versions or ruby versions by changing the Gemfile. That's why I suggested a branch.

On Mar 21, 2013, at 12:42 AM, Adam Stankiewicz notifications@github.com wrote:

Thanks! Is it possible to change ruby version in such way too?

Reply to this email directly or view it on GitHub.

@sodabrew

If this is on the table for Bundler 2, why is the issue closed? Really appreciate that there's working code in this PR, and I hope that it can be an upcoming feature set!

@indirect
Member

@sodabrew it's closed because of what I said earlier:

Bundler isn't going to support both Ruby 2 and Ruby 1.9 in the same Bundle any more than it supports both Rails 3 and Rails 4 in the same Bundle.

@xaviershay
Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment