Skip to content

Commit f153ffe

Browse files
author
Shevaun Coker
committed
make niet roles a variable so that apps can specify additional roles if required
1 parent be5513f commit f153ffe

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/easy-deployment/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Easy
22
module Deployment
3-
VERSION = "0.4.2"
3+
VERSION = "0.4.3"
44
end
55
end

lib/easy/deployment/niet.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,20 @@
33

44
Capistrano::Configuration.instance(:must_exist).load do
55
set :niet_process_count, 2
6+
set :niet_roles, [:job]
67

78
def remote_file_exists?(full_path)
89
'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
910
end
1011

1112
namespace :niet do
1213
desc "Setup Niet"
13-
task :setup, roles: :job do
14+
task :setup, roles: niet_roles do
1415
run "mkdir -p #{shared_path}/niet"
1516
end
1617

1718
desc "Starts the niet process monitor and its jobs"
18-
task :start, roles: :job do
19+
task :start, roles: niet_roles do
1920
if remote_file_exists?("#{shared_path}/niet")
2021
niet_process_count.times do |i|
2122
run "niet -p #{shared_path}/niet/jobs_worker_#{i}.pid -c #{current_path} bundle exec rake jobs:work RAILS_ENV=#{stage}"
@@ -26,7 +27,7 @@ def remote_file_exists?(full_path)
2627
end
2728

2829
desc "Restarts the processes running under niet"
29-
task :restart, roles: :job do
30+
task :restart, roles: niet_roles do
3031
if remote_file_exists?("#{shared_path}/niet")
3132
run "for job in #{shared_path}/niet/* ; do kill -TERM `cat $job`; done"
3233
else
@@ -35,12 +36,12 @@ def remote_file_exists?(full_path)
3536
end
3637

3738
desc "Stops the processes running under niet and the niet process monitor"
38-
task :stop, roles: :job do
39+
task :stop, roles: niet_roles do
3940
run "for job in #{shared_path}/niet/* ; do kill -QUIT `cat $job`; done"
4041
end
4142

4243
desc "Diplays the status of the niet process monitor"
43-
task :status, roles: :job do
44+
task :status, roles: niet_roles do
4445
run "for job in #{shared_path}/niet/* ; do ps -fw `cat $job`; done"
4546
end
4647
end

0 commit comments

Comments
 (0)