Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

bundler doesn't recognize spork-0.9.0.rc7 #1202

Closed
dchelimsky opened this Issue · 23 comments

8 participants

@dchelimsky

This is a bit odd:

$ cat Gemfile | grep spork
gem "spork", "0.9.0.rc7", :group => [:development, :test]

$ gem q -rn spork --pre --source http://rubygems.org

*** REMOTE GEMS ***

invo-sporknife (0.1.0.pre)
nimboids-spork (0.9.0.rc2)
spork (0.9.0.rc7, 0.9.0.rc6, 0.9.0.rc5, 0.9.0.rc4, 0.9.0.rc3, 0.9.0.rc2, 0.9.0.rc)

$ bundle package
Fetching source index for http://rubygems.org/
Could not find spork-0.9.0.rc7 in any of the sources

$ gem install spork -v 0.9.0.rc7 --source http://rubygems.org
Building native extensions.  This could take a while...
Successfully installed spork-0.9.0.rc7
1 gem installed
@sferik
Collaborator

Strange. What version of bundler are you using?

@dchelimsky

bundler-1.0.13

Here's some more info:

$ gem -v
1.3.7
$ bundle package
Using rake (0.9.0) 
# ...
Updating .gem files in vendor/cache
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc7.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache
  * spork-0.9.0.rc7.gem
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc7.gem

$ gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.8.3
# ...

$ bundle package
# ...
Updating .gem files in vendor/cache
  * spork-0.9.0.rc7.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache

So it's something about bundler-1.0.13 + rubygems-1.3.7 + spork-0.9.0.rc7. Gotta love it!

@indirect
Owner
@dburt

Might be the same as issue #1054
#1054 (comment)

@hone
Owner

This is a bug in rubygems and is fixed in later versions of rubygems, I believe 1.4+

@indirect indirect closed this
@dburt

Can be worked around in Bundler for pre-1.4 compatibility, while RubyGems updates settle down a bit?

@indirect
Owner

You can just upgrade to Rubygems 1.4 for the fix for this issue. You don't have to upgrade all the way to Rubygems 1.8.5. That said, if you feel like writing a workaround, I would happily apply it. :)

@dburt

I'm not sure where best to put this monkeypatch, but it seems to do the job. (I put it at the top of runtime.rb.)

# fix bug in Rubygems < 1.4 by forcing calculation of @segments
if Gem::Version.new(Gem::VERSION) < Gem::Version.new("1.4.0")
  class Gem::Version
    def segments # :nodoc:
      unless @segments_generated
        @segments = @version.scan(/[0-9]+|[a-z]+/i).map do |s|
          /^\d+$/ =~ s ? s.to_i : s
        end
      end
      @segments_generated = true
      @segments
    end
  end
end

If you'd like me to fork, patch, and make a pull-request, I can, but as it's such a hack, I would prefer a Bundler person to decide where it goes.

@hone hone was assigned
@hone hone reopened this
@dwradcliffe
Owner

I had the same problem and the patch works for me as well. Thanks @dburt.

@hone
Owner

This should be fixed in 1.1.pre.7 and 1.0.17. Can someone verify this is the case?

@hone hone closed this
@dburt

They look good to me. This also fixes issue #1054, which should therefore also be closed. My test process and output is described below.

dave@dev:~/tmp$ cat Gemfile
source :rubygems
gem 'spork', '0.9.0.rc3'

dave@dev:~/tmp$ bundle --version
Bundler version 1.0.13
dave@dev:~/tmp$ bundle pack
Using spork (0.9.0.rc3)
Using bundler (1.0.13)
Updating .gem files in vendor/cache
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc3.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache
  * spork-0.9.0.rc3.gem
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc3.gem

dave@dev:~/tmp$ sudo gem install bundler --no-ri --no-rdoc
Successfully installed bundler-1.0.17
1 gem installed
dave@dev:~/tmp$ bundle --version
Bundler version 1.0.17
dave@dev:~/tmp$ bundle pack
Using spork (0.9.0.rc3)
Using bundler (1.0.17)
Updating .gem files in vendor/cache
  * spork-0.9.0.rc3.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache

dave@dev:~/tmp$ rm vendor/cache/*

dave@dev:~/tmp$ sudo gem install bundler -v1.1.pre.7 --no-rdoc --no-ri
Successfully installed bundler-1.1.pre.7
1 gem installed
dave@dev:~/tmp$ bundle --version
Bundler version 1.1.pre.7
dave@dev:~/tmp$ bundle pack
Using spork (0.9.0.rc3)
Using bundler (1.1.pre.7)
Updating .gem files in vendor/cache
  * spork-0.9.0.rc3.gem
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache
@hone
Owner

Thanks for looking into all this again @dburt.

@dburt

Glad to help.

@hone hone reopened this
@hone
Owner

seems to be broken again due to bad23b5

@dburt

Do you have a test for that, @hone?

Isn't that changeset included in 1.0.17 and 1.1.pre7, which don't exhibit the problem, and 1.0.18 which still works?

I recall adding the lines that are removed by bad23b5 deliberately to workaround a problem like this, but these releases don't include them and appear to me to work fine.

@hone
Owner

i had to patch the exact patch iirc because it broke rake. I have a test for that. I couldn't come up with a test case for bundle cache on 1.3.7. This is fixed now.

@hone hone closed this
@dburt

So this issue seems to me to be broken again in 1.0.18, but you're saying it's fixed in 1.0.19rc or 1.0.20rc?

@cjbottaro

I'm seeing some weird behavior that might be related...

Updating .gem files in vendor/cache
  * spork-0.9.0.rc9.gem
Removing outdated .gem files from vendor/cache
  * spork-0.9.0.rc9.gem

Why does bundler add it then immediately remove it?

Here's more info...

$ gem -v
1.3.7
$ bundle -v
Bundler version 1.0.21

Thanks for the help.

P.S. Still see same behavior with bundler-1.1.rc.

@hone hone reopened this
@dburt

Thanks for the report, @cjbottaro, that's definitely the same issue.

Why does bundler add it then immediately remove it?

Because it's in two minds about the version number part "rc9" and the version in the cache ["rc9"] is not equal to the latest bundled version ["rc", "9"] or something like that, due to a bug in Gem::Version#segments in old Rubygems (<1.4).

@hone hone referenced this issue from a commit
@hone hone test covering issue #1202 5ea0e3d
@dburt

FWIW, running the same versions of Rubygems (1.3.7) and Bundler (1.0.21 and 1.1.rc) as @cjbottaro, I do not encounter the problem. I'm on Ruby 1.8.7 but I'm not sure what other platform differences might make the difference.

@david-harkness

Spork will not install with a bundle install

$ gem --version
1.8.11
$ bundle --version
Bundler version 1.1.rc

@indirect
Owner

@david-harkness, please open a ticket with the information from ISSUES.

@indirect indirect closed this
@david-harkness

This was the problem. #1259

I ran a bundle install --without development, earlier in the day.
For some strange reason the --without gets cached, and from then on bundle won't use development ever again.
I had to run a bundle install --without somefakegroupthatdoesntexist
and all was good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.