whenever 0.8.2 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +17 -1
- data/LICENSE +2 -2
- data/README.md +3 -3
- data/lib/whenever/capistrano/recipes.rb +2 -9
- data/lib/whenever/capistrano/support.rb +12 -0
- data/lib/whenever/command_line.rb +20 -20
- data/lib/whenever/job.rb +8 -7
- data/lib/whenever/output_redirection.rb +1 -0
- data/lib/whenever/setup.rb +18 -9
- data/lib/whenever/version.rb +2 -2
- data/lib/whenever.rb +5 -1
- data/test/functional/command_line_test.rb +12 -0
- data/test/functional/output_default_defined_jobs_test.rb +75 -4
- data/test/functional/output_jobs_for_roles_test.rb +2 -1
- data/test/functional/output_redirection_test.rb +19 -0
- data/test/unit/capistrano_support_test.rb +16 -0
- data/whenever.gemspec +8 -1
- metadata +19 -30
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c96bb55bfcc94c54bab65174a8fb046aa4bfcff1
|
4
|
+
data.tar.gz: fbce8b6cd1f6c8558e9281af9f6cbccade7dcd71
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a23ed3067c55356fb7f98f18d267d508d410cbe63a9ea2dc1f3aaa491bfa6df03cf856ff315a2adb64290cab7fa9348ed486ac362afec8b35583d4efc251eef6
|
7
|
+
data.tar.gz: 3e79b8eba708dd80fa79fa8ba80a81205a889f196f6a5a00ee3cdfce82c669ef93e96a10c321cfb4c7cd7fe9addc1ca75860aaa5c082da6ed6400def6c42d575
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
* Time zone support
|
4
4
|
|
5
5
|
|
6
|
+
### 0.8.4 / July 22, 2012
|
7
|
+
|
8
|
+
* Don't require schedule file when clearing. [Javan Makhmali]
|
9
|
+
|
10
|
+
* Use bin/rails when available. [Javan Makhmali]
|
11
|
+
|
12
|
+
|
13
|
+
### 0.8.3 / July 11, 2013
|
14
|
+
|
15
|
+
* Improve Cap rollback logic. [Jeroen Jacobs]
|
16
|
+
|
17
|
+
* Allow configuration of the environment variable. [andfx]
|
18
|
+
|
19
|
+
* Output option can be a callable Proc. [Li Xiao]
|
20
|
+
|
21
|
+
|
6
22
|
### 0.8.2 / January 10, 2013
|
7
23
|
|
8
24
|
* Fix Capistrano host options. [Igor Yamolov, Wes Morgan]
|
@@ -257,4 +273,4 @@
|
|
257
273
|
|
258
274
|
### 0.1.0 / February 15th, 2009
|
259
275
|
|
260
|
-
* Initial release [Javan Makhmali]
|
276
|
+
* Initial release [Javan Makhmali]
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2013 Javan Makhmali
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person
|
4
4
|
obtaining a copy of this software and associated documentation
|
@@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
19
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
20
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
21
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -73,14 +73,14 @@ The default job types that ship with Whenever are defined like so:
|
|
73
73
|
|
74
74
|
```ruby
|
75
75
|
job_type :command, ":task :output"
|
76
|
-
job_type :rake, "cd :path &&
|
76
|
+
job_type :rake, "cd :path && :environment_variable=:environment bundle exec rake :task --silent :output"
|
77
77
|
job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output"
|
78
|
-
job_type :script, "cd :path &&
|
78
|
+
job_type :script, "cd :path && :environment_variable=:environment bundle exec script/:task :output"
|
79
79
|
```
|
80
80
|
|
81
81
|
Pre-Rails 3 apps and apps that don't use Bundler will redefine the `rake` and `runner` jobs respectively to function correctly.
|
82
82
|
|
83
|
-
If a `:path` is not set it will default to the directory in which `whenever` was executed. `:environment` will default to 'production'. `:output` will be replaced with your output redirection settings which you can read more about here: <http://github.com/javan/whenever/wiki/Output-redirection-aka-logging-your-cron-jobs>
|
83
|
+
If a `:path` is not set it will default to the directory in which `whenever` was executed. `:environment_variable` will default to 'RAILS_ENV'. `:environment` will default to 'production'. `:output` will be replaced with your output redirection settings which you can read more about here: <http://github.com/javan/whenever/wiki/Output-redirection-aka-logging-your-cron-jobs>
|
84
84
|
|
85
85
|
All jobs are by default run with `bash -l -c 'command...'`. Among other things, this allows your cron jobs to play nice with RVM by loading the entire environment instead of cron's somewhat limited environment. Read more: <http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production>
|
86
86
|
|
@@ -22,18 +22,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
22
22
|
}
|
23
23
|
|
24
24
|
if whenever_servers.any?
|
25
|
+
args = whenever_prepare_for_rollback(args) if task_call_frames[0].task.fully_qualified_name == 'deploy:rollback'
|
25
26
|
whenever_run_commands(args)
|
26
27
|
|
27
28
|
on_rollback do
|
28
|
-
|
29
|
-
# rollback to the previous release's crontab
|
30
|
-
args[:path] = fetch(:previous_release)
|
31
|
-
else
|
32
|
-
# clear the crontab if no previous release
|
33
|
-
args[:path] = fetch(:release_path)
|
34
|
-
args[:flags] = fetch(:whenever_clear_flags)
|
35
|
-
end
|
36
|
-
|
29
|
+
args = whenever_prepare_for_rollback(args)
|
37
30
|
whenever_run_commands(args)
|
38
31
|
end
|
39
32
|
end
|
@@ -22,6 +22,18 @@ module Whenever
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def whenever_prepare_for_rollback args
|
26
|
+
if fetch(:previous_release)
|
27
|
+
# rollback to the previous release's crontab
|
28
|
+
args[:path] = fetch(:previous_release)
|
29
|
+
else
|
30
|
+
# clear the crontab if no previous release
|
31
|
+
args[:path] = fetch(:release_path)
|
32
|
+
args[:flags] = fetch(:whenever_clear_flags)
|
33
|
+
end
|
34
|
+
args
|
35
|
+
end
|
36
|
+
|
25
37
|
def whenever_run_commands(args)
|
26
38
|
unless [:command, :path, :flags].all? { |a| args.include?(a) }
|
27
39
|
raise ArgumentError, ":command, :path, & :flags are required"
|
@@ -6,15 +6,15 @@ module Whenever
|
|
6
6
|
def self.execute(options={})
|
7
7
|
new(options).run
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def initialize(options={})
|
11
11
|
@options = options
|
12
|
-
|
12
|
+
|
13
13
|
@options[:file] ||= 'config/schedule.rb'
|
14
14
|
@options[:cut] ||= 0
|
15
15
|
@options[:identifier] ||= default_identifier
|
16
|
-
|
17
|
-
|
16
|
+
|
17
|
+
if !File.exists?(@options[:file]) && @options[:clear].nil?
|
18
18
|
warn("[fail] Can't find file: #{@options[:file]}")
|
19
19
|
exit(1)
|
20
20
|
end
|
@@ -30,7 +30,7 @@ module Whenever
|
|
30
30
|
end
|
31
31
|
@options[:cut] = @options[:cut].to_i
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def run
|
35
35
|
if @options[:update] || @options[:clear]
|
36
36
|
write_crontab(updated_crontab)
|
@@ -43,28 +43,28 @@ module Whenever
|
|
43
43
|
exit(0)
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
protected
|
48
|
-
|
48
|
+
|
49
49
|
def default_identifier
|
50
50
|
File.expand_path(@options[:file])
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def whenever_cron
|
54
54
|
return '' if @options[:clear]
|
55
55
|
@whenever_cron ||= [comment_open, Whenever.cron(@options), comment_close].compact.join("\n") + "\n"
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def read_crontab
|
59
59
|
return @current_crontab if @current_crontab
|
60
|
-
|
60
|
+
|
61
61
|
command = ['crontab -l']
|
62
62
|
command << "-u #{@options[:user]}" if @options[:user]
|
63
|
-
|
63
|
+
|
64
64
|
command_results = %x[#{command.join(' ')} 2> /dev/null]
|
65
65
|
@current_crontab = $?.exitstatus.zero? ? prepare(command_results) : ''
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
def write_crontab(contents)
|
69
69
|
tmp_cron_file = Tempfile.open('whenever_tmp_cron')
|
70
70
|
tmp_cron_file << contents
|
@@ -86,8 +86,8 @@ module Whenever
|
|
86
86
|
exit(1)
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
90
|
-
def updated_crontab
|
89
|
+
|
90
|
+
def updated_crontab
|
91
91
|
# Check for unopened or unclosed identifier blocks
|
92
92
|
if read_crontab =~ Regexp.new("^#{comment_open}\s*$") && (read_crontab =~ Regexp.new("^#{comment_close}\s*$")).nil?
|
93
93
|
warn "[fail] Unclosed indentifier; Your crontab file contains '#{comment_open}', but no '#{comment_close}'"
|
@@ -96,7 +96,7 @@ module Whenever
|
|
96
96
|
warn "[fail] Unopened indentifier; Your crontab file contains '#{comment_close}', but no '#{comment_open}'"
|
97
97
|
exit(1)
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
# If an existing identier block is found, replace it with the new cron entries
|
101
101
|
if read_crontab =~ Regexp.new("^#{comment_open}\s*$") && read_crontab =~ Regexp.new("^#{comment_close}\s*$")
|
102
102
|
# If the existing crontab file contains backslashes they get lost going through gsub.
|
@@ -106,7 +106,7 @@ module Whenever
|
|
106
106
|
[read_crontab, whenever_cron].join("\n\n")
|
107
107
|
end.gsub(/\n{3,}/, "\n\n") # More than two newlines becomes just two.
|
108
108
|
end
|
109
|
-
|
109
|
+
|
110
110
|
def prepare(contents)
|
111
111
|
# Strip n lines from the top of the file as specified by the :cut option.
|
112
112
|
# Use split with a -1 limit option to ensure the join is able to rebuild
|
@@ -114,19 +114,19 @@ module Whenever
|
|
114
114
|
stripped_contents = contents.split($/,-1)[@options[:cut]..-1].join($/)
|
115
115
|
|
116
116
|
# Some cron implementations require all non-comment lines to be newline-
|
117
|
-
# terminated. (issue #95) Strip all newlines and replace with the default
|
117
|
+
# terminated. (issue #95) Strip all newlines and replace with the default
|
118
118
|
# platform record seperator ($/)
|
119
119
|
stripped_contents.gsub!(/\s+$/, $/)
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
def comment_base
|
123
123
|
"Whenever generated tasks for: #{@options[:identifier]}"
|
124
124
|
end
|
125
|
-
|
125
|
+
|
126
126
|
def comment_open
|
127
127
|
"# Begin #{comment_base}"
|
128
128
|
end
|
129
|
-
|
129
|
+
|
130
130
|
def comment_close
|
131
131
|
"# End #{comment_base}"
|
132
132
|
end
|
data/lib/whenever/job.rb
CHANGED
@@ -6,13 +6,14 @@ module Whenever
|
|
6
6
|
|
7
7
|
def initialize(options = {})
|
8
8
|
@options = options
|
9
|
-
@at
|
10
|
-
@template
|
11
|
-
@job_template
|
12
|
-
@roles
|
13
|
-
@options[:output]
|
14
|
-
@options[:
|
15
|
-
@options[:
|
9
|
+
@at = options.delete(:at)
|
10
|
+
@template = options.delete(:template)
|
11
|
+
@job_template = options.delete(:job_template) || ":job"
|
12
|
+
@roles = Array.wrap(options.delete(:roles))
|
13
|
+
@options[:output] = options.has_key?(:output) ? Whenever::Output::Redirection.new(options[:output]).to_s : ''
|
14
|
+
@options[:environment_variable] ||= "RAILS_ENV"
|
15
|
+
@options[:environment] ||= :production
|
16
|
+
@options[:path] = Shellwords.shellescape(@options[:path] || Whenever.path)
|
16
17
|
end
|
17
18
|
|
18
19
|
def output
|
data/lib/whenever/setup.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# Environment variable defaults to RAILS_ENV
|
2
|
+
set :environment_variable, "RAILS_ENV"
|
1
3
|
# Environment defaults to production
|
2
4
|
set :environment, "production"
|
3
5
|
# Path defaults to the directory `whenever` was run from
|
@@ -11,16 +13,23 @@ job_type :command, ":task :output"
|
|
11
13
|
|
12
14
|
# Run rake through bundler if possible
|
13
15
|
if Whenever.bundler?
|
14
|
-
job_type :rake, "cd :path &&
|
15
|
-
job_type :script, "cd :path &&
|
16
|
+
job_type :rake, "cd :path && :environment_variable=:environment bundle exec rake :task --silent :output"
|
17
|
+
job_type :script, "cd :path && :environment_variable=:environment bundle exec script/:task :output"
|
16
18
|
else
|
17
|
-
job_type :rake, "cd :path &&
|
18
|
-
job_type :script, "cd :path &&
|
19
|
+
job_type :rake, "cd :path && :environment_variable=:environment rake :task --silent :output"
|
20
|
+
job_type :script, "cd :path && :environment_variable=:environment script/:task :output"
|
19
21
|
end
|
20
22
|
|
21
|
-
# Create a runner job that's appropriate for the Rails version
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
# Create a runner job that's appropriate for the Rails version
|
24
|
+
def runner_for_app
|
25
|
+
case
|
26
|
+
when Whenever.bin_rails?
|
27
|
+
"bin/rails runner"
|
28
|
+
when Whenever.script_rails?
|
29
|
+
"script/rails runner"
|
30
|
+
else
|
31
|
+
"script/runner"
|
32
|
+
end
|
26
33
|
end
|
34
|
+
|
35
|
+
job_type :runner, "cd :path && #{runner_for_app} -e :environment ':task' :output"
|
data/lib/whenever/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Whenever
|
2
|
-
VERSION = '0.8.
|
3
|
-
end
|
2
|
+
VERSION = '0.8.4'
|
3
|
+
end
|
data/lib/whenever.rb
CHANGED
@@ -161,6 +161,18 @@ NEW_CRON
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
+
context "A command line clear with no schedule file" do
|
165
|
+
setup do
|
166
|
+
File.expects(:exists?).with('config/schedule.rb').returns(false)
|
167
|
+
@command = Whenever::CommandLine.new(:clear => true, :identifier => 'My identifier')
|
168
|
+
end
|
169
|
+
|
170
|
+
should "run successfully" do
|
171
|
+
@command.expects(:write_crontab).returns(true)
|
172
|
+
assert @command.run
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
164
176
|
context "A command line update with no identifier" do
|
165
177
|
setup do
|
166
178
|
File.expects(:exists?).with('config/schedule.rb').returns(true)
|
@@ -107,10 +107,10 @@ class OutputDefaultDefinedJobsTest < Test::Unit::TestCase
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
context "A runner for
|
110
|
+
context "A runner for an app with bin/rails" do
|
111
111
|
setup do
|
112
112
|
Whenever.expects(:path).at_least_once.returns('/my/path')
|
113
|
-
Whenever.expects(:
|
113
|
+
Whenever.expects(:bin_rails?).returns(true)
|
114
114
|
@output = Whenever.cron \
|
115
115
|
<<-file
|
116
116
|
set :job_template, nil
|
@@ -120,7 +120,25 @@ class OutputDefaultDefinedJobsTest < Test::Unit::TestCase
|
|
120
120
|
file
|
121
121
|
end
|
122
122
|
|
123
|
-
should "use
|
123
|
+
should "use a script/rails runner job by default" do
|
124
|
+
assert_match two_hours + %( cd /my/path && bin/rails runner -e production 'blahblah'), @output
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context "A runner for an app with script/rails" do
|
129
|
+
setup do
|
130
|
+
Whenever.expects(:path).at_least_once.returns('/my/path')
|
131
|
+
Whenever.expects(:script_rails?).returns(true)
|
132
|
+
@output = Whenever.cron \
|
133
|
+
<<-file
|
134
|
+
set :job_template, nil
|
135
|
+
every 2.hours do
|
136
|
+
runner 'blahblah'
|
137
|
+
end
|
138
|
+
file
|
139
|
+
end
|
140
|
+
|
141
|
+
should "use a script/rails runner job by default" do
|
124
142
|
assert_match two_hours + %( cd /my/path && script/rails runner -e production 'blahblah'), @output
|
125
143
|
end
|
126
144
|
end
|
@@ -179,6 +197,41 @@ class OutputDefaultDefinedJobsTest < Test::Unit::TestCase
|
|
179
197
|
end
|
180
198
|
end
|
181
199
|
|
200
|
+
context "A rake command that sets the environment variable" do
|
201
|
+
setup do
|
202
|
+
@output = Whenever.cron \
|
203
|
+
<<-file
|
204
|
+
set :job_template, nil
|
205
|
+
set :path, '/my/path'
|
206
|
+
set :environment_variable, 'RAKE_ENV'
|
207
|
+
every 2.hours do
|
208
|
+
rake "blahblah"
|
209
|
+
end
|
210
|
+
file
|
211
|
+
end
|
212
|
+
|
213
|
+
should "output the rake command using that environment variable" do
|
214
|
+
assert_match two_hours + ' cd /my/path && RAKE_ENV=production bundle exec rake blahblah --silent', @output
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
context "A rake command that overrides the environment variable" do
|
219
|
+
setup do
|
220
|
+
@output = Whenever.cron \
|
221
|
+
<<-file
|
222
|
+
set :job_template, nil
|
223
|
+
set :path, '/my/path'
|
224
|
+
set :environment_variable, 'RAKE_ENV'
|
225
|
+
every 2.hours do
|
226
|
+
rake "blahblah", :environment_variable => 'SOME_ENV'
|
227
|
+
end
|
228
|
+
file
|
229
|
+
end
|
230
|
+
|
231
|
+
should "output the rake command using that environment variable" do
|
232
|
+
assert_match two_hours + ' cd /my/path && SOME_ENV=production bundle exec rake blahblah --silent', @output
|
233
|
+
end
|
234
|
+
end
|
182
235
|
|
183
236
|
# script
|
184
237
|
|
@@ -235,4 +288,22 @@ class OutputDefaultDefinedJobsTest < Test::Unit::TestCase
|
|
235
288
|
end
|
236
289
|
end
|
237
290
|
|
238
|
-
|
291
|
+
context "A script command that uses an environment variable" do
|
292
|
+
setup do
|
293
|
+
@output = Whenever.cron \
|
294
|
+
<<-file
|
295
|
+
set :job_template, nil
|
296
|
+
set :environment_variable, 'RAKE_ENV'
|
297
|
+
set :path, '/my/path'
|
298
|
+
every 2.hours do
|
299
|
+
script "blahblah"
|
300
|
+
end
|
301
|
+
file
|
302
|
+
end
|
303
|
+
|
304
|
+
should "output the script command using that environment variable" do
|
305
|
+
assert_match two_hours + ' cd /my/path && RAKE_ENV=production bundle exec script/blahblah', @output
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
@@ -78,7 +78,8 @@ class OutputJobsForRolesTest < Test::Unit::TestCase
|
|
78
78
|
end
|
79
79
|
|
80
80
|
should "output both jobs" do
|
81
|
-
|
81
|
+
assert_match two_hours + " /bin/bash -l -c 'role1_cmd'", @output
|
82
|
+
assert_match "0 * * * * /bin/bash -l -c 'role2_cmd'", @output
|
82
83
|
end
|
83
84
|
end
|
84
85
|
end
|
@@ -304,4 +304,23 @@ class OutputRedirectionTest < Test::Unit::TestCase
|
|
304
304
|
assert_match /^.+ .+ .+ .+ blahblah >> cron.log 2>&1$/, @output
|
305
305
|
end
|
306
306
|
end
|
307
|
+
|
308
|
+
|
309
|
+
context "A command when the standard output is set to a lambda" do
|
310
|
+
setup do
|
311
|
+
@output = Whenever.cron \
|
312
|
+
<<-file
|
313
|
+
set :job_template, nil
|
314
|
+
set :output, lambda { "2>&1 | logger -t whenever_cron" }
|
315
|
+
every 2.hours do
|
316
|
+
command "blahblah"
|
317
|
+
end
|
318
|
+
file
|
319
|
+
end
|
320
|
+
|
321
|
+
should "output the command by result of the lambda evaluated" do
|
322
|
+
assert_match /^.+ .+ .+ .+ blahblah 2>&1 | logger -t whenever_cron$/, @output
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
307
326
|
end
|
@@ -78,6 +78,22 @@ class CapistranoSupportTest < Test::Unit::TestCase
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
context "#whenever_prepare_for_rollback" do
|
82
|
+
should "set path to previous_release if there is a previous release" do
|
83
|
+
args = {}
|
84
|
+
@capistrano.stubs(:fetch).with(:previous_release).returns("/some/path/20121221010000")
|
85
|
+
assert_equal({:path => "/some/path/20121221010000"}, @capistrano.whenever_prepare_for_rollback(args))
|
86
|
+
end
|
87
|
+
|
88
|
+
should "set path to release_path and flags to whenever_clear_flags if there is no previous release" do
|
89
|
+
args = {}
|
90
|
+
@capistrano.stubs(:fetch).with(:previous_release).returns(nil)
|
91
|
+
@capistrano.stubs(:fetch).with(:release_path).returns("/some/path/20121221010000")
|
92
|
+
@capistrano.stubs(:fetch).with(:whenever_clear_flags).returns("--clear-crontab whenever_identifier")
|
93
|
+
assert_equal({:path => "/some/path/20121221010000", :flags => "--clear-crontab whenever_identifier"}, @capistrano.whenever_prepare_for_rollback(args))
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
81
97
|
context "#whenever_run_commands" do
|
82
98
|
should "require :command arg" do
|
83
99
|
assert_raise ArgumentError do
|
data/whenever.gemspec
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Javan Makhmali"]
|
10
10
|
s.email = ["javan@javan.us"]
|
11
|
+
s.license = "MIT"
|
11
12
|
s.homepage = ""
|
12
13
|
s.summary = %q{Cron jobs in ruby.}
|
13
14
|
s.description = %q{Clean ruby syntax for writing and deploying cron jobs.}
|
@@ -17,8 +18,14 @@ Gem::Specification.new do |s|
|
|
17
18
|
s.require_paths = ["lib"]
|
18
19
|
|
19
20
|
s.add_dependency "chronic", ">= 0.6.3"
|
20
|
-
s.add_dependency "activesupport", ">= 2.3.4"
|
21
21
|
|
22
|
+
if RUBY_VERSION < "1.9"
|
23
|
+
s.add_dependency "activesupport", ">= 2.3.4", "< 4.0"
|
24
|
+
else
|
25
|
+
s.add_dependency "activesupport", ">= 2.3.4"
|
26
|
+
end
|
27
|
+
|
28
|
+
s.add_development_dependency "shoulda-matchers", "<= 2.0.0" if RUBY_VERSION < "1.9"
|
22
29
|
s.add_development_dependency "shoulda", ">= 2.1.1"
|
23
30
|
s.add_development_dependency "mocha", ">= 0.9.5"
|
24
31
|
s.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,94 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whenever
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
5
|
-
prerelease:
|
4
|
+
version: 0.8.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Javan Makhmali
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: chronic
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.6.3
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.6.3
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: activesupport
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 2.3.4
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 2.3.4
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: shoulda
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 2.1.1
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 2.1.1
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: mocha
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 0.9.5
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 0.9.5
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rake
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
description: Clean ruby syntax for writing and deploying cron jobs.
|
@@ -133,28 +122,28 @@ files:
|
|
133
122
|
- test/unit/job_test.rb
|
134
123
|
- whenever.gemspec
|
135
124
|
homepage: ''
|
136
|
-
licenses:
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
137
128
|
post_install_message:
|
138
129
|
rdoc_options: []
|
139
130
|
require_paths:
|
140
131
|
- lib
|
141
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
133
|
requirements:
|
144
|
-
- -
|
134
|
+
- - '>='
|
145
135
|
- !ruby/object:Gem::Version
|
146
136
|
version: '0'
|
147
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
138
|
requirements:
|
150
|
-
- -
|
139
|
+
- - '>='
|
151
140
|
- !ruby/object:Gem::Version
|
152
141
|
version: '0'
|
153
142
|
requirements: []
|
154
143
|
rubyforge_project:
|
155
|
-
rubygems_version:
|
144
|
+
rubygems_version: 2.0.2
|
156
145
|
signing_key:
|
157
|
-
specification_version:
|
146
|
+
specification_version: 4
|
158
147
|
summary: Cron jobs in ruby.
|
159
148
|
test_files:
|
160
149
|
- test/functional/command_line_test.rb
|