How to invoke a rake file

How is this rakefile invoked?

C:\code>
C:\code>rake
(in C:/code)
rake aborted!
Don’t know how to build task ‘default’

(See full trace by running task with --trace)

C:\code>
C:\code>type rakefile.rb
alias :original_directory :directory
def directory(dir)
original_directory dir
Rake::Task[dir]
end

namespace :utils do
task :create_directories => [
directory(‘public/icons’),
directory(‘public/images’),
directory(‘public/groups’),
]
end
C:\code>

from:
http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial

thanks,

Thufir

On Tue, Mar 25, 2008 at 1:30 PM, Thufir [email protected] wrote:

C:\code>
directory(‘public/icons’),
directory(‘public/images’),
directory(‘public/groups’),
]
end
C:\code>

from:
http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial

[snip]
If I wanted to use Rake to call each of these tasks, I might create a
file called “Rakefile”
[/snip]
from:
http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial

try:
rake utils:create_directories

On Mar 24, 9:30 pm, Michael F. [email protected] wrote:
[…]

C:\code>type rakefile.rb
[…]
If I wanted to use Rake to call each of these tasks, I might create a
file called “Rakefile”
[…]

It is :frowning:

-Thufir

On Mar 25, 1:54 am, Mark R. [email protected] wrote:

[Note: parts of this message were removed to make it a legal post.]

try:
rake utils:create_directories
[…]

Thanks, this worked on Windows :slight_smile:

Why isn’t it:

rake utils:create_directory

I thought it was just rails that did magic with plurals.

thanks,

Thufir

On Wed, Mar 26, 2008 at 12:44 PM, Thufir [email protected] wrote:

It is :frowning:
“rakefile.rb” == “Rakefile”

false

it is?
And yeah, you gotta invoke a task like Mark says.

^ manveru

On Mar 25, 8:56 pm, Michael F. [email protected] wrote:
[…]

“rakefile.rb” == “Rakefile”

false

[…]

On my system at least rakefile.rb == Rakefile for these purposes.
Isn’t that the case, or what did you mean? However, I wonder what
happens when there’s rakefile.rb, Rakefile.rb and Rakefile as well as
rakefile and “rake” is run…

[email protected]:~$
[email protected]:~$ rake
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb,
Rakefile.rb)
/usr/lib/ruby/1.8/rake.rb:1840:in `load_rakefile’
(See full trace by running task with --trace)
[email protected]:~$

-Thufir

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs