dagda1
dagda1

Reputation: 28790

Rake script broke in 10.0.1 that use include Rake::DSL

I have a number of rake files that include a common module:

require 'rake'

module RakeCommon
  include Rake::DSL
  task :clean do

And in a rake file:

include RakeCommon

The problems is that after updating to rake 10.0.1, I get the following error:

undefined method `task' for RakeCommon:Module

Upvotes: 0

Views: 141

Answers (1)

samuil
samuil

Reputation: 5081

Just like I stated in comment, but just checked it.

You should use extend instead of include in your module. Your code was working earlier, because Rake::DSL module was extending Object. Methods you were using were available in module no matter if you included or extended it properly. In 10.0 branch some deprecated things were removed, that's why it did not work.

Upvotes: 2

Related Questions