Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you create a Rakefile?

Tags:

ruby

rakefile

I have been creating a Rakefile. The directions says to create a Rakefile file that will help you automate common tasks. It also said to put in :

    require 'rake/testtask'

    Rake::TestTask.new do |t|
      t.libs << "tests"
      t.test_files = FileList['tests/test*.rb']
      t.verbose = true
    end

Thanks

like image 614
Virus Avatar asked Apr 15 '26 05:04

Virus


2 Answers

You are going to want to keep your rake tasks in lib/tasks/your_task.rake

task :your_task => :environment do
    some code
end

your_task being the name of your rake task.

Hope this helps

like image 138
Joel Avatar answered Apr 16 '26 22:04

Joel


Simply create a new file and name it as task.rake. Normally we put the rake task in directory lib/tasks. But you can put it anywhere you like.