capistrano-psw 1.0.0.pre5 → 1.0.0.pre6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48d2c344f620b4ae02802db0043b4cd107f4cf5d
4
- data.tar.gz: 678bfc8d223f9c5f79bcdba8dbd9309c34936472
3
+ metadata.gz: cc10b5622674ae3323a5136fccfa43120186422a
4
+ data.tar.gz: 264b6d4fcdc320c2f82ae0d1c266c0299bad98fd
5
5
  SHA512:
6
- metadata.gz: 6caf23b698fb936c13ef4d615bdf0368bb3feedf04121c87f89f03169c6ce7852dbfbcb76a9bbc79821d4f7bea274165ca6f1d331c0460cb09052b547e7bd7b6
7
- data.tar.gz: 2249806a01337d04102bac6565a9882500c0f0f0b7d3ac5b73bf34116dcdfd6caf37a33b3d6c0d76e1dcb2fb1c26183f556c5101d874fb1875bfacc46a5095f4
6
+ metadata.gz: 212bcf427877757ee04341e0ae3d3c8d10b744b065e37e0a028151e3cf61d4dc8fab952ff4e1bf9e4661911f11d02407d02ddcf93f545734a187129b22e61fe8
7
+ data.tar.gz: 9e4f03b7d9869e389fb9810a5ff6045c01cee5c9284e1f0f881e8203c9942d7fb778a539d3b4e8f43a24d6691bdc9273e0a46b0924c15abc81ab21b3a24edc24
data/README.md CHANGED
@@ -132,6 +132,34 @@ still points to the last run (otherwise the PID files won't exist)
132
132
  ### psw_sidekiq:restart
133
133
  Executes the following tasks: stop, start
134
134
 
135
+ ## Clockwork-related Tasks
136
+ These tasks provides controls for clockwork (https://github.com/tomykaira/clockwork/), by providing
137
+ mechanisms to stop, start, and restart associated clockwork servers. Unfortunately the standard daemon
138
+ engine for clockwork, clockworkd (https://github.com/arufanov/Clockworkd), doesn't support Capistrano
139
+ v3, so this serves as a replacement.
140
+
141
+ These tasks require that the 'daemon' packaged be installed on the executing system. On Ubuntu,
142
+ # this can be installed by executing the following command: sudo apt-get install daemon
143
+
144
+ ### psw_clockwork:start
145
+ Starts a clockwork server.
146
+
147
+ ```ruby
148
+ before :'psw_clockwork:stop', :set_clockwork_options do
149
+ set :psw_clockwork_log_file, "#{fetch(:current_path)}/log/clockwork.log"
150
+ set :psw_clockwork_pid_file, "#{fetch(:current_path)}/tmp/pids/clockwork.pid"
151
+ set :psw_clockwork_config_file, "config/clockwork.rb"
152
+ end
153
+ ```
154
+
155
+ ### psw_clockwork:stop
156
+ Stops all known clockwork servers (by reviewing the PID files in the 'current' deployment). It
157
+ should be noted that this task should run as a'before' hook, so that the 'current' directory
158
+ still points to the last run (otherwise the PID files won't exist)
159
+
160
+ ### psw_clockwork:restart
161
+ Executes the following tasks: stop, start
162
+
135
163
  ## License
136
164
 
137
165
  2013 Lexmark International Technology S.A. All rights reserved.
@@ -10,6 +10,6 @@
10
10
 
11
11
  module Capistrano
12
12
  module Psw
13
- VERSION = "1.0.0.pre5"
13
+ VERSION = "1.0.0.pre6"
14
14
  end
15
15
  end
@@ -0,0 +1,99 @@
1
+ # == psw-clockwork.cap
2
+ #
3
+ # These tasks provides controls for clockwork (https://github.com/tomykaira/clockwork/), by providing
4
+ # mechanisms to stop, start, and restart associated clockwork servers. Unfortunately the standard daemon
5
+ # engine for clockwork, clockworkd (https://github.com/arufanov/Clockworkd), doesn't support Capistrano
6
+ # v3, so this serves as a replacement.
7
+ #
8
+ # Note: These tasks require that the 'daemon' packaged be installed on the executing system. On Ubuntu,
9
+ # this can be installed by executing the following command: sudo apt-get install daemon
10
+ #
11
+ # == Configuration
12
+ # The following configuration options may be set (should be set before the 'stop' task is executed):
13
+ #
14
+ # before :'psw_clockwork:stop', :set_clockwork_options do
15
+ # set :psw_clockwork_log_file, "#{fetch(:current_path)}/log/clockwork.log"
16
+ # set :psw_clockwork_pid_file, "#{fetch(:current_path)}/tmp/pids/clockwork.pid"
17
+ # set :psw_clockwork_config_file, "config/clockwork.rb"
18
+ # end
19
+ #
20
+ # * psw_clockwork_log_file
21
+ # ** Defines (absolutely) the log file that will be written.
22
+ # ** Default Value: #{fetch(:current_path)}/log/clockwork.log
23
+ # * psw_clockwork_pid_file
24
+ # ** Defines (absolutely) the PID file that will be written.
25
+ # ** Default Value: #{fetch(:current_path)}/tmp/pids/clockwork.pid
26
+ # * psw_clockwork_config_file
27
+ # ** Defines (relative to project root), the configuration file that will be used.
28
+ # ** Default Value: config/clockwork.rb
29
+ #
30
+ # == Tasks
31
+ #
32
+ # === psw_clockwork:start
33
+ # Starts a clockwork server.
34
+ #
35
+ # === psw_clockwork:stop
36
+ # Stops all known clockwork servers (by reviewing the PID files in the 'current' deployment). It
37
+ # should be noted that this task should run as a'before' hook, so that the 'current' directory
38
+ # still points to the last run (otherwise the PID files won't exist)
39
+ #
40
+ # === psw_clockwork:restart
41
+ # Executes the following tasks: stop, start
42
+ #
43
+ # == Contact
44
+ #
45
+ # Author:: Lexmark International Technology S.A.
46
+ # Copyright:: 2013 Lexmark International Technology S.A. All rights reserved.
47
+ # License:: 3-Clause BSD
48
+
49
+ namespace :psw_clockwork do
50
+
51
+ def rails_env
52
+ fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : ''
53
+ end
54
+
55
+ def current_path
56
+ fetch(:current_path, '')
57
+ end
58
+
59
+ def log_file
60
+ fetch(:psw_clockwork_log_file, "#{current_path}/log/clockwork.log")
61
+ end
62
+
63
+ def pid_file
64
+ fetch(:psw_clockwork_pid_file, "#{current_path}/tmp/pids/clockwork.pid")
65
+ end
66
+
67
+ def config_file
68
+ fetch(:psw_clockwork_config_file, "config/clockwork.rb")
69
+ end
70
+
71
+ desc "Start clockwork server(s)..."
72
+ task :start do
73
+ on roles(:all) do |host|
74
+ info "Preparing to start clockwork server(s)..."
75
+ execute "daemon --inherit --name=clockwork --env='#{rails_env}' --output=#{log_file} --pidfile=#{pid_file} -D #{current_path} -- bundle exec clockwork #{config_file}"
76
+ info "Finished starting all clockwork server(s)"
77
+ end
78
+ end
79
+
80
+ desc "Stop clockwork server(s)..."
81
+ task :stop do
82
+ on roles(:all) do |host|
83
+ info "Looking for any running clockwork server(s)..."
84
+ execute "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && kill -INT `cat #{pid_file}` ; fi"
85
+ info "Finished stopping all clockwork server(s)"
86
+ end
87
+ end
88
+
89
+ desc "Restart any clockwork server(s)..."
90
+ task :restart do
91
+ #force a re-execution
92
+ Rake::Task['psw_clockwork:stop'].reenable
93
+ invoke :'psw_clockwork:stop'
94
+
95
+ #force a re-execution
96
+ Rake::Task['psw_clockwork:start'].reenable
97
+ invoke :'psw_clockwork:start'
98
+ end
99
+ end
@@ -0,0 +1,50 @@
1
+ require "rake"
2
+ require File.expand_path('../spec_helper.rb', __FILE__)
3
+
4
+
5
+ describe "psw_clockwork:" do
6
+ describe "restart" do
7
+ let(:rake) { Rake::Application.new }
8
+ subject { rake["psw_clockwork:restart"] }
9
+
10
+ before do
11
+ Rake.application = rake
12
+ Rake.application.add_import("./resources/lib/capistrano/tasks/psw-clockwork.cap")
13
+ Rake.application.load_imports()
14
+ end
15
+
16
+ it "has 'no prerequisites" do
17
+ subject.prerequisites.should be_empty
18
+ end
19
+ end
20
+
21
+ describe "start" do
22
+ let(:rake) { Rake::Application.new }
23
+ subject { rake["psw_clockwork:start"] }
24
+
25
+ before do
26
+ Rake.application = rake
27
+ Rake.application.add_import("./resources/lib/capistrano/tasks/psw-clockwork.cap")
28
+ Rake.application.load_imports()
29
+ end
30
+
31
+ it "has 'no prerequisites" do
32
+ subject.prerequisites.should be_empty
33
+ end
34
+ end
35
+
36
+ describe "stop" do
37
+ let(:rake) { Rake::Application.new }
38
+ subject { rake["psw_clockwork:stop"] }
39
+
40
+ before do
41
+ Rake.application = rake
42
+ Rake.application.add_import("./resources/lib/capistrano/tasks/psw-clockwork.cap")
43
+ Rake.application.load_imports()
44
+ end
45
+
46
+ it "has 'no prerequisites" do
47
+ subject.prerequisites.should be_empty
48
+ end
49
+ end
50
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-psw
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre5
4
+ version: 1.0.0.pre6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lexmark International Technology S.A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-27 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -85,8 +85,10 @@ files:
85
85
  - lib/capistrano/psw.rb
86
86
  - lib/capistrano/psw/task_loader.rb
87
87
  - lib/capistrano/psw/version.rb
88
+ - resources/lib/capistrano/tasks/psw-clockwork.cap
88
89
  - resources/lib/capistrano/tasks/psw-repo.cap
89
90
  - resources/lib/capistrano/tasks/psw-sidekiq.cap
91
+ - spec/psw-clockwork_spec.rb
90
92
  - spec/psw-repo_spec.rb
91
93
  - spec/psw-sidekiq_spec.rb
92
94
  - spec/spec_helper.rb
@@ -116,6 +118,7 @@ signing_key:
116
118
  specification_version: 4
117
119
  summary: Contains Capistrano v3 Deployment Tasks
118
120
  test_files:
121
+ - spec/psw-clockwork_spec.rb
119
122
  - spec/psw-repo_spec.rb
120
123
  - spec/psw-sidekiq_spec.rb
121
124
  - spec/spec_helper.rb