whenever 0.6.1 → 0.7.0
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/.travis.yml +5 -0
- data/{CHANGELOG.rdoc → CHANGELOG.md} +76 -18
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +165 -0
- data/Rakefile +10 -28
- data/bin/whenever +2 -2
- data/bin/wheneverize +9 -10
- data/lib/whenever/capistrano.rb +48 -17
- data/lib/whenever/command_line.rb +18 -10
- data/lib/whenever/cron.rb +27 -12
- data/lib/whenever/job.rb +0 -2
- data/lib/whenever/job_list.rb +11 -17
- data/lib/whenever/output_redirection.rb +0 -2
- data/lib/whenever/setup.rb +24 -0
- data/lib/whenever/version.rb +2 -2
- data/lib/whenever.rb +27 -7
- data/test/functional/command_line_test.rb +22 -30
- data/test/functional/output_at_test.rb +20 -3
- data/test/functional/output_default_defined_jobs_test.rb +39 -2
- data/test/functional/output_env_test.rb +11 -1
- data/test/test_helper.rb +0 -2
- data/test/unit/cron_test.rb +21 -6
- data/whenever.gemspec +26 -81
- metadata +87 -95
- data/README.rdoc +0 -139
- data/lib/whenever/base.rb +0 -11
- data/lib/whenever/job_types/default.rb +0 -11
metadata
CHANGED
|
@@ -1,107 +1,108 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: whenever
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
- 0
|
|
7
|
-
- 6
|
|
8
|
-
- 1
|
|
9
|
-
version: 0.6.1
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.7.0
|
|
5
|
+
prerelease:
|
|
10
6
|
platform: ruby
|
|
11
|
-
authors:
|
|
7
|
+
authors:
|
|
12
8
|
- Javan Makhmali
|
|
13
9
|
autorequire:
|
|
14
10
|
bindir: bin
|
|
15
11
|
cert_chain: []
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
name: aaronh-chronic
|
|
22
|
-
prerelease: false
|
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
|
12
|
+
date: 2011-09-02 00:00:00.000000000Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: chronic
|
|
16
|
+
requirement: &70222728174660 !ruby/object:Gem::Requirement
|
|
24
17
|
none: false
|
|
25
|
-
requirements:
|
|
26
|
-
- -
|
|
27
|
-
- !ruby/object:Gem::Version
|
|
28
|
-
|
|
29
|
-
- 0
|
|
30
|
-
- 3
|
|
31
|
-
- 9
|
|
32
|
-
version: 0.3.9
|
|
18
|
+
requirements:
|
|
19
|
+
- - ~>
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 0.6.3
|
|
33
22
|
type: :runtime
|
|
34
|
-
version_requirements: *id001
|
|
35
|
-
- !ruby/object:Gem::Dependency
|
|
36
|
-
name: activesupport
|
|
37
23
|
prerelease: false
|
|
38
|
-
|
|
24
|
+
version_requirements: *70222728174660
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: activesupport
|
|
27
|
+
requirement: &70222728174020 !ruby/object:Gem::Requirement
|
|
39
28
|
none: false
|
|
40
|
-
requirements:
|
|
41
|
-
- -
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
segments:
|
|
44
|
-
- 2
|
|
45
|
-
- 3
|
|
46
|
-
- 4
|
|
29
|
+
requirements:
|
|
30
|
+
- - ! '>='
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
47
32
|
version: 2.3.4
|
|
48
33
|
type: :runtime
|
|
49
|
-
version_requirements: *id002
|
|
50
|
-
- !ruby/object:Gem::Dependency
|
|
51
|
-
name: shoulda
|
|
52
34
|
prerelease: false
|
|
53
|
-
|
|
35
|
+
version_requirements: *70222728174020
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: shoulda
|
|
38
|
+
requirement: &70222728173280 !ruby/object:Gem::Requirement
|
|
54
39
|
none: false
|
|
55
|
-
requirements:
|
|
56
|
-
- -
|
|
57
|
-
- !ruby/object:Gem::Version
|
|
58
|
-
segments:
|
|
59
|
-
- 2
|
|
60
|
-
- 1
|
|
61
|
-
- 1
|
|
40
|
+
requirements:
|
|
41
|
+
- - ! '>='
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
62
43
|
version: 2.1.1
|
|
63
44
|
type: :development
|
|
64
|
-
version_requirements: *id003
|
|
65
|
-
- !ruby/object:Gem::Dependency
|
|
66
|
-
name: mocha
|
|
67
45
|
prerelease: false
|
|
68
|
-
|
|
46
|
+
version_requirements: *70222728173280
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: mocha
|
|
49
|
+
requirement: &70222728172720 !ruby/object:Gem::Requirement
|
|
69
50
|
none: false
|
|
70
|
-
requirements:
|
|
71
|
-
- -
|
|
72
|
-
- !ruby/object:Gem::Version
|
|
73
|
-
segments:
|
|
74
|
-
- 0
|
|
75
|
-
- 9
|
|
76
|
-
- 5
|
|
51
|
+
requirements:
|
|
52
|
+
- - ! '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
77
54
|
version: 0.9.5
|
|
78
55
|
type: :development
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
56
|
+
prerelease: false
|
|
57
|
+
version_requirements: *70222728172720
|
|
58
|
+
- !ruby/object:Gem::Dependency
|
|
59
|
+
name: rake
|
|
60
|
+
requirement: &70222728172280 !ruby/object:Gem::Requirement
|
|
61
|
+
none: false
|
|
62
|
+
requirements:
|
|
63
|
+
- - ! '>='
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '0'
|
|
66
|
+
type: :development
|
|
67
|
+
prerelease: false
|
|
68
|
+
version_requirements: *70222728172280
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: i18n
|
|
71
|
+
requirement: &70222728171580 !ruby/object:Gem::Requirement
|
|
72
|
+
none: false
|
|
73
|
+
requirements:
|
|
74
|
+
- - ! '>='
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
type: :development
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: *70222728171580
|
|
80
|
+
description: Clean ruby syntax for writing and deploying cron jobs.
|
|
81
|
+
email:
|
|
82
|
+
- javan@javan.us
|
|
83
|
+
executables:
|
|
83
84
|
- whenever
|
|
84
85
|
- wheneverize
|
|
85
86
|
extensions: []
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- README.rdoc
|
|
89
|
-
files:
|
|
87
|
+
extra_rdoc_files: []
|
|
88
|
+
files:
|
|
90
89
|
- .gitignore
|
|
91
|
-
-
|
|
92
|
-
-
|
|
90
|
+
- .travis.yml
|
|
91
|
+
- CHANGELOG.md
|
|
92
|
+
- Gemfile
|
|
93
|
+
- LICENSE
|
|
94
|
+
- README.md
|
|
93
95
|
- Rakefile
|
|
94
96
|
- bin/whenever
|
|
95
97
|
- bin/wheneverize
|
|
96
98
|
- lib/whenever.rb
|
|
97
|
-
- lib/whenever/base.rb
|
|
98
99
|
- lib/whenever/capistrano.rb
|
|
99
100
|
- lib/whenever/command_line.rb
|
|
100
101
|
- lib/whenever/cron.rb
|
|
101
102
|
- lib/whenever/job.rb
|
|
102
103
|
- lib/whenever/job_list.rb
|
|
103
|
-
- lib/whenever/job_types/default.rb
|
|
104
104
|
- lib/whenever/output_redirection.rb
|
|
105
|
+
- lib/whenever/setup.rb
|
|
105
106
|
- lib/whenever/version.rb
|
|
106
107
|
- test/functional/command_line_test.rb
|
|
107
108
|
- test/functional/output_at_test.rb
|
|
@@ -113,45 +114,36 @@ files:
|
|
|
113
114
|
- test/unit/cron_test.rb
|
|
114
115
|
- test/unit/job_test.rb
|
|
115
116
|
- whenever.gemspec
|
|
116
|
-
|
|
117
|
-
homepage: http://github.com/javan/whenever
|
|
117
|
+
homepage: ''
|
|
118
118
|
licenses: []
|
|
119
|
-
|
|
120
119
|
post_install_message:
|
|
121
|
-
rdoc_options:
|
|
122
|
-
|
|
123
|
-
require_paths:
|
|
120
|
+
rdoc_options: []
|
|
121
|
+
require_paths:
|
|
124
122
|
- lib
|
|
125
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
124
|
none: false
|
|
127
|
-
requirements:
|
|
128
|
-
- -
|
|
129
|
-
- !ruby/object:Gem::Version
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
version: "0"
|
|
133
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
|
+
requirements:
|
|
126
|
+
- - ! '>='
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: '0'
|
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
130
|
none: false
|
|
135
|
-
requirements:
|
|
136
|
-
- -
|
|
137
|
-
- !ruby/object:Gem::Version
|
|
138
|
-
|
|
139
|
-
- 0
|
|
140
|
-
version: "0"
|
|
131
|
+
requirements:
|
|
132
|
+
- - ! '>='
|
|
133
|
+
- !ruby/object:Gem::Version
|
|
134
|
+
version: '0'
|
|
141
135
|
requirements: []
|
|
142
|
-
|
|
143
136
|
rubyforge_project:
|
|
144
|
-
rubygems_version: 1.
|
|
137
|
+
rubygems_version: 1.8.6
|
|
145
138
|
signing_key:
|
|
146
139
|
specification_version: 3
|
|
147
|
-
summary:
|
|
148
|
-
test_files:
|
|
140
|
+
summary: Cron jobs in ruby.
|
|
141
|
+
test_files:
|
|
149
142
|
- test/functional/command_line_test.rb
|
|
150
143
|
- test/functional/output_at_test.rb
|
|
151
144
|
- test/functional/output_default_defined_jobs_test.rb
|
|
152
145
|
- test/functional/output_defined_job_test.rb
|
|
153
146
|
- test/functional/output_env_test.rb
|
|
154
147
|
- test/functional/output_redirection_test.rb
|
|
155
|
-
- test/test_helper.rb
|
|
156
148
|
- test/unit/cron_test.rb
|
|
157
149
|
- test/unit/job_test.rb
|
data/README.rdoc
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
== Introduction
|
|
2
|
-
|
|
3
|
-
Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs.
|
|
4
|
-
|
|
5
|
-
== Installation
|
|
6
|
-
|
|
7
|
-
$ gem install whenever
|
|
8
|
-
|
|
9
|
-
Or with Bundler in your Gemfile.
|
|
10
|
-
|
|
11
|
-
gem 'whenever', :require => false
|
|
12
|
-
|
|
13
|
-
== Getting started
|
|
14
|
-
|
|
15
|
-
$ cd /my/rails/app
|
|
16
|
-
$ wheneverize .
|
|
17
|
-
|
|
18
|
-
This will create an initial "config/schedule.rb" file you.
|
|
19
|
-
|
|
20
|
-
== Example schedule.rb file
|
|
21
|
-
|
|
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
|
-
|
|
28
|
-
every 1.day, :at => '4:30 am' do
|
|
29
|
-
runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot
|
|
33
|
-
runner "SomeModel.ladeeda"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
every :sunday, :at => '12pm' do # Use any day of the week or :weekend, :weekday
|
|
37
|
-
runner "Task.do_something_great"
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
More examples on the wiki: http://wiki.github.com/javan/whenever/instructions-and-examples
|
|
41
|
-
|
|
42
|
-
== Define your own job types
|
|
43
|
-
|
|
44
|
-
Whenever ships with three pre-defined job types: command, runner, and rake. You can define your own with `job_type`.
|
|
45
|
-
|
|
46
|
-
For example:
|
|
47
|
-
|
|
48
|
-
job_type :awesome, '/usr/local/bin/awesome :task :fun_level'
|
|
49
|
-
|
|
50
|
-
every 2.hours do
|
|
51
|
-
awesome "party", :fun_level => "extreme"
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
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
|
-
|
|
56
|
-
The default job types that ship with Whenever are defined like so:
|
|
57
|
-
|
|
58
|
-
job_type :command, ":task :output"
|
|
59
|
-
job_type :rake, "cd :path && RAILS_ENV=:environment rake :task :output"
|
|
60
|
-
job_type :runner, "cd :path && script/runner -e :environment ':task' :output"
|
|
61
|
-
|
|
62
|
-
If a script/rails file is detected (like in a Rails 3 app), runner will be defined to fit:
|
|
63
|
-
|
|
64
|
-
job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output"
|
|
65
|
-
|
|
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-(logging-your-cron-jobs)
|
|
67
|
-
|
|
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
|
|
69
|
-
|
|
70
|
-
You can change this by setting your own job_template.
|
|
71
|
-
|
|
72
|
-
set :job_template, "bash -l -c ':job'"
|
|
73
|
-
|
|
74
|
-
Or set the job_template to nil to have your jobs execute normally.
|
|
75
|
-
|
|
76
|
-
set :job_template, nil
|
|
77
|
-
|
|
78
|
-
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
|
-
|
|
80
|
-
== Capistrano integration
|
|
81
|
-
|
|
82
|
-
Use the built-in Capistrano recipe for easy crontab updates with deploys.
|
|
83
|
-
|
|
84
|
-
In your "config/deploy.rb" file:
|
|
85
|
-
|
|
86
|
-
require "whenever/capistrano"
|
|
87
|
-
|
|
88
|
-
Take a look at the recipe for options you can set. http://github.com/javan/whenever/blob/master/lib/whenever/capistrano.rb
|
|
89
|
-
For example, if you're using bundler do this:
|
|
90
|
-
|
|
91
|
-
set :whenever_command, "bundle exec whenever"
|
|
92
|
-
require "whenever/capistrano"
|
|
93
|
-
|
|
94
|
-
== The `whenever` command
|
|
95
|
-
|
|
96
|
-
$ cd /my/rails/app
|
|
97
|
-
$ whenever
|
|
98
|
-
|
|
99
|
-
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
|
-
|
|
101
|
-
== Credit
|
|
102
|
-
|
|
103
|
-
Whenever was created for use at Inkling (http://inklingmarkets.com) where I work. Their take on it: http://blog.inklingmarkets.com/2009/02/whenever-easy-way-to-do-cron-jobs-from.html
|
|
104
|
-
|
|
105
|
-
While building Whenever, I learned a lot by digging through the source code of Capistrano - http://github.com/jamis/capistrano
|
|
106
|
-
|
|
107
|
-
== Discussion / Feedback / Issues / Bugs
|
|
108
|
-
|
|
109
|
-
For general discussion and questions, please use the google group: http://groups.google.com/group/whenever-gem
|
|
110
|
-
|
|
111
|
-
If you've found a genuine bug or issue, please use the Issues section on github: http://github.com/javan/whenever/issues
|
|
112
|
-
|
|
113
|
-
Ryan Bates created a great Railscast about Whenever: http://railscasts.com/episodes/164-cron-in-ruby
|
|
114
|
-
It's a little bit dated now, but remains a good introduction.
|
|
115
|
-
|
|
116
|
-
== License
|
|
117
|
-
|
|
118
|
-
Copyright (c) 2009+ Javan Makhmali
|
|
119
|
-
|
|
120
|
-
Permission is hereby granted, free of charge, to any person
|
|
121
|
-
obtaining a copy of this software and associated documentation
|
|
122
|
-
files (the "Software"), to deal in the Software without
|
|
123
|
-
restriction, including without limitation the rights to use,
|
|
124
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
125
|
-
copies of the Software, and to permit persons to whom the
|
|
126
|
-
Software is furnished to do so, subject to the following
|
|
127
|
-
conditions:
|
|
128
|
-
|
|
129
|
-
The above copyright notice and this permission notice shall be
|
|
130
|
-
included in all copies or substantial portions of the Software.
|
|
131
|
-
|
|
132
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
133
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
134
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
135
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
136
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
137
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
138
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
139
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/whenever/base.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production
|
|
2
|
-
set :job_template, "/bin/bash -l -c ':job'"
|
|
3
|
-
|
|
4
|
-
job_type :command, ":task :output"
|
|
5
|
-
job_type :rake, "cd :path && RAILS_ENV=:environment rake :task --silent :output"
|
|
6
|
-
|
|
7
|
-
if File.exists?(File.join(Whenever.path, 'script', 'rails'))
|
|
8
|
-
job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output"
|
|
9
|
-
else
|
|
10
|
-
job_type :runner, "cd :path && script/runner -e :environment ':task' :output"
|
|
11
|
-
end
|