cwninja-whenever 0.1.5.2 → 0.1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/whenever +2 -1
- data/lib/command_line.rb +6 -6
- data/lib/job_list.rb +2 -0
- data/lib/version.rb +1 -1
- data/test/output_command_test.rb +18 -0
- data/whenever.gemspec +2 -2
- metadata +2 -2
data/bin/whenever
CHANGED
@@ -16,6 +16,7 @@ OptionParser.new do |opts|
|
|
16
16
|
opts.on('-w', '--write-crontab') { options[:write] = true }
|
17
17
|
opts.on('-p', '--update-crontab') { options[:update] = true }
|
18
18
|
opts.on('-m', '--marker [a specific string token]') { |token| options[:marker] = token }
|
19
|
+
opts.on('-l', '--cron_log [logfile for cron output]') { |token| options[:cron_log] = token }
|
19
20
|
opts.on('-f', '--load-file [schedule file]', 'default: config/schedule.rb') do |file|
|
20
21
|
options[:file] = file if file
|
21
22
|
end
|
@@ -38,6 +39,6 @@ if options[:write]
|
|
38
39
|
elsif options[:update]
|
39
40
|
command_line.update!
|
40
41
|
else
|
41
|
-
puts Whenever.cron(
|
42
|
+
puts Whenever.cron(options)
|
42
43
|
exit
|
43
44
|
end
|
data/lib/command_line.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
class CommandLine
|
2
2
|
START_MARKER = "### BEGIN whenever generated crontab ###"
|
3
3
|
END_MARKER = "### END whenever generated crontab ###"
|
4
|
-
|
4
|
+
|
5
5
|
attr_reader :options
|
6
|
-
|
6
|
+
|
7
7
|
def start_marker
|
8
8
|
"### BEGIN #{@marker} ###"
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def end_marker
|
12
12
|
"### END #{@marker} ###"
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def initialize(options = {})
|
16
16
|
@options = options
|
17
17
|
@marker = options[:marker] || "whenever generated crontab"
|
18
18
|
end
|
19
19
|
|
20
20
|
def write!
|
21
|
-
cron_output = Whenever.cron(
|
21
|
+
cron_output = Whenever.cron(options)
|
22
22
|
write_crontab(cron_output)
|
23
23
|
end
|
24
24
|
|
25
25
|
def update!
|
26
26
|
before, after = strip_whenever_crontab(read_crontab)
|
27
|
-
whenever_cron = Whenever.cron(
|
27
|
+
whenever_cron = Whenever.cron(options)
|
28
28
|
write_crontab((before + [start_marker, whenever_cron, end_marker] + after).compact.join("\n"))
|
29
29
|
end
|
30
30
|
|
data/lib/job_list.rb
CHANGED
data/lib/version.rb
CHANGED
data/test/output_command_test.rb
CHANGED
@@ -67,4 +67,22 @@ class OutputCommandTest < Test::Unit::TestCase
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
context "A command when the cron_log is not set and the command line sets it instead" do
|
71
|
+
setup do
|
72
|
+
@output = Whenever.cron(
|
73
|
+
:cron_log => "otherlog.log",
|
74
|
+
:string => %%
|
75
|
+
every 2.hours do
|
76
|
+
command "blahblah"
|
77
|
+
end
|
78
|
+
%
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
should "output the command with the log syntax appended" do
|
83
|
+
assert_no_match /.+ .+ .+ .+ blahblah >> logfile.log 2>&1/, @output
|
84
|
+
assert_match /^.+ .+ .+ .+ blahblah >> otherlog.log 2>&1$/, @output
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
70
88
|
end
|
data/whenever.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{whenever}
|
5
|
-
s.version = "0.1.5.
|
5
|
+
s.version = "0.1.5.3"
|
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-02-
|
9
|
+
s.date = %q{2009-02-25}
|
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"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cwninja-whenever
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.5.
|
4
|
+
version: 0.1.5.3
|
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-02-
|
12
|
+
date: 2009-02-25 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|