voxpupuli / metadata-json-lint

Tool to check the validity of Puppet metadata.json files
Apache License 2.0
29 stars 27 forks source link

gemspec should require 'date' #56

Closed james-stocks closed 7 years ago

james-stocks commented 7 years ago

Using ruby 2.3.1, I get a failure when running 'bundle exec rake -T' or 'tests/test.sh' like:

There was an error while loading `metadata-json-lint.gemspec`: uninitialized constant Date

This commit ensures that 'date' is required by the gemspec

rnelson0 commented 7 years ago

Can you reliably reproduce this? I am not seeing this with ruby 2.3.1 from RVM:

$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
$ bundle --version
Bundler version 1.14.6
$ be rake -T
rake rubocop               # Run RuboCop
rake rubocop:auto_correct  # Auto-correct RuboCop offenses
$ tests/test.sh
Successful Test 'broken' (bin)
Successful Test 'broken' (rake: metadata_lint)
Successful Test 'perfect' (bin)
Successful Test 'perfect' (rake: metadata_lint)
...
james-stocks commented 7 years ago

@rnelson0 I'm not sure of the cause of this, I have:

jstocks@~/GitHub/metadata-json-lint$ (git::master) gem --version
2.6.10
jstocks@~/GitHub/metadata-json-lint$ (git::master) bundle --version
Bundler version 1.14.6
jstocks@~/GitHub/metadata-json-lint$ (git::master) rvm --version
rvm 1.29.1 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]
jstocks@~/GitHub/metadata-json-lint$ (git::master) ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
jstocks@~/GitHub/metadata-json-lint$ (git::master) bundle exec rake -T

[!] There was an error parsing `Gemfile`:
[!] There was an error while loading `metadata-json-lint.gemspec`: uninitialized constant Date
Did you mean?  Data. Bundler cannot continue.

 #  from /Users/jstocks/GitHub/metadata-json-lint/metadata-json-lint.gemspec:4
 #  -------------------------------------------
 #    s.version     = '1.0.0'
 >    s.date        = Date.today.to_s
 #    s.summary     = 'metadata-json-lint /path/to/metadata.json'
 #  -------------------------------------------
. Bundler cannot continue.

 #  from /Users/jstocks/GitHub/metadata-json-lint/Gemfile:3
 #  -------------------------------------------
 #
 >  gemspec
 #  -------------------------------------------

jstocks@~/GitHub/metadata-json-lint$ (git::master)
domcleal commented 7 years ago

I'm able to reproduce the error under Bundler 1.14.6 and RVM too, and I've seen this in other projects before with various versions.

Bundler 1.13.5 doesn't appear to be requiring 'date' - or at least, if it does, the constant doesn't seem to be defined later.

domcleal commented 7 years ago

Thanks @james-stocks.