What is a Rakefile?

元气小坏坏 提交于 2019-11-28 17:23:16

问题


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?


回答1:


It is an alternative to Makefile with Ruby syntax.




回答2:


As a follow-up, you may find these resources helpful:

  • Using the Rake Build Language
  • rake (there are good links here to additional tutorials or webcasts)
  • Basic Rake (video of a talk by Jim Weirich)
  • Power Rake (video of a talk by Jim Weirich)

Jim was the creator and maintainer of Rake before his death in 2014.




回答3:


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



来源:https://stackoverflow.com/questions/2881482/what-is-a-rakefile

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!