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

Rename woes: 'optparse_plus' vs. 'optparse-plus' #131

Closed jorge0136 closed 3 years ago

jorge0136 commented 3 years ago

Following the directions to get started, I am running into an error within the generated <app_name>.gemspec.

spec.add_dependency('optparse_plus', '~> 3.0.0')

The generated gemspec is describing the optparse_plus gem instead of the intended optparse-plus gem.

From the look of recent commits it appears this is more pain from the methadone --> optparse_plus --> optparse-plus journey.

Reproduction Steps:

  1. Visit http://davetron5000.github.io/optparse-plus/
  2. mkdir clean_root && cd clean_root
  3. echo "3.0.0" > .ruby-version
  4. bundle init
  5. bundle add optparse_plus
  6. touch test.rb
  7. Copy and paste the following into test.rb:
    
    #!/usr/bin/env ruby

require 'optparse_plus'

include OptparsePlus::Main include OptparsePlus::CLILogging

main do |some_arg| puts some_arg puts options['ip-address'] if options[:verbose] end

version '0.0.1' description 'Show off how great optparse-plus is!' arg :some_arg, :required

on("--verbose","Be verbose") options['ip-address'] = '127.0.0.1' on("-i IP_ADDRESS","--ip-address","IP Address",/^\d+.\d+.\d+.\d+$/)

go!

8. `chmod +x test.rb`
9. `./test.rb` and enjoy how easy it's been thus far. 
10. Read further, find the "Bootstrapping" section. Get excited about CLI app generation. :)
11. `optparse_plus --rspec bash-taming-magic`
12. Find that the generator created a new folder, ok. Do some clean up.
`mv .ruby-version bash-taming-magic/`
`rm Gemfile Gemfile.lock test.rb`
`cd bash-taming-magic`
13. `bundle install` and see following error message

The gemspec at /clean_root/bash-taming-magic/bash-taming-magic.gemspec is not valid. Please fix this gemspec. The validation error was 'metadata['source_code_uri'] has invalid link: "to-do: Put your gem's public repo URL here."'

14. Handle this error message by commenting out the `"source_code_uri"` and `"changelog_uri"`lines in `bash-taming-magic.gemspec`.
15. `bundle install` again and get a new error

Bundler could not find compatible versions for gem "optparse_plus": In Gemfile: bash-taming-magic x86_64-darwin-19 was resolved to 0.1.0, which depends on optparse_plus (~> 3.0.0)

Could not find gem 'optparse_plus (~> 3.0.0)', which is required by gem 'bash-taming-magic', in any of the sources.


16. Update `  spec.add_dependency('optparse_plus', '~> 3.0.0')` --> `  spec.add_dependency('optparse-plus', '~> 3.0.0')` within `bash-taming-magic.gemspec`.
17. `bundle install`
18. `rake` --> passes
19. `bundle exec bin/bash-taming-magic --help` --> Yields nice looking help text! 

I believe what is going awry is this [line](https://github.com/davetron5000/optparse-plus/blob/3c0a84a6280d81bab38e5ca2a2701c48cefc8935/bin/optparse_plus#L93) within the generator script. To the best, I can tell there are tests around the gemspec being generated but nothing about its gem dependencies specifically. 

My next step is to pull down the repo and play with it a bit to see if I can render a fix. 
davetron5000 commented 3 years ago

Fixed in 3.0.1 Thanks for finding this!