diff --git a/README.md b/README.md index dc3846c..f510e87 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ by default, paratrooper-chef uses following files and directories. * config/cookbooks * config/site-cookbooks * config/roles +* config/environments * config/data_bags * config/data_bag_key @@ -122,6 +123,7 @@ Following options are available. * `:chef_cookbooks_path` - cookbooks directories list. use `["cookbooks", "site-cookbooks"]` by default. * `:chef_nodes_path` - nodes directory. use `nodes` by default. * `:chef_roles_path` - roles directory. use `roles` by default. + * `:chef_environments_path` - environments directory. use `environments` by default. * `:chef_databags_path` - data bags directory. use `data_bags` by default. * `:chef_databag_secret` - path of secret-key for data bags. use `data_bag_key` by default. diff --git a/lib/capistrano-paratrooper-chef/chef.rb b/lib/capistrano-paratrooper-chef/chef.rb index 1a13b99..7241b12 100644 --- a/lib/capistrano-paratrooper-chef/chef.rb +++ b/lib/capistrano-paratrooper-chef/chef.rb @@ -25,9 +25,10 @@ # directory structure of chef-kitchen set :chef_kitchen_path, "config" set :chef_default_solo_json_path, "solo.json" - set :chef_cookbooks_path, ["cookbooks", "site-cookbooks"] set :chef_nodes_path, "nodes" + set :chef_cookbooks_path, ["cookbooks", "site-cookbooks"] set :chef_roles_path, "roles" + set :chef_environments_path, "environments" set :chef_databags_path, "data_bags" set :chef_databag_secret, "data_bag_key" @@ -92,6 +93,10 @@ def role_exists?(name) File.exist?(File.join(roles_path, name.to_s + ".rb")) end + def environments_path + File.join(fetch(:chef_kitchen_path), fetch(:chef_environments_path)) + end + def databags_path File.join(fetch(:chef_kitchen_path), fetch(:chef_databags_path)) end @@ -188,6 +193,7 @@ def generate_solo_rb file_cache_path #{fetch(:chef_cache_dir).inspect} cookbook_path #{kitchen.cookbooks_paths.inspect}.collect{|dir| File.join(root, dir)} role_path File.join(root, #{kitchen.roles_path.inspect}) + environments_path File.join(root, #{kitchen.environments_path.inspect}) data_bag_path File.join(root, #{kitchen.databags_path.inspect}) verbose_logging #{fetch(:chef_verbose_logging)} CONF @@ -258,7 +264,8 @@ def ensure_working_dir stream = StringIO.new TarWriter.new(stream) do |writer| - kitchen_paths = [cookbooks_paths, roles_path, databags_path, databag_secret_path].flatten.compact.select{|d| File.exists?(d)} + paths = [cookbooks_paths, roles_path, environments_path, databags_path, databag_secret_path] + kitchen_paths = paths.flatten.compact.select{|d| File.exists?(d)} Find.find(*kitchen_paths) do |path| writer.add(path) end