What is a Rakefile?

RubyRakefile

Ruby Problem Overview


I have started learning Ruby and just tried out my first hello world program in NetBeans IDE. I have one doubt, I can see that the new project wizard created set of package structure. It had one "Rakefile" in it. What does that mean and what is the use of it?

Ruby Solutions


Solution 1 - Ruby

It is an alternative to Makefile with Ruby syntax.

Solution 2 - Ruby

I've been using a rake file to manually kick off a call in the code to import various config files.

My rake file "import_contracts.rake" has the following code:

require 'yaml'

task :import_choice_contracts => :environment do
  desc 'Import Choice Contracts for Contract Service'
  path = "/Users/ernst.r/Desktop/import_contract.yml"
  PhiDao::Contract::Service.import_contract_from_file(path)
end

This rake task calls the "import_contract_from_file()" method and passes it the path to a file to import. Once the server is running I use the command "rake import_choice_contracts". Its great for testing my code while I still don't have a GUI frontend to call the completed code in the backend.

Fissh

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbragboyView Question on Stackoverflow
Solution 1 - RubyLucasView Answer on Stackoverflow
Solution 2 - RubygadildafisshView Answer on Stackoverflow