Skip to content

Commit

Permalink
Run defined raketask on start by default [lukasztackowiak]
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Barron committed Mar 20, 2012
1 parent 29e3a04 commit e9097fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -47,6 +47,7 @@ the watched files change.
``` ruby
:task => 'doit' # name of the task to be executed, required
:run_on_all => false # runs when the 'run_all' signal is received from Guard (enter is pressed), default: true
:run_on_start => true # runs when guard is started, default: true
```

## Development
Expand Down
4 changes: 2 additions & 2 deletions lib/guard/rake.rb
Expand Up @@ -4,11 +4,10 @@

module Guard
class Rake < Guard
include ::Rake::DSL

def initialize(watchers=[], options={})
super
@options = {
:run_on_start => true,
:run_on_all => true
}.update(options)
@task = @options[:task]
Expand All @@ -18,6 +17,7 @@ def start
UI.info "Starting guard-rake #{@task}"
::Rake.application.init
::Rake.application.load_rakefile
run_all if @options[:run_on_start]
true
end

Expand Down

0 comments on commit e9097fe

Please sign in to comment.