javan-whenever 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +6 -1
- data/lib/job_list.rb +15 -0
- data/lib/version.rb +1 -1
- data/test/output_env_test.rb +33 -0
- data/whenever.gemspec +2 -2
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
== 0.3.6 / June 15th, 2009
|
2
|
+
|
3
|
+
* Setting a PATH in the crontab automatically based on the user's PATH. [Javan Makhmali]
|
4
|
+
|
5
|
+
|
1
6
|
== 0.3.5 / June 13th, 2009
|
2
7
|
|
3
|
-
* Added ability to accept lists of every's and at's and intelligently group them. (ex: every 'monday, wednesday', :at => ['3pm, 6am']). [Sam Ruby]
|
8
|
+
* Added ability to accept lists of every's and at's and intelligently group them. (ex: every 'monday, wednesday', :at => ['3pm', '6am']). [Sam Ruby]
|
4
9
|
|
5
10
|
* Fixed issue with new lines. #18 [Javan Makhmali]
|
6
11
|
|
data/lib/job_list.rb
CHANGED
@@ -57,6 +57,8 @@ module Whenever
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def generate_cron_output
|
60
|
+
set_path_environment_variable
|
61
|
+
|
60
62
|
[environment_variables, cron_jobs].compact.join
|
61
63
|
end
|
62
64
|
|
@@ -77,6 +79,19 @@ module Whenever
|
|
77
79
|
set(variable.strip, value.strip) unless variable.blank? || value.blank?
|
78
80
|
end
|
79
81
|
end
|
82
|
+
|
83
|
+
def set_path_environment_variable
|
84
|
+
return if path_should_not_be_set_automatically?
|
85
|
+
@env[:PATH] = read_path unless read_path.blank?
|
86
|
+
end
|
87
|
+
|
88
|
+
def read_path
|
89
|
+
ENV['PATH'] if ENV
|
90
|
+
end
|
91
|
+
|
92
|
+
def path_should_not_be_set_automatically?
|
93
|
+
@set_path_automatically === false || @env[:PATH] || @env["PATH"]
|
94
|
+
end
|
80
95
|
|
81
96
|
def environment_variables
|
82
97
|
return if @env.empty?
|
data/lib/version.rb
CHANGED
data/test/output_env_test.rb
CHANGED
@@ -19,5 +19,38 @@ class OutputEnvTest < Test::Unit::TestCase
|
|
19
19
|
assert_match "MAILTO=someone@example.com", @output
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
context "No PATH environment variable set" do
|
24
|
+
setup do
|
25
|
+
Whenever::JobList.any_instance.expects(:read_path).at_least_once.returns('/usr/local/bin')
|
26
|
+
@output = Whenever.cron ""
|
27
|
+
end
|
28
|
+
|
29
|
+
should "add a PATH variable based on the user's PATH" do
|
30
|
+
assert_match "PATH=/usr/local/bin", @output
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "A PATH environment variable set" do
|
35
|
+
setup do
|
36
|
+
Whenever::JobList.stubs(:read_path).returns('/usr/local/bin')
|
37
|
+
@output = Whenever.cron "env :PATH, '/my/path'"
|
38
|
+
end
|
39
|
+
|
40
|
+
should "use that path and the user's PATH" do
|
41
|
+
assert_match "PATH=/my/path", @output
|
42
|
+
assert_no_match /local/, @output
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "No PATH set and instructed not to automatically load the user's path" do
|
47
|
+
setup do
|
48
|
+
@output = Whenever.cron "set :set_path_automatically, false"
|
49
|
+
end
|
50
|
+
|
51
|
+
should "not have a PATH set" do
|
52
|
+
assert_no_match /PATH/, @output
|
53
|
+
end
|
54
|
+
end
|
22
55
|
|
23
56
|
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.3.
|
5
|
+
s.version = "0.3.6"
|
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-07-
|
9
|
+
s.date = %q{2009-07-15}
|
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: javan-whenever
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
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-07-
|
12
|
+
date: 2009-07-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|