Make it work with ActiveSupport >= 2.3.2 instead of >= 2.3.4 #217

Closed
wants to merge 3 commits into
from
View
8 .travis.yml
@@ -6,4 +6,10 @@ rvm:
- jruby
- jruby-18mode
- jruby-19mode
- - jruby-head
+ - jruby-head
+gemfile:
@javan
Owner
javan added a line comment Mar 12, 2012

Neat! Didn't know Travis could do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ - Gemfile
+ - ci/Gemfile-AS-2_3_2
+ - ci/Gemfile-AS-3_0_0
+ - ci/Gemfile-AS-3_1_0
+ - ci/Gemfile-AS-3_2_0
View
4 ci/Gemfile-AS-2_3_2
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+gem "activesupport", "2.3.2"
+gemspec :path=>"../"
View
4 ci/Gemfile-AS-2_3_4
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+gem "activesupport", "2.3.4"
+gemspec :path=>"../"
View
4 ci/Gemfile-AS-3_0_0
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+gem "activesupport", "3.0.0"
+gemspec :path=>"../"
View
4 ci/Gemfile-AS-3_1_0
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+gem "activesupport", "3.1.0"
+gemspec :path=>"../"
View
4 ci/Gemfile-AS-3_2_0
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+gem "activesupport", "3.2.0"
+gemspec :path=>"../"
View
8 lib/whenever.rb
@@ -1,5 +1,11 @@
require 'thread'
-require 'active_support/all'
+require 'active_support/version'
+
+if ActiveSupport::VERSION::STRING >= "3.0.0"
+ require "active_support/time"
+else
+ require "active_support"
+end
module Whenever
autoload :JobList, 'whenever/job_list'
View
4 lib/whenever/job_list.rb
@@ -39,7 +39,7 @@ def every(frequency, options = {})
end
def job_type(name, template)
- class_eval do
+ JobList.class_eval do
define_method(name) do |task, *args|
options = { :task => task, :template => template }
options.merge!(args[0]) if args[0].is_a? Hash
@@ -130,7 +130,7 @@ def cron_jobs
Whenever::Output::Cron.output(time, job) do |cron|
cron << "\n\n"
- if cron.starts_with?("@")
+ if cron.start_with?("@")
@javan
Owner
javan added a line comment Mar 12, 2012

Oh man, start_with reads like broken english. I think I'd rather just use a regex here.

@JonathanTron
JonathanTron added a line comment Mar 12, 2012

Indeed, but this method exists in both ruby 1.8.7 and 1.9.x without having to require 'active_support/core_ext'.
If you want I can change it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
shortcut_jobs << cron
else
regular_jobs << cron
View
2 whenever.gemspec
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.add_dependency "chronic", "~> 0.6.3"
- s.add_dependency "activesupport", ">= 2.3.4"
+ s.add_dependency "activesupport", ">= 2.3.2"
s.add_development_dependency "shoulda", ">= 2.1.1"
s.add_development_dependency "mocha", ">= 0.9.5"