atamur
atamur

Reputation: 1577

how to alias a task in buildr

I might be doing something wrong, cuz I'm using buildr for not so long, so all comments are welcome.

My project structure is:

define :proj do
    define :web do
        task :run do
            # runs the web part of the project in a jetty
        end
    end
end

now if I want to start my project I have to type

buildr proj:web:run

I'd like to type simply

buildr run

instead. How do I achieve that?

Upvotes: 3

Views: 325

Answers (2)

Alex Boisvert
Alex Boisvert

Reputation: 2918

You can also make the task a 'local task',

Project.local_task 'run'

which means that whenever you are inside the web directory, typing buildr run will look for a locally-scoped that of that name.

Note that Buildr 1.4.3 added a standard run task so you typically wouldn't need to make run a local task; see http://buildr.apache.org/more_stuff.html#run for details.

Upvotes: 3

Rhett Sutphin
Rhett Sutphin

Reputation: 1045

At the top level of your buildfile (i.e., outside of any defines), add

task :run => 'proj:web:run'

This defines a task named run whose sole prerequisite is the proj:web:run task.

Upvotes: 5

Related Questions