lib/capistrano/tasks/nginx-unit.rake in capistrano-nginx-unit-0.4 vs lib/capistrano/tasks/nginx-unit.rake in capistrano-nginx-unit-0.4.1

- old
+ new

@@ -7,10 +7,11 @@ set :nginx_unit_listen, -> { "*:3000" } set :nginx_unit_app_name, -> { fetch(:application) } set :nginx_unit_processes, -> { 1 } set :nginx_unit_user, -> { nil } set :nginx_unit_group, -> { nil } + set :nginx_unit_working_dir, -> { nil } set :nginx_unit_script, -> { "config.ru" } end end namespace :nginx_unit do @@ -64,15 +65,16 @@ on release_roles(fetch(:nginx_unit_roles)) do |role| released_dir = capture(:readlink, "-f", current_path) raise "Doesn't exist released dir: #{released_dir}" unless test("[ -d #{released_dir} ]") app_json = JSON.generate({ - type: "ruby", + type: "ruby", processes: fetch(:nginx_unit_processes), - user: fetch(:nginx_unit_user) || role.user, - group: fetch(:nginx_unit_group) || role.user, - script: File.join(released_dir, fetch(:nginx_unit_script)) - }) + user: fetch(:nginx_unit_user) || role.user, + group: fetch(:nginx_unit_group) || role.user, + working_directory: fetch(:nginx_unit_working_dir), + script: File.join(released_dir, fetch(:nginx_unit_script)) + }.compact) control_nginx_unit(:put, path: "/applications/#{fetch(:nginx_unit_app_name)}", json: app_json) end end