javan-whenever 0.3.6 → 0.3.7
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/CHANGELOG.rdoc +5 -0
- data/Manifest +1 -0
- data/lib/job_list.rb +12 -5
- data/lib/version.rb +1 -1
- data/test/output_at_test.rb +41 -0
- data/whenever.gemspec +4 -5
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/Manifest
CHANGED
data/lib/job_list.rb
CHANGED
@@ -112,7 +112,7 @@ module Whenever
|
|
112
112
|
# them into one that runs on the 2nd minute at the 3rd and 4th hour.
|
113
113
|
#
|
114
114
|
def combine(entries)
|
115
|
-
entries.map! { |entry| entry.split(/ +/,6
|
115
|
+
entries.map! { |entry| entry.split(/ +/, 6) }
|
116
116
|
0.upto(4) do |f|
|
117
117
|
(entries.length-1).downto(1) do |i|
|
118
118
|
next if entries[i][f] == '*'
|
@@ -134,18 +134,25 @@ module Whenever
|
|
134
134
|
def cron_jobs
|
135
135
|
return if @jobs.empty?
|
136
136
|
|
137
|
-
|
137
|
+
shortcut_jobs = []
|
138
|
+
regular_jobs = []
|
139
|
+
|
138
140
|
@jobs.each do |time, jobs|
|
139
141
|
jobs.each do |job|
|
140
142
|
Whenever::Output::Cron.output(time, job) do |cron|
|
141
143
|
cron << " >> #{job.cron_log} 2>&1" if job.cron_log
|
142
144
|
cron << "\n\n"
|
143
|
-
|
145
|
+
|
146
|
+
if cron.starts_with?("@")
|
147
|
+
shortcut_jobs << cron
|
148
|
+
else
|
149
|
+
regular_jobs << cron
|
150
|
+
end
|
144
151
|
end
|
145
152
|
end
|
146
153
|
end
|
147
|
-
|
148
|
-
combine(
|
154
|
+
|
155
|
+
shortcut_jobs.join + combine(regular_jobs).join
|
149
156
|
end
|
150
157
|
|
151
158
|
end
|
data/lib/version.rb
CHANGED
data/test/output_at_test.rb
CHANGED
@@ -134,4 +134,45 @@ class OutputAtTest < Test::Unit::TestCase
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
+
context "Multiple commands output every :reboot" do
|
138
|
+
setup do
|
139
|
+
@output = Whenever.cron \
|
140
|
+
<<-file
|
141
|
+
every :reboot do
|
142
|
+
command "command_1"
|
143
|
+
command "command_2"
|
144
|
+
end
|
145
|
+
file
|
146
|
+
end
|
147
|
+
|
148
|
+
should "output both commands @reboot" do
|
149
|
+
assert_match "@reboot command_1", @output
|
150
|
+
assert_match "@reboot command_2", @output
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context "Many different job types output every :day" do
|
155
|
+
setup do
|
156
|
+
@output = Whenever.cron \
|
157
|
+
<<-file
|
158
|
+
set :path, '/your/path'
|
159
|
+
every :day do
|
160
|
+
rake "blah:blah"
|
161
|
+
runner "runner_1"
|
162
|
+
command "command_1"
|
163
|
+
runner "runner_2"
|
164
|
+
command "command_2"
|
165
|
+
end
|
166
|
+
file
|
167
|
+
end
|
168
|
+
|
169
|
+
should "output all of the commands @daily" do
|
170
|
+
assert_match '@daily cd /your/path && RAILS_ENV=production /usr/bin/env rake blah:blah', @output
|
171
|
+
assert_match '@daily /your/path/script/runner -e production "runner_1"', @output
|
172
|
+
assert_match '@daily command_1', @output
|
173
|
+
assert_match '@daily /your/path/script/runner -e production "runner_2"', @output
|
174
|
+
assert_match '@daily command_2', @output
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
137
178
|
end
|
data/whenever.gemspec
CHANGED
@@ -2,28 +2,27 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{whenever}
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.7"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Javan Makhmali"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-09-04}
|
10
10
|
s.description = %q{Provides clean ruby syntax for defining messy cron jobs and running them Whenever.}
|
11
11
|
s.email = %q{javan@javan.us}
|
12
12
|
s.executables = ["whenever", "wheneverize"]
|
13
13
|
s.extra_rdoc_files = ["bin/whenever", "bin/wheneverize", "CHANGELOG.rdoc", "lib/base.rb", "lib/command_line.rb", "lib/job_list.rb", "lib/job_types/default.rb", "lib/job_types/rake_task.rb", "lib/job_types/runner.rb", "lib/outputs/cron.rb", "lib/version.rb", "lib/whenever.rb", "README.rdoc"]
|
14
14
|
s.files = ["bin/whenever", "bin/wheneverize", "CHANGELOG.rdoc", "lib/base.rb", "lib/command_line.rb", "lib/job_list.rb", "lib/job_types/default.rb", "lib/job_types/rake_task.rb", "lib/job_types/runner.rb", "lib/outputs/cron.rb", "lib/version.rb", "lib/whenever.rb", "Manifest", "Rakefile", "README.rdoc", "test/command_line_test.rb", "test/cron_test.rb", "test/output_at_test.rb", "test/output_command_test.rb", "test/output_env_test.rb", "test/output_rake_test.rb", "test/output_runner_test.rb", "test/test_helper.rb", "whenever.gemspec"]
|
15
|
-
s.has_rdoc = true
|
16
15
|
s.homepage = %q{http://github.com/javan/whenever}
|
17
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Whenever", "--main", "README.rdoc"]
|
18
17
|
s.require_paths = ["lib"]
|
19
18
|
s.rubyforge_project = %q{whenever}
|
20
|
-
s.rubygems_version = %q{1.3.
|
19
|
+
s.rubygems_version = %q{1.3.5}
|
21
20
|
s.summary = %q{Provides clean ruby syntax for defining messy cron jobs and running them Whenever.}
|
22
21
|
s.test_files = ["test/command_line_test.rb", "test/cron_test.rb", "test/output_at_test.rb", "test/output_command_test.rb", "test/output_env_test.rb", "test/output_rake_test.rb", "test/output_runner_test.rb", "test/test_helper.rb"]
|
23
22
|
|
24
23
|
if s.respond_to? :specification_version then
|
25
24
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
-
s.specification_version =
|
25
|
+
s.specification_version = 3
|
27
26
|
|
28
27
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
28
|
s.add_runtime_dependency(%q<chronic>, [">= 0.2.3"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: javan-whenever
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javan Makhmali
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -68,7 +68,7 @@ files:
|
|
68
68
|
- test/output_runner_test.rb
|
69
69
|
- test/test_helper.rb
|
70
70
|
- whenever.gemspec
|
71
|
-
has_rdoc:
|
71
|
+
has_rdoc: false
|
72
72
|
homepage: http://github.com/javan/whenever
|
73
73
|
post_install_message:
|
74
74
|
rdoc_options:
|
@@ -97,7 +97,7 @@ requirements: []
|
|
97
97
|
rubyforge_project: whenever
|
98
98
|
rubygems_version: 1.2.0
|
99
99
|
signing_key:
|
100
|
-
specification_version:
|
100
|
+
specification_version: 3
|
101
101
|
summary: Provides clean ruby syntax for defining messy cron jobs and running them Whenever.
|
102
102
|
test_files:
|
103
103
|
- test/command_line_test.rb
|