Permalink
Browse files

Expose Cape's Rake configuration API

  • Loading branch information...
1 parent 0af1525 commit a1c04419937165313a72eba1598911f52fac1a73 @njonsson njonsson committed Mar 14, 2012
Showing with 41 additions and 1 deletion.
  1. +10 −0 README.rdoc
  2. +15 −1 lib/ninja_deploy.rb
  3. +16 −0 spec/ninja_deploy_spec.rb
View
@@ -121,6 +121,11 @@ Include the Sass Rake tasks in your deploy.rb:
mirror_rake_tasks :sass
end
+Run Rake via Bundler, locally and/or remotely, using a configuration:
+
+ NinjaDeploy.local_rake_executable = '/usr/bin/env bundle exec rake'
+ NinjaDeploy.remote_rake_executable = '/usr/bin/env bundle exec rake'
+
=== update
Generates the CSS files from the Sass files.
@@ -144,6 +149,11 @@ Require the thinking sphinx recipes in your deploy.rb file and include the Think
mirror_rake_tasks :thinking_sphinx
end
+Run Rake via Bundler, locally and/or remotely, using a configuration:
+
+ NinjaDeploy.local_rake_executable = '/usr/bin/env bundle exec rake'
+ NinjaDeploy.remote_rake_executable = '/usr/bin/env bundle exec rake'
+
=== configure
Generates the Thinking Sphinx configuration file from the sphinx.yml file.
View
@@ -1,6 +1,20 @@
require 'cape'
-module NinjaDeploy; end
+module NinjaDeploy
+
+ class << self
+ %w( local remote ).each do |location|
+ reader = "#{location}_rake_executable"
+ writer = "#{reader}="
+ [reader, writer].each do |method|
+ define_method method do |*arguments, &block|
+ Cape.send( method, *arguments, &block )
+ end
+ end
+ end
+ end
+
+end
def NinjaDeploy( &block )
Cape( &block )
View
@@ -1,5 +1,21 @@
require 'ninja_deploy'
+describe NinjaDeploy do
+ %w( local_rake_executable remote_rake_executable ).each do |attribute|
+ describe ".#{attribute}" do
+ it "should return the value of Cape.#{attribute}" do
+ Cape.stub!( attribute.to_sym ).and_return 'expected value'
+ NinjaDeploy.send( attribute ).should == 'expected value'
+ end
+
+ it "should set the value of Cape.#{attribute}" do
+ NinjaDeploy.send "#{attribute}=", 'passed-through value'
+ Cape.send( attribute ).should == 'passed-through value'
+ end
+ end
+ end
+end
+
describe '#NinjaDeploy' do
it 'should yield the Cape module if given a unary block' do
yielded = nil

0 comments on commit a1c0441

Please sign in to comment.