Questions tagged [rakefile]

Rakefile: configuration file for Rake build language (equivalent build.xml in Ant). Rakefiles are Rake's version of Makefiles.

Rakefiles define Rule patterns to synthesize implicit tasks for Rake. There usage is similar to Makefiles for make.

Rakefiles are defined in pure Ruby. There filename is normally rakefile or Rakefile. Rake's command line option —rakefile filename use filename as the name of the rakefile.

227 questions
77
votes
7 answers

Where are rake tasks defined?

On a freshly created Rails project (generated by rails someName), one can run some 'default' rake tasks like: rake test rake db:migrate etc Question is, where does these tasks get described? The default Rakefile doesn't have all these…
ryanprayogo
  • 11,587
  • 11
  • 51
  • 66
69
votes
2 answers

What is a Rakefile?

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…
bragboy
  • 34,892
  • 30
  • 114
  • 171
39
votes
3 answers

File.open, write and save?

I am trying to get a .rb file to make another .rb file within a specific directory with specified content, when that file is run. I dont know whether the best way to do this would be with a Ruby file or a Rake file. You input would be great.
ChuckJHardy
  • 6,956
  • 6
  • 35
  • 39
37
votes
1 answer

Can I pass an argument to rake db:seed?

Part of my seeds.rb loads a lot of data into the database. I want to be able to selectively load this data. E.g. $ rake db:seed or $rake db:seed[0] would just load the necessary data to run the site, while $ rake db:seed[1] would load my big…
Chris
  • 1,231
  • 1
  • 17
  • 35
37
votes
3 answers

Load rake files and run tasks from other files

Currently I'm trying split up my rake files to organize them better. For this, I've added a rake folder to my assets dir, that holds one rake file for each group of tasks. As I'm coming from PHP, I've only very basic knowledge of Ruby/Rake and can't…
kaiser
  • 21,817
  • 17
  • 90
  • 110
32
votes
1 answer

Building a C++ project using rake in Eclipse

I have a C++ project that I build using rake rather than make. To set this up in Eclipse I disabled the CDT and Scanner builders and created a rake builder pointing to the rake executable. This causes the project to be built correctly with Ctrl-B.…
Sasha
  • 1,559
  • 2
  • 10
  • 10
22
votes
9 answers

How can I use a comma in a string argument to a rake task?

I have the following Rakefile: task :test_commas, :arg1 do |t, args| puts args[:arg1] end And want to call it with a single string argument containing commas. Here's what I get: %rake 'test_commas[foo, bar]' foo %rake 'test_commas["foo,…
Ben Taitelbaum
  • 7,343
  • 3
  • 25
  • 45
10
votes
2 answers

Check if rake task exists from within Rakefile

I'm looking for a way to be able to check if a certain rake task exists from within the Rakefile. I have a task dependency that I only want to include as a dependency if that task is available. In this particular case, the task is only available in…
Conor Livingston
  • 905
  • 1
  • 8
  • 17
10
votes
1 answer

Ruby - create gem: reload console with updated gem content

According to this article, we can test around our gem code by adding those lines to our rakefile: task :console do require 'irb' require 'irb/completion' require 'my_gem' # You know what to do. ARGV.clear IRB.start end It works really…
Augustin Riedinger
  • 20,909
  • 29
  • 133
  • 206
10
votes
1 answer

Getting Ruby environment variables from Rake

I have a Rakefile which has tasks for deploying or building an application. This Rakefile is used in both production and development. I would like the build task to know what the environment is. Can this be done without passing a parameter to the…
user1082754
9
votes
2 answers

rake db tasks running twice

I was seeding a development postgres database with a few thousand records from Faker when I caught a problem with the seed file. I aborted the seed operation and rolled back the inserts and fixed the seeds.rb file. When I went to run it again,…
bubunt205
  • 165
  • 1
  • 8
9
votes
1 answer

How do I copy a file from a gem to my rails application using rake

I have a gem with a default configuration YAML file, some_config.yml. I want to create a rake task to copy that file into the config/ directory of my rails application. How can I achieve this?
neojin
  • 212
  • 1
  • 6
8
votes
1 answer

What exactly does $:.unshift(File.expand_path("../../lib", __FILE__)) do?

There are a lot of threads on here about this already I know but none of the titles have this worded exactly like I did. I hope that we can clear this up a bit. $:.unshift(File.expand_path("../../lib", __FILE__)) You see something like this in a…
Douglas G. Allen
  • 2,203
  • 21
  • 20
7
votes
1 answer

NoMethodError: undefined method `symbolize_keys!' for Hash

I'm trying to use Hashie outside of Rails. In my rakefile, I've included require hashie/hash, but I still get the NoMethodError. I've tried using require hash; no luck there either. This is the line it fails…
user3827303
  • 409
  • 4
  • 15
7
votes
3 answers

Octopress errors - rake preview, watch or generate

I followed all instructions in Octopress Documentation: sddhrthrt@thinkpad:~/octopress$ rake generate ## Generating Site with Jekyll directory source/stylesheets/ create source/stylesheets/screen.css Configuration from…
SiddharthaRT
  • 2,217
  • 4
  • 20
  • 28
1
2 3
15 16