开发者

how to alias a task in buildr

开发者 https://www.devze.com 2023-02-15 01:17 出处:网络
I might be doing something wrong, cuz I\'m using buildr for not so long, so all comments are welcome.

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?


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.


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.

0

精彩评论

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