davetron5000 / optparse-plus

Start your command line scripts off right in Ruby
http://davetron5000.github.com/optparse-plus
Apache License 2.0
521 stars 54 forks source link

Don't add rake dependency if bundler has already added it #84

Closed slmingol closed 6 years ago

slmingol commented 9 years ago

Methadone makes the following gemspec:

...
  spec.add_development_dependency "bundler", "~> 1.6"
  spec.add_development_dependency "rake", "~> 10.0"
  spec.add_development_dependency('rdoc')
  spec.add_development_dependency('aruba')
  spec.add_development_dependency('rake')
  spec.add_dependency('methadone', '~> 1.8.0')

Which results in this msg:

$ bundle install
Resolving dependencies...
Using rake 10.3.2
Using ffi 1.9.6
Using childprocess 0.5.5
Using builder 3.2.2
Using diff-lcs 1.2.5
Using multi_json 1.10.1
Using gherkin 2.12.2
Using multi_test 0.1.1
Using cucumber 1.3.17
Using rspec-support 3.1.2
Using rspec-expectations 3.1.2
Using aruba 0.6.1
Using bundler 1.6.4
Using methadone 1.8.0

fullstop at /home/slm/fullstop did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  duplicate dependency on rake (>= 0, development), (~> 10.0) use:
    add_runtime_dependency 'rake', '>= 0', '~> 10.0'
Using fullstop 0.0.1 from source at .
Using json 1.8.1
Using rdoc 4.1.2
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

Taking out the extra restriction about rake: spec.add_development_dependency "rake", "~> 10.0" makes the msg go away. Why is this restriction in the gemspec?

davetron5000 commented 9 years ago

I think later versions of bundler add that dependency, and so methadone no longer needs to. Methadone should only be adding an open dependency, though: https://github.com/davetron5000/methadone/blob/master/bin/methadone#L82

This was new in 1.8.0, released last month: https://github.com/davetron5000/methadone/releases/tag/v1.8.0

slmingol commented 9 years ago

OK, I'm using 1.8.0 of Methadone and Bundler is at 1.6.4. Should methadone 1.8.0 not have added this rule?

  spec.add_development_dependency "rake", "~> 10.0"

Sorry this is all fairly new/foreign to me so I'm trying to make heads or tails of what's what.

davetron5000 commented 9 years ago

A fresh install of methadone on bundler 1.5.3 adds a rake dependency without the version specifier, so it's possible its bundler.

I think the problem is that older versions of bundler didn't add a rake specifier at all, and now they do. Since methadone uses bundler under the covers to bootstrap the gem, and also just inserts a rake dependency to cover its bases, I think that's the problem.

So, I think the ultimate bug here is that methadone should ony add the rake dependency if it's not in the gemspec already. That way, for older versions of bundler, it would add it, but newer it would see it an not.

Gonna change the title of this issue to match and mark it as a bug. Even thought it's minor, there's no need to cause confusion—methadone is supposed to help you :)

slmingol commented 9 years ago

Thanks Dave. Been going through your free ibook too. Very helpful. Thanks for your hard work, it's appreciated. Will be picking up a printed copy of the PragPub book as a thank you!

davetron5000 commented 6 years ago

This has been fixed (not sure when), but methadone won't result in rake being in the gemspec twice.