Skip to content

Commit

Permalink
Merge pull request #67 from wneko/master
Browse files Browse the repository at this point in the history
Allow `.invoke reenable: true`. (wneko, #67)
  • Loading branch information
rstacruz committed Dec 14, 2012
2 parents f5841ab + e89d291 commit 90a7848
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/mina/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ module Helpers
#
# invoke :'git:clone'
# invoke :restart
#
# Options:
# reenable (bool) - Execute the task even next time.
#

def invoke(task)
def invoke(task, options = {})
Rake.application.invoke_task task
Rake::Task[task].reenable if options[:reenable]
end

# ### erb
Expand Down
33 changes: 33 additions & 0 deletions spec/dsl/invoke_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'spec_helper'

describe 'Mina' do
it '#invoke should work' do

rake {
task :clone do
queue 'git clone'
end
}

2.times {
rake { invoke :clone }
}

rake.commands.should == ['git clone']
end

it '#invoke should work with :reenable option' do

rake {
task :pull do
queue 'git pull'
end
}

2.times {
rake { invoke :pull, reenable: true }
}

rake.commands.should == ['git pull', 'git pull']
end
end

0 comments on commit 90a7848

Please sign in to comment.