instance method
rakefile
Ruby on Rails 6.1.7.10
Since v3.0.20Signature
rakefile(filename, data = nil)
Create a new Rakefile with the provided code (either in a block or a string).
rakefile("bootstrap.rake") do project = ask("What is the UNIX name of your project?") <<-TASK namespace :#{project} do task :bootstrap do puts "I like boots!" end end TASK end rakefile('seed.rake', 'puts "Planting seeds"')
Parameters
-
filenamereq -
dataopt = nil
Source
# File railties/lib/rails/generators/actions.rb, line 196
def rakefile(filename, data = nil)
log :rakefile, filename
data ||= yield if block_given?
create_file("lib/tasks/#{filename}", optimize_indentation(data), verbose: false)
end
Defined in railties/lib/rails/generators/actions.rb line 196
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generators::Actions