You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing in a Date argument, there is now code on line 435 that says require 'chronic'. Since trollop by design doesn't have dependencies, this is supposed to not cause an issue if the code using trollop doesn't have the chronic gem loaded. It used to be that there was no require there and this worked fine, because the NameError that would be triggered by the next line (time = Chronic.parse(param)) was rescued and everything would continue to work.
Run bundle exec ruby ./test_trollop_date.rb -d 2011-02-01
You'll get the following error:
/Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:435:in `require': cannot load such file -- chronic (LoadError)
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:435:in `parse_date_parameter'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:401:in `block (3 levels) in parse'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:401:in `map'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:401:in `block (2 levels) in parse'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:401:in `map'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:401:in `block in parse'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:378:in `each'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:378:in `parse'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:742:in `block in options'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:772:in `with_standard_exception_handling'
from /Users/carsten.dreesbach/.rvm/gems/ruby-1.9.3-p550/gems/trollop-2.1.1/lib/trollop.rb:742:in `options'
from ./test_trollop_date.rb:3:in `<main>'
The line require 'chronic' should therefore be removed, or you should also catch the LoadError.
The text was updated successfully, but these errors were encountered:
When passing in a Date argument, there is now code on line 435 that says
require 'chronic'
. Since trollop by design doesn't have dependencies, this is supposed to not cause an issue if the code using trollop doesn't have thechronic
gem loaded. It used to be that there was norequire
there and this worked fine, because the NameError that would be triggered by the next line (time = Chronic.parse(param)
) was rescued and everything would continue to work.Sample setup:
test_trollop_date
test_trollop_date.rb
with contents:bundle install
bundle exec ruby ./test_trollop_date.rb -d 2011-02-01
You'll get the following error:
The line
require 'chronic'
should therefore be removed, or you should also catch theLoadError
.The text was updated successfully, but these errors were encountered: