whenever 0.6.1 → 0.6.8
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.
- data/.gitignore +1 -0
- data/{CHANGELOG.rdoc → CHANGELOG.md} +59 -18
- data/Gemfile +4 -0
- data/{README.rdoc → README.md} +64 -53
- data/Rakefile +6 -30
- data/bin/whenever +0 -0
- data/bin/wheneverize +0 -0
- data/lib/whenever/capistrano.rb +2 -1
- data/lib/whenever/command_line.rb +18 -8
- data/lib/whenever/cron.rb +27 -11
- data/lib/whenever/job_list.rb +3 -6
- data/lib/whenever/{job_types/default.rb → setup.rb} +8 -1
- data/lib/whenever/version.rb +2 -2
- data/lib/whenever.rb +14 -2
- data/test/functional/command_line_test.rb +22 -30
- data/test/functional/output_at_test.rb +18 -1
- data/test/functional/output_default_defined_jobs_test.rb +19 -0
- data/test/functional/output_env_test.rb +11 -1
- data/test/unit/cron_test.rb +21 -6
- data/whenever.gemspec +17 -81
- metadata +25 -18
- data/lib/whenever/base.rb +0 -11
data/.gitignore
CHANGED
|
@@ -1,4 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
### 0.6.8 / May 24th, 2011
|
|
2
|
+
|
|
3
|
+
* Convert most shortcuts to seconds. every :day -> every 1.day. #129 [Javan Makhmali]
|
|
4
|
+
|
|
5
|
+
* Allow commas in raw cron syntax. #130 [Marco Bergantin, Javan Makhmali]
|
|
6
|
+
|
|
7
|
+
* Output no update message as comments. #135 [Javan Makhmali]
|
|
8
|
+
|
|
9
|
+
* require 'thread' to support Rubygems >= 1.6.0. #132 [Javan Makhmali]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### 0.6.7 / March 23rd, 2011
|
|
13
|
+
|
|
14
|
+
* Fix issue with comment block being corrupted during subsequent insertion of duplicate entries to the crontab. #123 [Jeremy (@lingmann)]
|
|
15
|
+
|
|
16
|
+
* Removed -i from default job template. #118 [Javan Makhmali]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### 0.6.6 / March 8th, 2011
|
|
20
|
+
|
|
21
|
+
* Fix unclosed identifier bug. #119 [Javan Makhmali]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### 0.6.5 / March 8th, 2011
|
|
25
|
+
|
|
26
|
+
* Preserve whitespace at the end of crontab file. #95 [Rich Meyers]
|
|
27
|
+
|
|
28
|
+
* Setting nil or blank environment variables now properly formats output. [T.J. VanSlyke]
|
|
29
|
+
|
|
30
|
+
* Allow raw cron sytax, added -i to bash job template, general cleanup. [Javan Makhmali]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### 0.6.2 / October 26th, 2010
|
|
34
|
+
|
|
35
|
+
* --clear-crontab option completely removes entries. #63 [Javan Makhmali]
|
|
36
|
+
|
|
37
|
+
* Set default :environment and :path earlier in the new setup.rb (formerly job_types/default.rb). [Javan Makhmali]
|
|
38
|
+
|
|
39
|
+
* Converted README and CHANGELOG to markdown. [Javan Makhmali]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### 0.6.1 / October 20th, 2010
|
|
2
43
|
|
|
3
44
|
* Detect script/rails file and change runner to Rails 3 style if found. [Javan Makhmali]
|
|
4
45
|
|
|
@@ -7,14 +48,14 @@
|
|
|
7
48
|
* Added a built-in Capistrano recipe. [Javan Makhmali]
|
|
8
49
|
|
|
9
50
|
|
|
10
|
-
|
|
51
|
+
### 0.5.3 / September 24th, 2010
|
|
11
52
|
|
|
12
53
|
* Better regexes for replacing Whenever blocks in the crontab. #45 [Javan Makhmali]
|
|
13
54
|
|
|
14
55
|
* Preserving backslashes when updating existing crontab. #82 [Javan Makhmali]
|
|
15
56
|
|
|
16
57
|
|
|
17
|
-
|
|
58
|
+
### 0.5.2 / September 15th, 2010
|
|
18
59
|
|
|
19
60
|
* Quotes automatically escaped in jobs. [Jay Adkisson]
|
|
20
61
|
|
|
@@ -25,7 +66,7 @@
|
|
|
25
66
|
* Lots of internal reorganizing; tests broken into unit and functional. [Javan Makhmali]
|
|
26
67
|
|
|
27
68
|
|
|
28
|
-
|
|
69
|
+
### 0.5.0 / June 28th, 2010
|
|
29
70
|
|
|
30
71
|
* New job_type API for writing custom jobs. Internals use this to define command, runner, and rake. [Javan Makhmali - inspired by idlefingers (Damien)]
|
|
31
72
|
|
|
@@ -34,7 +75,7 @@
|
|
|
34
75
|
* --clear option to remove crontab entries for a specific [identifier]. [mraidel (Michael Raidel)]
|
|
35
76
|
|
|
36
77
|
|
|
37
|
-
|
|
78
|
+
### 0.4.2 / April 26th, 2010
|
|
38
79
|
|
|
39
80
|
* runners now cd into the app's directory and then execute. [Michael Guterl]
|
|
40
81
|
|
|
@@ -45,49 +86,49 @@
|
|
|
45
86
|
* bugfix: comparison Time with 0 failed. #32 [Dan Hixon]
|
|
46
87
|
|
|
47
88
|
|
|
48
|
-
|
|
89
|
+
### 0.4.1 / November 30th, 2009
|
|
49
90
|
|
|
50
91
|
* exit(0) instead of just exit to make JRuby happy. [Elan Meng]
|
|
51
92
|
|
|
52
93
|
* Fixed activesupport deprecation warning by requiring active_support. #37 [Andrew Nesbitt]
|
|
53
94
|
|
|
54
95
|
|
|
55
|
-
|
|
96
|
+
### 0.4.0 / October 20th, 2009
|
|
56
97
|
|
|
57
98
|
* New output option replaces the old cron_log option for output redirection and is much more flexible. #31 [Peer Allan]
|
|
58
99
|
|
|
59
100
|
* Reorganized the lib files (http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices) and switched to Jeweler from Echoe.
|
|
60
101
|
|
|
61
102
|
|
|
62
|
-
|
|
103
|
+
### 0.3.7 / September 4th, 2009
|
|
63
104
|
|
|
64
105
|
* No longer tries (and fails) to combine @shortcut jobs. #20 [Javan Makhmali]
|
|
65
106
|
|
|
66
107
|
|
|
67
|
-
|
|
108
|
+
### 0.3.6 / June 15th, 2009
|
|
68
109
|
|
|
69
110
|
* Setting a PATH in the crontab automatically based on the user's PATH. [Javan Makhmali]
|
|
70
111
|
|
|
71
112
|
|
|
72
|
-
|
|
113
|
+
### 0.3.5 / June 13th, 2009
|
|
73
114
|
|
|
74
115
|
* Added ability to accept lists of every's and at's and intelligently group them. (ex: every 'monday, wednesday', :at => ['3pm', '6am']). [Sam Ruby]
|
|
75
116
|
|
|
76
117
|
* Fixed issue with new lines. #18 [Javan Makhmali]
|
|
77
118
|
|
|
78
|
-
|
|
119
|
+
### 0.3.1 / June 25th, 2009
|
|
79
120
|
|
|
80
121
|
* Removed activesupport gem dependency. #1 [Javan Makhmali]
|
|
81
122
|
|
|
82
123
|
* Switched to numeric days of the week for Solaris support (and probably others). #8 [Roger Ertesvåg]
|
|
83
124
|
|
|
84
125
|
|
|
85
|
-
|
|
126
|
+
### 0.3.0 / June 2nd, 2009
|
|
86
127
|
|
|
87
128
|
* Added ability to set variables on the fly from the command line (ex: whenever --set environment=staging). [Javan Makhmali]
|
|
88
129
|
|
|
89
130
|
|
|
90
|
-
|
|
131
|
+
### 0.2.2 / April 30th, 2009
|
|
91
132
|
|
|
92
133
|
* Days of week jobs can now accept an :at directive (ex: every :monday, :at => '5pm'). [David Eisinger]
|
|
93
134
|
|
|
@@ -96,22 +137,22 @@
|
|
|
96
137
|
* Raising an exception if someone tries to specify an :at with a cron shortcut (:day, :reboot, etc) so there are no false hopes. [Javan Makhmali]
|
|
97
138
|
|
|
98
139
|
|
|
99
|
-
|
|
140
|
+
### 0.1.7 / March 5th, 2009
|
|
100
141
|
|
|
101
142
|
* Added ability to update the crontab file non-destuctively instead of only overwriting it. [Javan Makhmali -- Inspired by code submitted individually from: Tien Dung (tiendung), Tom Lea (cwninja), Kyle Maxwell (fizx), and Andrew Timberlake (andrewtimberlake) on github]
|
|
102
143
|
|
|
103
144
|
|
|
104
|
-
|
|
145
|
+
### 0.1.5 / February 19th, 2009
|
|
105
146
|
|
|
106
147
|
* Fixed load path so Whenever's files don't conflict with anything in Rails. Thanks Ryan Koopmans. [Javan Makhmali]
|
|
107
148
|
|
|
108
149
|
|
|
109
|
-
|
|
150
|
+
### 0.1.4 / February 17th, 2009
|
|
110
151
|
|
|
111
152
|
* Added --load-file and --user opts to whenever binary. [Javan Makhmali]
|
|
112
153
|
|
|
113
154
|
|
|
114
|
-
|
|
155
|
+
### 0.1.3 / February 16th, 2009
|
|
115
156
|
|
|
116
157
|
* Added 'rake' helper for defining scheduled rake tasks. [Javan Makhmali]
|
|
117
158
|
|
|
@@ -124,6 +165,6 @@
|
|
|
124
165
|
* Requiring specific gem versions: Chronic >=0.2.3 and activesupport >= 1.3.0 [Javan Makhmali]
|
|
125
166
|
|
|
126
167
|
|
|
127
|
-
|
|
168
|
+
### 0.1.0 / February 15th, 2009
|
|
128
169
|
|
|
129
170
|
* Initial release [Javan Makhmali]
|
data/Gemfile
ADDED
data/{README.rdoc → README.md}
RENAMED
|
@@ -1,119 +1,130 @@
|
|
|
1
|
-
|
|
1
|
+
### Introduction
|
|
2
2
|
|
|
3
3
|
Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Installation
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
$ gem install whenever
|
|
8
8
|
|
|
9
9
|
Or with Bundler in your Gemfile.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
gem 'whenever', :require => false
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### Getting started
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
$ cd /my/rails/app
|
|
16
|
+
$ wheneverize .
|
|
17
17
|
|
|
18
18
|
This will create an initial "config/schedule.rb" file you.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
### Example schedule.rb file
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
every 3.hours do
|
|
23
|
+
runner "MyModel.some_process"
|
|
24
|
+
rake "my:rake:task"
|
|
25
|
+
command "/usr/bin/my_great_command"
|
|
26
|
+
end
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
every 1.day, :at => '4:30 am' do
|
|
29
|
+
runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
|
|
30
|
+
end
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot
|
|
33
|
+
runner "SomeModel.ladeeda"
|
|
34
|
+
end
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
every :sunday, :at => '12pm' do # Use any day of the week or :weekend, :weekday
|
|
37
|
+
runner "Task.do_something_great"
|
|
38
|
+
end
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
every '0 0 27-31 * *' do
|
|
41
|
+
command "echo 'you can use raw cron sytax too'"
|
|
42
|
+
end
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
More examples on the wiki: <http://wiki.github.com/javan/whenever/instructions-and-examples>
|
|
45
|
+
|
|
46
|
+
### Define your own job types
|
|
43
47
|
|
|
44
48
|
Whenever ships with three pre-defined job types: command, runner, and rake. You can define your own with `job_type`.
|
|
45
49
|
|
|
46
50
|
For example:
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
job_type :awesome, '/usr/local/bin/awesome :task :fun_level'
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
every 2.hours do
|
|
55
|
+
awesome "party", :fun_level => "extreme"
|
|
56
|
+
end
|
|
53
57
|
|
|
54
58
|
Would run `/usr/local/bin/awesome party extreme` every two hours. `:task` is always replaced with the first argument, and any additional `:whatevers` are replaced with the options passed in or by variables that have been defined with `set`.
|
|
55
59
|
|
|
56
60
|
The default job types that ship with Whenever are defined like so:
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
job_type :command, ":task :output"
|
|
63
|
+
job_type :rake, "cd :path && RAILS_ENV=:environment rake :task :output"
|
|
64
|
+
job_type :runner, "cd :path && script/runner -e :environment ':task' :output"
|
|
61
65
|
|
|
62
66
|
If a script/rails file is detected (like in a Rails 3 app), runner will be defined to fit:
|
|
63
67
|
|
|
64
|
-
|
|
68
|
+
job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output"
|
|
65
69
|
|
|
66
|
-
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-
|
|
70
|
+
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>
|
|
67
71
|
|
|
68
|
-
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
|
|
72
|
+
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>
|
|
69
73
|
|
|
70
|
-
You can change this by setting your own job_template
|
|
74
|
+
You can change this by setting your own `:job_template`.
|
|
71
75
|
|
|
72
|
-
|
|
76
|
+
set :job_template, "bash -l -c ':job'"
|
|
73
77
|
|
|
74
78
|
Or set the job_template to nil to have your jobs execute normally.
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
set :job_template, nil
|
|
77
81
|
|
|
78
82
|
And you'll see your schedule.rb converted to cron sytax. Note: running `whenever` with no options does not display your current crontab file, it simply shows you the output of converting your schedule.rb file.
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
### Capistrano integration
|
|
81
85
|
|
|
82
86
|
Use the built-in Capistrano recipe for easy crontab updates with deploys.
|
|
83
87
|
|
|
84
88
|
In your "config/deploy.rb" file:
|
|
85
89
|
|
|
86
|
-
|
|
90
|
+
require "whenever/capistrano"
|
|
87
91
|
|
|
88
|
-
Take a look at the recipe for options you can set. http://github.com/javan/whenever/blob/master/lib/whenever/capistrano.rb
|
|
92
|
+
Take a look at the recipe for options you can set. <http://github.com/javan/whenever/blob/master/lib/whenever/capistrano.rb>
|
|
89
93
|
For example, if you're using bundler do this:
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
set :whenever_command, "bundle exec whenever"
|
|
96
|
+
require "whenever/capistrano"
|
|
97
|
+
|
|
98
|
+
If you are using different environments (such as staging, production), then you may want to do this:
|
|
99
|
+
|
|
100
|
+
set :whenever_environment, defer { stage }
|
|
101
|
+
require "whenever/capistrano"
|
|
102
|
+
|
|
103
|
+
The capistrano variable `:stage` should be the one holding your environment name. This will make the correct `:environment` available in your schedule.rb.
|
|
93
104
|
|
|
94
|
-
|
|
105
|
+
### The `whenever` command
|
|
95
106
|
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
$ cd /my/rails/app
|
|
108
|
+
$ whenever
|
|
98
109
|
|
|
99
110
|
This will simply show you your schedule.rb file converted to cron syntax. It does not read or write your crontab file. Run `whenever --help` for a complete list of options.
|
|
100
111
|
|
|
101
|
-
|
|
112
|
+
### Credit
|
|
102
113
|
|
|
103
|
-
Whenever was created for use at Inkling (http://inklingmarkets.com)
|
|
114
|
+
Whenever was created for use at Inkling (<http://inklingmarkets.com>). Their take on it: <http://blog.inklingmarkets.com/2009/02/whenever-easy-way-to-do-cron-jobs-from.html>
|
|
104
115
|
|
|
105
|
-
|
|
116
|
+
Thanks to all the contributors who have made it even better: <http://github.com/javan/whenever/contributors>
|
|
106
117
|
|
|
107
|
-
|
|
118
|
+
### Discussion / Feedback / Issues / Bugs
|
|
108
119
|
|
|
109
|
-
For general discussion and questions, please use the google group: http://groups.google.com/group/whenever-gem
|
|
120
|
+
For general discussion and questions, please use the google group: <http://groups.google.com/group/whenever-gem>
|
|
110
121
|
|
|
111
|
-
If you've found a genuine bug or issue, please use the Issues section on github: http://github.com/javan/whenever/issues
|
|
122
|
+
If you've found a genuine bug or issue, please use the Issues section on github: <http://github.com/javan/whenever/issues>
|
|
112
123
|
|
|
113
|
-
Ryan Bates created a great Railscast about Whenever: http://railscasts.com/episodes/164-cron-in-ruby
|
|
124
|
+
Ryan Bates created a great Railscast about Whenever: <http://railscasts.com/episodes/164-cron-in-ruby>
|
|
114
125
|
It's a little bit dated now, but remains a good introduction.
|
|
115
126
|
|
|
116
|
-
|
|
127
|
+
### License
|
|
117
128
|
|
|
118
129
|
Copyright (c) 2009+ Javan Makhmali
|
|
119
130
|
|
data/Rakefile
CHANGED
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
require '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require File.expand_path(File.dirname(__FILE__) + "/lib/whenever/version")
|
|
5
|
-
|
|
6
|
-
begin
|
|
7
|
-
require 'jeweler'
|
|
8
|
-
Jeweler::Tasks.new do |gemspec|
|
|
9
|
-
gemspec.name = "whenever"
|
|
10
|
-
gemspec.version = Whenever::VERSION
|
|
11
|
-
gemspec.summary = "Clean ruby syntax for writing and deploying cron jobs."
|
|
12
|
-
gemspec.description = "http://www.allyrics.net/Kid-Cudi/lyrics/Whenever/"
|
|
13
|
-
gemspec.email = "javan@javan.us"
|
|
14
|
-
gemspec.homepage = "http://github.com/javan/whenever"
|
|
15
|
-
gemspec.authors = ["Javan Makhmali"]
|
|
16
|
-
gemspec.add_dependency 'aaronh-chronic', '>= 0.3.9'
|
|
17
|
-
gemspec.add_dependency 'activesupport', '>= 2.3.4'
|
|
18
|
-
gemspec.add_development_dependency 'shoulda', '>= 2.1.1'
|
|
19
|
-
gemspec.add_development_dependency 'mocha', '>= 0.9.5'
|
|
20
|
-
end
|
|
21
|
-
Jeweler::GemcutterTasks.new
|
|
22
|
-
rescue LoadError
|
|
23
|
-
puts "Jeweler not available. Install it with: sudo gem install jeweler -s http://gemcutter.org"
|
|
24
|
-
end
|
|
1
|
+
require 'bundler'
|
|
2
|
+
Bundler::GemHelper.install_tasks
|
|
25
3
|
|
|
26
4
|
require 'rake/testtask'
|
|
27
5
|
Rake::TestTask.new(:test) do |test|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
task :test => :check_dependencies
|
|
6
|
+
test.libs << 'lib' << 'test'
|
|
7
|
+
test.pattern = 'test/{functional,unit}/**/*_test.rb'
|
|
8
|
+
test.verbose = true
|
|
9
|
+
end
|
|
34
10
|
|
|
35
11
|
task :default => :test
|
data/bin/whenever
CHANGED
|
File without changes
|
data/bin/wheneverize
CHANGED
|
File without changes
|
data/lib/whenever/capistrano.rb
CHANGED
|
@@ -3,7 +3,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
|
3
3
|
_cset(:whenever_roles) { :db }
|
|
4
4
|
_cset(:whenever_command) { "whenever" }
|
|
5
5
|
_cset(:whenever_identifier) { application }
|
|
6
|
-
_cset(:
|
|
6
|
+
_cset(:whenever_environment) { "production" }
|
|
7
|
+
_cset(:whenever_update_flags) { "--update-crontab #{whenever_identifier} --set environment=#{whenever_environment}" }
|
|
7
8
|
_cset(:whenever_clear_flags) { "--clear-crontab #{whenever_identifier}" }
|
|
8
9
|
|
|
9
10
|
# Disable cron jobs at the begining of a deploy.
|
|
@@ -30,7 +30,6 @@ module Whenever
|
|
|
30
30
|
exit(1)
|
|
31
31
|
end
|
|
32
32
|
@options[:cut] = @options[:cut].to_i
|
|
33
|
-
|
|
34
33
|
end
|
|
35
34
|
|
|
36
35
|
def run
|
|
@@ -40,6 +39,8 @@ module Whenever
|
|
|
40
39
|
write_crontab(whenever_cron)
|
|
41
40
|
else
|
|
42
41
|
puts Whenever.cron(@options)
|
|
42
|
+
puts "## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated."
|
|
43
|
+
puts "## [message] Run `whenever --help' for more options."
|
|
43
44
|
exit(0)
|
|
44
45
|
end
|
|
45
46
|
end
|
|
@@ -51,7 +52,8 @@ module Whenever
|
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def whenever_cron
|
|
54
|
-
|
|
55
|
+
return '' if @options[:clear]
|
|
56
|
+
@whenever_cron ||= [comment_open, Whenever.cron(@options), comment_close].compact.join("\n") + "\n"
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
def read_crontab
|
|
@@ -87,26 +89,34 @@ module Whenever
|
|
|
87
89
|
|
|
88
90
|
def updated_crontab
|
|
89
91
|
# Check for unopened or unclosed identifier blocks
|
|
90
|
-
if read_crontab =~ Regexp.new("^#{comment_open}
|
|
92
|
+
if read_crontab =~ Regexp.new("^#{comment_open}\s*$") && (read_crontab =~ Regexp.new("^#{comment_close}\s*$")).nil?
|
|
91
93
|
warn "[fail] Unclosed indentifier; Your crontab file contains '#{comment_open}', but no '#{comment_close}'"
|
|
92
94
|
exit(1)
|
|
93
|
-
elsif (read_crontab =~ Regexp.new("^#{comment_open}
|
|
95
|
+
elsif (read_crontab =~ Regexp.new("^#{comment_open}\s*$")).nil? && read_crontab =~ Regexp.new("^#{comment_close}\s*$")
|
|
94
96
|
warn "[fail] Unopened indentifier; Your crontab file contains '#{comment_close}', but no '#{comment_open}'"
|
|
95
97
|
exit(1)
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
# If an existing identier block is found, replace it with the new cron entries
|
|
99
|
-
if read_crontab =~ Regexp.new("^#{comment_open}
|
|
101
|
+
if read_crontab =~ Regexp.new("^#{comment_open}\s*$") && read_crontab =~ Regexp.new("^#{comment_close}\s*$")
|
|
100
102
|
# If the existing crontab file contains backslashes they get lost going through gsub.
|
|
101
103
|
# .gsub('\\', '\\\\\\') preserves them. Go figure.
|
|
102
|
-
read_crontab.gsub(Regexp.new("^#{comment_open}
|
|
104
|
+
read_crontab.gsub(Regexp.new("^#{comment_open}\s*$.+^#{comment_close}\s*$", Regexp::MULTILINE), whenever_cron.chomp.gsub('\\', '\\\\\\'))
|
|
103
105
|
else # Otherwise, append the new cron entries after any existing ones
|
|
104
106
|
[read_crontab, whenever_cron].join("\n\n")
|
|
105
|
-
end
|
|
107
|
+
end.gsub(/\n{3,}/, "\n\n") # More than two newlines becomes just two.
|
|
106
108
|
end
|
|
107
109
|
|
|
108
110
|
def prepare(contents)
|
|
109
|
-
|
|
111
|
+
# Strip n lines from the top of the file as specified by the :cut option.
|
|
112
|
+
# Use split with a -1 limit option to ensure the join is able to rebuild
|
|
113
|
+
# the file with all of the original seperators in-tact.
|
|
114
|
+
stripped_contents = contents.split($/,-1)[@options[:cut]..-1].join($/)
|
|
115
|
+
|
|
116
|
+
# Some cron implementations require all non-comment lines to be newline-
|
|
117
|
+
# terminated. (issue #95) Strip all newlines and replace with the default
|
|
118
|
+
# platform record seperator ($/)
|
|
119
|
+
stripped_contents.gsub!(/\s+$/, $/)
|
|
110
120
|
end
|
|
111
121
|
|
|
112
122
|
def comment_base
|
data/lib/whenever/cron.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module Whenever
|
|
2
2
|
module Output
|
|
3
3
|
class Cron
|
|
4
|
+
REGEX = /^.+ .+ .+ .+ .+.?$/
|
|
4
5
|
|
|
5
6
|
attr_accessor :time, :task
|
|
6
7
|
|
|
@@ -10,9 +11,14 @@ module Whenever
|
|
|
10
11
|
@at = at.is_a?(String) ? (Chronic.parse(at) || 0) : (at || 0)
|
|
11
12
|
end
|
|
12
13
|
|
|
13
|
-
def self.enumerate(item)
|
|
14
|
+
def self.enumerate(item, detect_cron = true)
|
|
14
15
|
if item and item.is_a?(String)
|
|
15
|
-
items =
|
|
16
|
+
items =
|
|
17
|
+
if detect_cron && item =~ REGEX
|
|
18
|
+
[item]
|
|
19
|
+
else
|
|
20
|
+
item.split(',')
|
|
21
|
+
end
|
|
16
22
|
else
|
|
17
23
|
items = item
|
|
18
24
|
items = [items] unless items and items.respond_to?(:each)
|
|
@@ -22,7 +28,7 @@ module Whenever
|
|
|
22
28
|
|
|
23
29
|
def self.output(times, job)
|
|
24
30
|
enumerate(times).each do |time|
|
|
25
|
-
enumerate(job.at).each do |at|
|
|
31
|
+
enumerate(job.at, false).each do |at|
|
|
26
32
|
yield new(time, job.output, at).output
|
|
27
33
|
end
|
|
28
34
|
end
|
|
@@ -34,6 +40,7 @@ module Whenever
|
|
|
34
40
|
|
|
35
41
|
def time_in_cron_syntax
|
|
36
42
|
case @time
|
|
43
|
+
when REGEX then @time # raw cron sytax given
|
|
37
44
|
when Symbol then parse_symbol
|
|
38
45
|
when String then parse_as_string
|
|
39
46
|
else parse_time
|
|
@@ -44,16 +51,25 @@ module Whenever
|
|
|
44
51
|
|
|
45
52
|
def parse_symbol
|
|
46
53
|
shortcut = case @time
|
|
47
|
-
when :reboot
|
|
48
|
-
when :year
|
|
49
|
-
when :
|
|
50
|
-
|
|
51
|
-
when :
|
|
52
|
-
when :
|
|
53
|
-
when :
|
|
54
|
+
when :reboot then '@reboot'
|
|
55
|
+
when :year then 12.months
|
|
56
|
+
when :yearly,
|
|
57
|
+
:annually then '@annually'
|
|
58
|
+
when :day then 1.day
|
|
59
|
+
when :daily then '@daily'
|
|
60
|
+
when :midnight then '@midnight'
|
|
61
|
+
when :month then 1.month
|
|
62
|
+
when :monthly then '@monthly'
|
|
63
|
+
when :week then 1.week
|
|
64
|
+
when :weekly then '@weekly'
|
|
65
|
+
when :hour then 1.hour
|
|
66
|
+
when :hourly then '@hourly'
|
|
54
67
|
end
|
|
55
68
|
|
|
56
|
-
if shortcut
|
|
69
|
+
if shortcut.is_a?(Numeric)
|
|
70
|
+
@time = shortcut
|
|
71
|
+
parse_time
|
|
72
|
+
elsif shortcut
|
|
57
73
|
if @at.is_a?(Time) || (@at.is_a?(Numeric) && @at > 0)
|
|
58
74
|
raise ArgumentError, "You cannot specify an ':at' when using the shortcuts for times."
|
|
59
75
|
else
|
data/lib/whenever/job_list.rb
CHANGED
|
@@ -16,12 +16,9 @@ module Whenever
|
|
|
16
16
|
pre_set(options[:set])
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
Dir["#{File.expand_path(File.dirname(__FILE__))}/job_types/*.rb"].each do |file|
|
|
21
|
-
eval(File.read(file))
|
|
22
|
-
end
|
|
19
|
+
setup = File.read("#{File.expand_path(File.dirname(__FILE__))}/setup.rb")
|
|
23
20
|
|
|
24
|
-
eval(config)
|
|
21
|
+
eval(setup + config)
|
|
25
22
|
end
|
|
26
23
|
|
|
27
24
|
def set(variable, value)
|
|
@@ -91,7 +88,7 @@ module Whenever
|
|
|
91
88
|
|
|
92
89
|
output = []
|
|
93
90
|
@env.each do |key, val|
|
|
94
|
-
output << "#{key}=#{val}\n"
|
|
91
|
+
output << "#{key}=#{val.blank? ? '""' : val}\n"
|
|
95
92
|
end
|
|
96
93
|
output << "\n"
|
|
97
94
|
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
# Environemnt defaults to production
|
|
2
|
+
set :environment, "production"
|
|
3
|
+
# Path defaults to the directory `whenever` was run from
|
|
4
|
+
set :path, Whenever.path
|
|
5
|
+
|
|
6
|
+
# All jobs are wrapped in this template.
|
|
1
7
|
# http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production
|
|
2
8
|
set :job_template, "/bin/bash -l -c ':job'"
|
|
3
9
|
|
|
4
10
|
job_type :command, ":task :output"
|
|
5
11
|
job_type :rake, "cd :path && RAILS_ENV=:environment rake :task --silent :output"
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
# Create a runner job that's appropriate for the Rails version,
|
|
14
|
+
if File.exists?(File.join(path, 'script', 'rails'))
|
|
8
15
|
job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output"
|
|
9
16
|
else
|
|
10
17
|
job_type :runner, "cd :path && script/runner -e :environment ':task' :output"
|
data/lib/whenever/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
module Whenever
|
|
2
|
-
VERSION = '0.6.
|
|
3
|
-
end
|
|
2
|
+
VERSION = '0.6.8'
|
|
3
|
+
end
|
data/lib/whenever.rb
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
require 'chronic'
|
|
2
2
|
require 'active_support/all'
|
|
3
|
+
require 'thread'
|
|
3
4
|
|
|
4
|
-
require 'whenever/base'
|
|
5
5
|
require 'whenever/job_list'
|
|
6
6
|
require 'whenever/job'
|
|
7
7
|
require 'whenever/cron'
|
|
8
8
|
require 'whenever/output_redirection'
|
|
9
9
|
require 'whenever/command_line'
|
|
10
|
-
require 'whenever/version'
|
|
10
|
+
require 'whenever/version'
|
|
11
|
+
|
|
12
|
+
module Whenever
|
|
13
|
+
|
|
14
|
+
def self.cron(options)
|
|
15
|
+
Whenever::JobList.new(options).generate_cron_output
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.path
|
|
19
|
+
Dir.pwd
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
@@ -120,35 +120,18 @@ NEW_CRON
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
should "append the similarly named command" do
|
|
123
|
-
assert_equal @existing + "\n
|
|
123
|
+
assert_equal @existing + "\n" + @new, @command.send(:updated_crontab)
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
126
|
|
|
127
|
-
context "A command line
|
|
127
|
+
context "A command line clear" do
|
|
128
128
|
setup do
|
|
129
129
|
File.expects(:exists?).with('config/schedule.rb').returns(true)
|
|
130
130
|
@command = Whenever::CommandLine.new(:clear => true, :identifier => 'My identifier')
|
|
131
131
|
@task = "#{two_hours} /my/command"
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
-
should "
|
|
135
|
-
existing = '# Existing crontab'
|
|
136
|
-
@command.expects(:read_crontab).at_least_once.returns(existing)
|
|
137
|
-
|
|
138
|
-
new_cron = <<-EXPECTED
|
|
139
|
-
#{existing}
|
|
140
|
-
|
|
141
|
-
# Begin Whenever generated tasks for: My identifier
|
|
142
|
-
# End Whenever generated tasks for: My identifier
|
|
143
|
-
EXPECTED
|
|
144
|
-
|
|
145
|
-
assert_equal new_cron, @command.send(:updated_crontab)
|
|
146
|
-
|
|
147
|
-
@command.expects(:write_crontab).with(new_cron).returns(true)
|
|
148
|
-
assert @command.run
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
should "delete an existing block if the identifier matches" do
|
|
134
|
+
should "clear an existing block if the identifier matches" do
|
|
152
135
|
existing = <<-EXISTING_CRON
|
|
153
136
|
# Something
|
|
154
137
|
|
|
@@ -162,20 +145,17 @@ This shouldn't get replaced
|
|
|
162
145
|
EXISTING_CRON
|
|
163
146
|
|
|
164
147
|
@command.expects(:read_crontab).at_least_once.returns(existing)
|
|
165
|
-
|
|
148
|
+
|
|
166
149
|
new_cron = <<-NEW_CRON
|
|
167
150
|
# Something
|
|
168
151
|
|
|
169
|
-
# Begin Whenever generated tasks for: My identifier
|
|
170
|
-
# End Whenever generated tasks for: My identifier
|
|
171
|
-
|
|
172
152
|
# Begin Whenever generated tasks for: Other identifier
|
|
173
153
|
This shouldn't get replaced
|
|
174
154
|
# End Whenever generated tasks for: Other identifier
|
|
175
155
|
NEW_CRON
|
|
176
|
-
|
|
156
|
+
|
|
177
157
|
assert_equal new_cron, @command.send(:updated_crontab)
|
|
178
|
-
|
|
158
|
+
|
|
179
159
|
@command.expects(:write_crontab).with(new_cron).returns(true)
|
|
180
160
|
assert @command.run
|
|
181
161
|
end
|
|
@@ -301,8 +281,7 @@ My whenever job that was already here
|
|
|
301
281
|
# End Whenever generated tasks for: My identifier
|
|
302
282
|
EXISTING_CRON
|
|
303
283
|
|
|
304
|
-
|
|
305
|
-
assert_equal existing.strip, @command.send(:prepare, existing)
|
|
284
|
+
assert_equal existing, @command.send(:prepare, existing)
|
|
306
285
|
end
|
|
307
286
|
|
|
308
287
|
should "trim off the top lines of the file" do
|
|
@@ -322,8 +301,21 @@ My whenever job that was already here
|
|
|
322
301
|
# End Whenever generated tasks for: My identifier
|
|
323
302
|
NEW_CRON
|
|
324
303
|
|
|
325
|
-
|
|
326
|
-
|
|
304
|
+
assert_equal new_cron, @command.send(:prepare, existing)
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
should "preserve terminating newlines in files" do
|
|
308
|
+
@command = Whenever::CommandLine.new(:update => true, :identifier => 'My identifier')
|
|
309
|
+
existing = <<-EXISTING_CRON
|
|
310
|
+
# Begin Whenever generated tasks for: My identifier
|
|
311
|
+
My whenever job that was already here
|
|
312
|
+
# End Whenever generated tasks for: My identifier
|
|
313
|
+
|
|
314
|
+
# A non-Whenever task
|
|
315
|
+
My non-whenever job that was already here
|
|
316
|
+
EXISTING_CRON
|
|
317
|
+
|
|
318
|
+
assert_equal existing, @command.send(:prepare, existing)
|
|
327
319
|
end
|
|
328
320
|
end
|
|
329
321
|
|
|
@@ -166,7 +166,7 @@ class OutputAtTest < Test::Unit::TestCase
|
|
|
166
166
|
<<-file
|
|
167
167
|
set :job_template, nil
|
|
168
168
|
set :path, '/your/path'
|
|
169
|
-
every :
|
|
169
|
+
every :daily do
|
|
170
170
|
rake "blah:blah"
|
|
171
171
|
runner "runner_1"
|
|
172
172
|
command "command_1"
|
|
@@ -248,4 +248,21 @@ class OutputAtTest < Test::Unit::TestCase
|
|
|
248
248
|
assert_match '27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59 * * * * blahblah', @output
|
|
249
249
|
end
|
|
250
250
|
end
|
|
251
|
+
|
|
252
|
+
context "using raw cron syntax" do
|
|
253
|
+
setup do
|
|
254
|
+
@output = Whenever.cron \
|
|
255
|
+
<<-file
|
|
256
|
+
set :job_template, nil
|
|
257
|
+
every '0 0 27,31 * *' do
|
|
258
|
+
command "blahblah"
|
|
259
|
+
end
|
|
260
|
+
file
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
should "output the command using the same cron syntax" do
|
|
264
|
+
assert_match '0 0 27,31 * * blahblah', @output
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
|
|
251
268
|
end
|
|
@@ -51,6 +51,25 @@ class OutputDefaultDefinedJobsTest < Test::Unit::TestCase
|
|
|
51
51
|
assert_no_match /bash/, @output
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
|
+
|
|
55
|
+
context "A plain command that is conditional on default environent and path" do
|
|
56
|
+
setup do
|
|
57
|
+
Whenever.expects(:path).at_least_once.returns('/what/you/want')
|
|
58
|
+
@output = Whenever.cron \
|
|
59
|
+
<<-file
|
|
60
|
+
set :job_template, nil
|
|
61
|
+
if environment == 'production' && path == '/what/you/want'
|
|
62
|
+
every 2.hours do
|
|
63
|
+
command "blahblah"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
file
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
should "output the command" do
|
|
70
|
+
assert_match /blahblah/, @output
|
|
71
|
+
end
|
|
72
|
+
end
|
|
54
73
|
|
|
55
74
|
# runner
|
|
56
75
|
|
|
@@ -8,6 +8,8 @@ class OutputEnvTest < Test::Unit::TestCase
|
|
|
8
8
|
<<-file
|
|
9
9
|
env :MYVAR, 'blah'
|
|
10
10
|
env 'MAILTO', "someone@example.com"
|
|
11
|
+
env :BLANKVAR, ''
|
|
12
|
+
env :NILVAR, nil
|
|
11
13
|
file
|
|
12
14
|
end
|
|
13
15
|
|
|
@@ -18,6 +20,14 @@ class OutputEnvTest < Test::Unit::TestCase
|
|
|
18
20
|
should "output MAILTO environment variable" do
|
|
19
21
|
assert_match "MAILTO=someone@example.com", @output
|
|
20
22
|
end
|
|
23
|
+
|
|
24
|
+
should "output BLANKVAR environment variable" do
|
|
25
|
+
assert_match "BLANKVAR=\"\"", @output
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
should "output NILVAR environment variable" do
|
|
29
|
+
assert_match "NILVAR=\"\"", @output
|
|
30
|
+
end
|
|
21
31
|
end
|
|
22
32
|
|
|
23
|
-
end
|
|
33
|
+
end
|
data/test/unit/cron_test.rb
CHANGED
|
@@ -174,20 +174,26 @@ class CronTest < Test::Unit::TestCase
|
|
|
174
174
|
context "When parsing time using the cron shortcuts" do
|
|
175
175
|
should "parse a :symbol into the correct shortcut" do
|
|
176
176
|
assert_equal '@reboot', parse_time(:reboot)
|
|
177
|
-
assert_equal '@annually', parse_time(:
|
|
177
|
+
assert_equal '@annually', parse_time(:annually)
|
|
178
178
|
assert_equal '@annually', parse_time(:yearly)
|
|
179
|
-
assert_equal '@daily', parse_time(:day)
|
|
180
179
|
assert_equal '@daily', parse_time(:daily)
|
|
181
180
|
assert_equal '@midnight', parse_time(:midnight)
|
|
182
|
-
assert_equal '@monthly', parse_time(:month)
|
|
183
181
|
assert_equal '@monthly', parse_time(:monthly)
|
|
184
|
-
assert_equal '@
|
|
182
|
+
assert_equal '@weekly', parse_time(:weekly)
|
|
185
183
|
assert_equal '@hourly', parse_time(:hourly)
|
|
186
184
|
end
|
|
187
185
|
|
|
186
|
+
should "convert time-based shortcuts to times" do
|
|
187
|
+
assert_equal '0 0 1 * *', parse_time(:month)
|
|
188
|
+
assert_equal '0 0 * * *', parse_time(:day)
|
|
189
|
+
assert_equal '0 * * * *', parse_time(:hour)
|
|
190
|
+
assert_equal '0 0 1 12 *', parse_time(:year)
|
|
191
|
+
assert_equal '0 0 1,8,15,22 * *', parse_time(:week)
|
|
192
|
+
end
|
|
193
|
+
|
|
188
194
|
should "raise an exception if a valid shortcut is given but also an :at" do
|
|
189
195
|
assert_raises ArgumentError do
|
|
190
|
-
parse_time(:
|
|
196
|
+
parse_time(:hourly, nil, "1:00 am")
|
|
191
197
|
end
|
|
192
198
|
|
|
193
199
|
assert_raises ArgumentError do
|
|
@@ -195,7 +201,16 @@ class CronTest < Test::Unit::TestCase
|
|
|
195
201
|
end
|
|
196
202
|
|
|
197
203
|
assert_raises ArgumentError do
|
|
198
|
-
parse_time(:
|
|
204
|
+
parse_time(:daily, nil, '4:20pm')
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
context "When given raw cron sytax" do
|
|
210
|
+
should "return the same cron sytax" do
|
|
211
|
+
crons = ['0 0 27-31 * *', '* * * * *', '2/3 1,9,22 11-26 1-6 *']
|
|
212
|
+
crons.each do |cron|
|
|
213
|
+
assert_equal cron, parse_time(cron)
|
|
199
214
|
end
|
|
200
215
|
end
|
|
201
216
|
end
|
data/whenever.gemspec
CHANGED
|
@@ -1,86 +1,22 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "whenever/version"
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |s|
|
|
7
|
-
s.name
|
|
8
|
-
s.version
|
|
9
|
-
|
|
10
|
-
s.
|
|
11
|
-
s.
|
|
12
|
-
s.
|
|
13
|
-
s.
|
|
14
|
-
s.
|
|
15
|
-
s.
|
|
16
|
-
s.
|
|
17
|
-
|
|
18
|
-
]
|
|
19
|
-
s.files = [
|
|
20
|
-
".gitignore",
|
|
21
|
-
"CHANGELOG.rdoc",
|
|
22
|
-
"README.rdoc",
|
|
23
|
-
"Rakefile",
|
|
24
|
-
"bin/whenever",
|
|
25
|
-
"bin/wheneverize",
|
|
26
|
-
"lib/whenever.rb",
|
|
27
|
-
"lib/whenever/base.rb",
|
|
28
|
-
"lib/whenever/capistrano.rb",
|
|
29
|
-
"lib/whenever/command_line.rb",
|
|
30
|
-
"lib/whenever/cron.rb",
|
|
31
|
-
"lib/whenever/job.rb",
|
|
32
|
-
"lib/whenever/job_list.rb",
|
|
33
|
-
"lib/whenever/job_types/default.rb",
|
|
34
|
-
"lib/whenever/output_redirection.rb",
|
|
35
|
-
"lib/whenever/version.rb",
|
|
36
|
-
"test/functional/command_line_test.rb",
|
|
37
|
-
"test/functional/output_at_test.rb",
|
|
38
|
-
"test/functional/output_default_defined_jobs_test.rb",
|
|
39
|
-
"test/functional/output_defined_job_test.rb",
|
|
40
|
-
"test/functional/output_env_test.rb",
|
|
41
|
-
"test/functional/output_redirection_test.rb",
|
|
42
|
-
"test/test_helper.rb",
|
|
43
|
-
"test/unit/cron_test.rb",
|
|
44
|
-
"test/unit/job_test.rb",
|
|
45
|
-
"whenever.gemspec"
|
|
46
|
-
]
|
|
47
|
-
s.homepage = %q{http://github.com/javan/whenever}
|
|
48
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
6
|
+
s.name = "whenever"
|
|
7
|
+
s.version = Whenever::VERSION
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = ["Javan Makhmali"]
|
|
10
|
+
s.email = ["javan@javan.us"]
|
|
11
|
+
s.homepage = ""
|
|
12
|
+
s.summary = %q{Cron jobs in ruby.}
|
|
13
|
+
s.description = %q{Clean ruby syntax for writing and deploying cron jobs.}
|
|
14
|
+
s.files = `git ls-files`.split("\n")
|
|
15
|
+
s.test_files = `git ls-files -- test/{functional,unit}/*`.split("\n")
|
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
49
17
|
s.require_paths = ["lib"]
|
|
50
|
-
s.
|
|
51
|
-
s.
|
|
52
|
-
s.
|
|
53
|
-
|
|
54
|
-
"test/functional/output_at_test.rb",
|
|
55
|
-
"test/functional/output_default_defined_jobs_test.rb",
|
|
56
|
-
"test/functional/output_defined_job_test.rb",
|
|
57
|
-
"test/functional/output_env_test.rb",
|
|
58
|
-
"test/functional/output_redirection_test.rb",
|
|
59
|
-
"test/test_helper.rb",
|
|
60
|
-
"test/unit/cron_test.rb",
|
|
61
|
-
"test/unit/job_test.rb"
|
|
62
|
-
]
|
|
63
|
-
|
|
64
|
-
if s.respond_to? :specification_version then
|
|
65
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
66
|
-
s.specification_version = 3
|
|
67
|
-
|
|
68
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
69
|
-
s.add_runtime_dependency(%q<aaronh-chronic>, [">= 0.3.9"])
|
|
70
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.4"])
|
|
71
|
-
s.add_development_dependency(%q<shoulda>, [">= 2.1.1"])
|
|
72
|
-
s.add_development_dependency(%q<mocha>, [">= 0.9.5"])
|
|
73
|
-
else
|
|
74
|
-
s.add_dependency(%q<aaronh-chronic>, [">= 0.3.9"])
|
|
75
|
-
s.add_dependency(%q<activesupport>, [">= 2.3.4"])
|
|
76
|
-
s.add_dependency(%q<shoulda>, [">= 2.1.1"])
|
|
77
|
-
s.add_dependency(%q<mocha>, [">= 0.9.5"])
|
|
78
|
-
end
|
|
79
|
-
else
|
|
80
|
-
s.add_dependency(%q<aaronh-chronic>, [">= 0.3.9"])
|
|
81
|
-
s.add_dependency(%q<activesupport>, [">= 2.3.4"])
|
|
82
|
-
s.add_dependency(%q<shoulda>, [">= 2.1.1"])
|
|
83
|
-
s.add_dependency(%q<mocha>, [">= 0.9.5"])
|
|
84
|
-
end
|
|
18
|
+
s.add_runtime_dependency(%q<aaronh-chronic>, [">= 0.3.9"])
|
|
19
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.4"])
|
|
20
|
+
s.add_development_dependency(%q<shoulda>, [">= 2.1.1"])
|
|
21
|
+
s.add_development_dependency(%q<mocha>, [">= 0.9.5"])
|
|
85
22
|
end
|
|
86
|
-
|
metadata
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: whenever
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
hash: 23
|
|
5
|
+
prerelease:
|
|
5
6
|
segments:
|
|
6
7
|
- 0
|
|
7
8
|
- 6
|
|
8
|
-
-
|
|
9
|
-
version: 0.6.
|
|
9
|
+
- 8
|
|
10
|
+
version: 0.6.8
|
|
10
11
|
platform: ruby
|
|
11
12
|
authors:
|
|
12
13
|
- Javan Makhmali
|
|
@@ -14,7 +15,7 @@ autorequire:
|
|
|
14
15
|
bindir: bin
|
|
15
16
|
cert_chain: []
|
|
16
17
|
|
|
17
|
-
date:
|
|
18
|
+
date: 2011-05-24 00:00:00 -04:00
|
|
18
19
|
default_executable:
|
|
19
20
|
dependencies:
|
|
20
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -25,6 +26,7 @@ dependencies:
|
|
|
25
26
|
requirements:
|
|
26
27
|
- - ">="
|
|
27
28
|
- !ruby/object:Gem::Version
|
|
29
|
+
hash: 1
|
|
28
30
|
segments:
|
|
29
31
|
- 0
|
|
30
32
|
- 3
|
|
@@ -40,6 +42,7 @@ dependencies:
|
|
|
40
42
|
requirements:
|
|
41
43
|
- - ">="
|
|
42
44
|
- !ruby/object:Gem::Version
|
|
45
|
+
hash: 11
|
|
43
46
|
segments:
|
|
44
47
|
- 2
|
|
45
48
|
- 3
|
|
@@ -55,6 +58,7 @@ dependencies:
|
|
|
55
58
|
requirements:
|
|
56
59
|
- - ">="
|
|
57
60
|
- !ruby/object:Gem::Version
|
|
61
|
+
hash: 9
|
|
58
62
|
segments:
|
|
59
63
|
- 2
|
|
60
64
|
- 1
|
|
@@ -70,6 +74,7 @@ dependencies:
|
|
|
70
74
|
requirements:
|
|
71
75
|
- - ">="
|
|
72
76
|
- !ruby/object:Gem::Version
|
|
77
|
+
hash: 49
|
|
73
78
|
segments:
|
|
74
79
|
- 0
|
|
75
80
|
- 9
|
|
@@ -77,31 +82,32 @@ dependencies:
|
|
|
77
82
|
version: 0.9.5
|
|
78
83
|
type: :development
|
|
79
84
|
version_requirements: *id004
|
|
80
|
-
description:
|
|
81
|
-
email:
|
|
85
|
+
description: Clean ruby syntax for writing and deploying cron jobs.
|
|
86
|
+
email:
|
|
87
|
+
- javan@javan.us
|
|
82
88
|
executables:
|
|
83
89
|
- whenever
|
|
84
90
|
- wheneverize
|
|
85
91
|
extensions: []
|
|
86
92
|
|
|
87
|
-
extra_rdoc_files:
|
|
88
|
-
|
|
93
|
+
extra_rdoc_files: []
|
|
94
|
+
|
|
89
95
|
files:
|
|
90
96
|
- .gitignore
|
|
91
|
-
- CHANGELOG.
|
|
92
|
-
-
|
|
97
|
+
- CHANGELOG.md
|
|
98
|
+
- Gemfile
|
|
99
|
+
- README.md
|
|
93
100
|
- Rakefile
|
|
94
101
|
- bin/whenever
|
|
95
102
|
- bin/wheneverize
|
|
96
103
|
- lib/whenever.rb
|
|
97
|
-
- lib/whenever/base.rb
|
|
98
104
|
- lib/whenever/capistrano.rb
|
|
99
105
|
- lib/whenever/command_line.rb
|
|
100
106
|
- lib/whenever/cron.rb
|
|
101
107
|
- lib/whenever/job.rb
|
|
102
108
|
- lib/whenever/job_list.rb
|
|
103
|
-
- lib/whenever/job_types/default.rb
|
|
104
109
|
- lib/whenever/output_redirection.rb
|
|
110
|
+
- lib/whenever/setup.rb
|
|
105
111
|
- lib/whenever/version.rb
|
|
106
112
|
- test/functional/command_line_test.rb
|
|
107
113
|
- test/functional/output_at_test.rb
|
|
@@ -114,12 +120,12 @@ files:
|
|
|
114
120
|
- test/unit/job_test.rb
|
|
115
121
|
- whenever.gemspec
|
|
116
122
|
has_rdoc: true
|
|
117
|
-
homepage:
|
|
123
|
+
homepage: ""
|
|
118
124
|
licenses: []
|
|
119
125
|
|
|
120
126
|
post_install_message:
|
|
121
|
-
rdoc_options:
|
|
122
|
-
|
|
127
|
+
rdoc_options: []
|
|
128
|
+
|
|
123
129
|
require_paths:
|
|
124
130
|
- lib
|
|
125
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -127,6 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
127
133
|
requirements:
|
|
128
134
|
- - ">="
|
|
129
135
|
- !ruby/object:Gem::Version
|
|
136
|
+
hash: 3
|
|
130
137
|
segments:
|
|
131
138
|
- 0
|
|
132
139
|
version: "0"
|
|
@@ -135,16 +142,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
135
142
|
requirements:
|
|
136
143
|
- - ">="
|
|
137
144
|
- !ruby/object:Gem::Version
|
|
145
|
+
hash: 3
|
|
138
146
|
segments:
|
|
139
147
|
- 0
|
|
140
148
|
version: "0"
|
|
141
149
|
requirements: []
|
|
142
150
|
|
|
143
151
|
rubyforge_project:
|
|
144
|
-
rubygems_version: 1.
|
|
152
|
+
rubygems_version: 1.4.2
|
|
145
153
|
signing_key:
|
|
146
154
|
specification_version: 3
|
|
147
|
-
summary:
|
|
155
|
+
summary: Cron jobs in ruby.
|
|
148
156
|
test_files:
|
|
149
157
|
- test/functional/command_line_test.rb
|
|
150
158
|
- test/functional/output_at_test.rb
|
|
@@ -152,6 +160,5 @@ test_files:
|
|
|
152
160
|
- test/functional/output_defined_job_test.rb
|
|
153
161
|
- test/functional/output_env_test.rb
|
|
154
162
|
- test/functional/output_redirection_test.rb
|
|
155
|
-
- test/test_helper.rb
|
|
156
163
|
- test/unit/cron_test.rb
|
|
157
164
|
- test/unit/job_test.rb
|