Skip to content

Commit

Permalink
allow Instance#converge to take a Pathname
Browse files Browse the repository at this point in the history
  • Loading branch information
cldwalker committed Apr 28, 2012
1 parent 78bc645 commit d2ce95a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/slushy/instance.rb
Expand Up @@ -92,7 +92,7 @@ def bootstrap

def converge(cookbooks_path) # TODO: find the standard Chef term for this
puts "Copying chef resources from provision directory..."
cookbooks_path = "#{cookbooks_path}/" unless cookbooks_path.end_with?('/')
cookbooks_path = "#{cookbooks_path}/" unless cookbooks_path.to_s.end_with?('/')
scp(cookbooks_path, '/tmp/chef-solo', :recursive => true)
puts "Converging server, this may take a while (10-20 minutes)"
run_command!('cd /tmp/chef-solo && sudo /var/lib/gems/1.8/bin/chef-solo -c solo.rb -j dna.json')
Expand Down
3 changes: 2 additions & 1 deletion spec/lib/instance_spec.rb
@@ -1,5 +1,6 @@
require 'spec_helper'
require 'fog'
require 'pathname'

describe Slushy::Instance do
def mock_job(options={})
Expand Down Expand Up @@ -146,7 +147,7 @@ def mock_job(options={})
it "converges the given instance" do
instance.should_receive(:scp).ordered.with('some_path/', "/tmp/chef-solo", :recursive => true).and_return(true)
instance.should_receive(:run_command).ordered.with("cd /tmp/chef-solo && sudo /var/lib/gems/1.8/bin/chef-solo -c solo.rb -j dna.json").and_return(true)
capture_stdout { instance.converge('some_path') }
capture_stdout { instance.converge(Pathname.new('some_path')) }
end
end
end

0 comments on commit d2ce95a

Please sign in to comment.