rubys-whenever 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,15 @@
1
+ == 0.3.1 / June 25th, 2009
2
+
3
+ * Removed activesupport gem dependency. #1 [Javan Makhmali]
4
+
5
+ * Switched to numeric days of the week for Solaris support (and probably others). #8 [Roger Ertesvåg]
6
+
7
+
1
8
  == 0.3.0 / June 2nd, 2009
2
9
 
3
10
  * Added ability to set variables on the fly from the command line (ex: whenever --set environment=staging). [Javan Makhmali]
4
11
 
12
+
5
13
  == 0.2.2 / April 30th, 2009
6
14
 
7
15
  * Days of week jobs can now accept an :at directive (ex: every :monday, :at => '5pm'). [David Eisinger]
data/README.rdoc CHANGED
@@ -4,6 +4,8 @@ Whenever is a Ruby gem that provides a clear syntax for defining cron jobs. It o
4
4
 
5
5
  Ryan Bates created a great Railscast about Whenever: http://railscasts.com/episodes/164-cron-in-ruby
6
6
 
7
+ Discussion: http://groups.google.com/group/whenever-gem
8
+
7
9
  == Installation
8
10
 
9
11
  Regular (non-Rails) install:
@@ -99,9 +101,11 @@ Whenever was created for use at Inkling (http://inklingmarkets.com) where I work
99
101
 
100
102
  While building Whenever, I learned a lot by digging through the source code of Capistrano - http://github.com/jamis/capistrano
101
103
 
102
- == Feedback
104
+ == Discussion / Feedback / Issues / Bugs
105
+
106
+ For general discussion and questions, please use the google group: http://groups.google.com/group/whenever-gem
103
107
 
104
- Email me: javan [at] javan (dot) us
108
+ If you've found a genuine bug or issue, please use the Issues section on github: http://github.com/javan/whenever/issues
105
109
 
106
110
  == License
107
111
 
data/Rakefile CHANGED
@@ -9,5 +9,5 @@ Echoe.new('whenever', Whenever::VERSION::STRING) do |p|
9
9
  p.url = "http://github.com/javan/whenever"
10
10
  p.author = "Javan Makhmali"
11
11
  p.email = "javan@javan.us"
12
- p.dependencies = ["chronic >=0.2.3", "activesupport >=1.3.0"]
12
+ p.dependencies = ["chronic >=0.2.3"]
13
13
  end
data/lib/outputs/cron.rb CHANGED
@@ -99,11 +99,11 @@ module Whenever
99
99
  timing[0] = @at.is_a?(Time) ? @at.min : 0
100
100
  timing[1] = @at.is_a?(Time) ? @at.hour : 0
101
101
 
102
- return (timing << 'mon-fri') * " " if string.downcase.index('weekday')
103
- return (timing << 'sat,sun') * " " if string.downcase.index('weekend')
102
+ return (timing << '1-5') * " " if string.downcase.index('weekday')
103
+ return (timing << '6,0') * " " if string.downcase.index('weekend')
104
104
 
105
- %w(sun mon tue wed thu fri sat).each do |day|
106
- return (timing << day) * " " if string.downcase.index(day)
105
+ %w(sun mon tue wed thu fri sat).each_with_index do |day, i|
106
+ return (timing << i) * " " if string.downcase.index(day)
107
107
  end
108
108
 
109
109
  raise ArgumentError, "Couldn't parse: #{@time}"
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@ module Whenever
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/whenever.rb CHANGED
@@ -9,10 +9,20 @@ unless defined?(Whenever)
9
9
  end
10
10
  end
11
11
 
12
- # Dependencies
13
- require 'activesupport'
14
12
  require 'chronic'
15
13
 
14
+ # If Rails' rakefile was loaded than so was activesupport, but
15
+ # if this is being used in a non-rails enviroment we need to require it.
16
+ # It was previously defined as a dependency of this gem, but that became
17
+ # problematic. See: http://github.com/javan/whenever/issues#issue/1
18
+ begin
19
+ require 'activesupport'
20
+ rescue LoadError => e
21
+ warn 'To user Whenever you need the activesupport gem:'
22
+ warn '$ sudo gem install activesupport'
23
+ exit(1)
24
+ end
25
+
16
26
  # Whenever files
17
27
  %w{
18
28
  base
data/test/cron_test.rb CHANGED
@@ -136,13 +136,13 @@ class CronTest < Test::Unit::TestCase
136
136
  context "When parsing time in days (of week)" do
137
137
  should "parse days of the week correctly" do
138
138
  {
139
- 'sun' => %w(sun Sunday SUNDAY SUN),
140
- 'mon' => %w(mon Monday MONDAY MON),
141
- 'tue' => %w(tue tues Tuesday TUESDAY TUE),
142
- 'wed' => %w(wed Wednesday WEDNESDAY WED),
143
- 'thu' => %w(thu thurs thur Thursday THURSDAY THU),
144
- 'fri' => %w(fri Friday FRIDAY FRI),
145
- 'sat' => %w(sat Saturday SATURDAY SAT)
139
+ '0' => %w(sun Sunday SUNDAY SUN),
140
+ '1' => %w(mon Monday MONDAY MON),
141
+ '2' => %w(tue tues Tuesday TUESDAY TUE),
142
+ '3' => %w(wed Wednesday WEDNESDAY WED),
143
+ '4' => %w(thu thurs thur Thursday THURSDAY THU),
144
+ '5' => %w(fri Friday FRIDAY FRI),
145
+ '6' => %w(sat Saturday SATURDAY SAT)
146
146
  }.each do |day, day_tests|
147
147
  day_tests.each do |day_test|
148
148
  assert_equal "0 0 * * #{day}", parse_time(day_test)
@@ -151,23 +151,23 @@ class CronTest < Test::Unit::TestCase
151
151
  end
152
152
 
153
153
  should "allow additional directives" do
154
- assert_equal '30 13 * * fri', parse_time('friday', nil, "1:30 pm")
155
- assert_equal '22 2 * * mon', parse_time('Monday', nil, "2:22am")
156
- assert_equal '55 17 * * thu', parse_time('THU', nil, "5:55PM")
154
+ assert_equal '30 13 * * 5', parse_time('friday', nil, "1:30 pm")
155
+ assert_equal '22 2 * * 1', parse_time('Monday', nil, "2:22am")
156
+ assert_equal '55 17 * * 4', parse_time('THU', nil, "5:55PM")
157
157
  end
158
158
 
159
159
  should "parse weekday correctly" do
160
- assert_equal '0 0 * * mon-fri', parse_time('weekday')
161
- assert_equal '0 0 * * mon-fri', parse_time('Weekdays')
162
- assert_equal '0 1 * * mon-fri', parse_time('Weekdays', nil, "1:00 am")
163
- assert_equal '59 5 * * mon-fri', parse_time('Weekdays', nil, "5:59 am")
160
+ assert_equal '0 0 * * 1-5', parse_time('weekday')
161
+ assert_equal '0 0 * * 1-5', parse_time('Weekdays')
162
+ assert_equal '0 1 * * 1-5', parse_time('Weekdays', nil, "1:00 am")
163
+ assert_equal '59 5 * * 1-5', parse_time('Weekdays', nil, "5:59 am")
164
164
  end
165
165
 
166
166
  should "parse weekend correctly" do
167
- assert_equal '0 0 * * sat,sun', parse_time('weekend')
168
- assert_equal '0 0 * * sat,sun', parse_time('Weekends')
169
- assert_equal '0 7 * * sat,sun', parse_time('Weekends', nil, "7am")
170
- assert_equal '2 18 * * sat,sun', parse_time('Weekends', nil, "6:02PM")
167
+ assert_equal '0 0 * * 6,0', parse_time('weekend')
168
+ assert_equal '0 0 * * 6,0', parse_time('Weekends')
169
+ assert_equal '0 7 * * 6,0', parse_time('Weekends', nil, "7am")
170
+ assert_equal '2 18 * * 6,0', parse_time('Weekends', nil, "6:02PM")
171
171
  end
172
172
  end
173
173
 
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.0"
5
+ s.version = "0.3.1"
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-06-08}
9
+ s.date = %q{2009-06-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"]
@@ -26,13 +26,10 @@ Gem::Specification.new do |s|
26
26
 
27
27
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
28
  s.add_runtime_dependency(%q<chronic>, [">= 0.2.3"])
29
- s.add_runtime_dependency(%q<activesupport>, [">= 1.3.0"])
30
29
  else
31
30
  s.add_dependency(%q<chronic>, [">= 0.2.3"])
32
- s.add_dependency(%q<activesupport>, [">= 1.3.0"])
33
31
  end
34
32
  else
35
33
  s.add_dependency(%q<chronic>, [">= 0.2.3"])
36
- s.add_dependency(%q<activesupport>, [">= 1.3.0"])
37
34
  end
38
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubys-whenever
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
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-06-08 00:00:00 -07:00
12
+ date: 2009-06-25 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,16 +22,6 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.2.3
24
24
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: activesupport
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.3.0
34
- version:
35
25
  description: Provides clean ruby syntax for defining messy cron jobs and running them Whenever.
36
26
  email: javan@javan.us
37
27
  executables: