test/config/deploy.rb in yyuu-capistrano-chef-solo-0.1.1 vs test/config/deploy.rb in yyuu-capistrano-chef-solo-0.1.2

- old
+ new

@@ -57,17 +57,20 @@ ensure sudo("rm -f #{files.map { |x| x.dump }.join(" ")}") rescue nil end end -def flush_attributes!() +def reset_chef_solo!() set(:chef_solo_attributes, {}) set(:chef_solo_role_attributes, {}) set(:chef_solo_host_attributes, {}) set(:chef_solo_run_list, []) set(:chef_solo_role_run_list, {}) set(:chef_solo_host_run_list, {}) + variables.each_key do |key| + reset!(key) if /^chef_solo/ =~ key + end end namespace(:test_default) { task(:default) { methods.grep(/^test_/).each do |m| @@ -76,11 +79,11 @@ } before "test_default", "test_default:setup" after "test_default", "test_default:teardown" task(:setup) { - flush_attributes! + reset_chef_solo! set(:chef_solo_attributes, {"aaa" => "AAA"}) set(:chef_solo_role_attributes, {:app => {"bbb" => "BBB"}}) set(:chef_solo_host_attributes, {"192.168.33.10" => {"ccc" => "CCC"}}) set(:chef_solo_run_list, %w(recipe[foo])) set(:chef_solo_role_run_list, {:app => %w(recipe[bar])}) @@ -114,16 +117,15 @@ } before "test_with_local_cookbooks", "test_with_local_cookbooks:setup" after "test_with_local_cookbooks", "test_with_local_cookbooks:teardown" task(:setup) { - flush_attributes! + reset_chef_solo! set(:chef_solo_run_list, %w(recipe[foo] recipe[bar])) set(:chef_solo_cookbooks_scm, :none) set(:chef_solo_cookbooks_repository, File.expand_path("..", File.dirname(__FILE__))) set(:chef_solo_cookbooks_subdir, "config/cookbooks") - reset!(:chef_solo_cookbooks) } task(:teardown) { } @@ -150,17 +152,16 @@ } before "test_with_remote_cookbooks", "test_with_remote_cookbooks:setup" after "test_with_remote_cookbooks", "test_with_remote_cookbooks:teardown" task(:setup) { - flush_attributes! + reset_chef_solo! set(:chef_solo_run_list, %w(recipe[one] recipe[two])) set(:chef_solo_cookbooks_scm, :git) set(:chef_solo_cookbooks_repository, "git://github.com/yyuu/capistrano-chef-solo.git") set(:chef_solo_cookbooks_revision, "develop") set(:chef_solo_cookbooks_subdir, "test/config/cookbooks-ext") - reset!(:chef_solo_cookbooks) } task(:teardown) { } @@ -187,11 +188,11 @@ } before "test_with_multiple_cookbooks", "test_with_multiple_cookbooks:setup" after "test_with_multiple_cookbooks", "test_with_multiple_cookbooks:teardown" task(:setup) { - flush_attributes! + reset_chef_solo! set(:chef_solo_run_list, %w(recipe[bar] recipe[baz] recipe[two] recipe[three])) set(:chef_solo_cookbooks) {{ "local" => { :scm => :none, :repository => File.expand_path("..", File.dirname(__FILE__)), @@ -202,10 +203,9 @@ :repository => "git://github.com/yyuu/capistrano-chef-solo.git", :revision => "develop", :cookbooks => "test/config/cookbooks-ext", }, }} -# reset!(:chef_solo_cookbooks) } task(:teardown) { }