开发者

What is a Rakefile?

开发者 https://www.devze.com 2022-12-31 07:43 出处:网络
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.

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?


It is an alternative to Makefile with Ruby syntax.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消