Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rake tasks failing on last_comment undefined method #134

Open
srobroek opened this issue Dec 21, 2016 · 3 comments
Open

rake tasks failing on last_comment undefined method #134

srobroek opened this issue Dec 21, 2016 · 3 comments

Comments

@srobroek
Copy link

After installation, When trying to run any of the tasks in the rakefile i get the following error message:

sjorsr@puppetmaster ~/packages (master)$ rake spec [ruby-2.3.1p112]
rake aborted!
NoMethodError: undefined method last_comment' for #<Rake::Application:0x00000002185db0> /var/lib/gems/2.3.0/gems/rspec-core-3.1.7/lib/rspec/core/rake_task.rb:104:in define'
/var/lib/gems/2.3.0/gems/rspec-core-3.1.7/lib/rspec/core/rake_task.rb:80:in initialize' /var/lib/gems/2.3.0/gems/puppetlabs_spec_helper-1.2.2/lib/puppetlabs_spec_helper/rake_tasks.rb:19:in new'
/var/lib/gems/2.3.0/gems/puppetlabs_spec_helper-1.2.2/lib/puppetlabs_spec_helper/rake_tasks.rb:19:in <top (required)>' /home/sjorsr/packages/Rakefile:4:in require'
/home/sjorsr/packages/Rakefile:4:in <top (required)>' /var/lib/gems/2.3.0/gems/rake-12.0.0/exe/rake:27:in <top (required)>'
(See full trace by running task with --trace)
sjorsr@puppetmaster ~/packages (master)$

This seems to be related to the fact that in rake v12 and higher support for last_comment has been dropped, and the error seems to be in at least the puppetlabs_spec_helper. Version of puppetlabs_spec_helper is the latest (1.2.2) after installing the gem bundle, so i'm not exactly clear what'd be causing this.

Alternatively i could update the gemfile to use rake < 10.1, however this would be a stopgap measure at most, since at some point Rake would have to be updated.

@tuxmea
Copy link
Contributor

tuxmea commented Dec 21, 2016

Can you please check your bundler and rspec Versions?
Bundler should be at 1.13, rspec must be 3.x
Also see: example42/puppet-network#136

@srobroek
Copy link
Author

srobroek commented Dec 21, 2016

sjorsr@puppetmaster ~/packages (master)$ bundler --version                                                                                                                       [ruby-2.3.1p112]
Bundler version 1.13.6
sjorsr@puppetmaster ~/packages (master)$ rspec --version                                                                                                                         [ruby-2.3.1p112]
3.1.7
sjorsr@puppetmaster ~/packages (master)$     

Seems to be all good regarding versions. Oddly enough i cleaned out my gems, did a fresh git clone and reinstalled the skeleton, and now it seems to be working

So the first issue seems to be resolved (i suspect i had a conflict with the faraday gem).

However, i'm currently getting the following error:

rake aborted!
Don't know how to build task 'coverage' (see --tasks)
/home/sjorsr/test_skeleton/Rakefile:30:in `<top (required)>'

After commenting the line it seems to be working again. When i go through the puppetlabs_spec_helper/rake_tasks files i can't find a reference to any coverage tasks. Bear in mind that i'm not very well versed in Rake syntax, but the issue seems to be that the coverage task is not defined.

replacing the line Rake::Task[:coverage].clear with Rake::Task[:coverage].clear if Rake::Task.task_defined?(":coverage") seems to resolve the issue.

@yankcrime
Copy link

I'm also seeing this - the original error regarding an undefined method that is - on a clean install of Ruby 2.3.3 via rbenv:

$ bundle exec rake --trace -T
rake aborted!
NoMethodError: undefined method `last_comment' for #<Rake::Application:0x007fa9e0163e60>
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rspec-core-3.1.7/lib/rspec/core/rake_task.rb:104:in `define'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rspec-core-3.1.7/lib/rspec/core/rake_task.rb:80:in `initialize'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/puppetlabs_spec_helper-1.2.2/lib/puppetlabs_spec_helper/rake_tasks.rb:19:in `new'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/puppetlabs_spec_helper-1.2.2/lib/puppetlabs_spec_helper/rake_tasks.rb:19:in `<top (required)>'
/Users/nick/src/telegraf/Rakefile:4:in `require'
/Users/nick/src/telegraf/Rakefile:4:in `<top (required)>'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/rake_module.rb:28:in `load'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/rake_module.rb:28:in `load_rakefile'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:687:in `raw_load_rakefile'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:96:in `block in load_rakefile'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:95:in `load_rakefile'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:79:in `block in run'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/Users/nick/.rbenv/versions/2.3.3/bin/rake:22:in `load'
/Users/nick/.rbenv/versions/2.3.3/bin/rake:22:in `<top (required)>'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `load'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `kernel_load'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:27:in `run'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:332:in `exec'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
/Users/nick/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>'
/Users/nick/.rbenv/versions/2.3.3/bin/bundle:22:in `load'
/Users/nick/.rbenv/versions/2.3.3/bin/bundle:22:in `<main>'

Versions look OK:

$ bundler --version
Bundler version 1.13.7
$ rspec --version
3.1.7

I had to pin Rake with the following in my Gemfile:

gem 'rake', '< 11.0'

At which point I also hit the error regarding the coverage task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants