Cleaned up requirements, paths, test structure

This commit is contained in:
Javan Makhmali 2010-09-06 13:18:39 -04:00
parent 1472fecc4b
commit 27827c8e17
15 changed files with 29 additions and 51 deletions

View File

@ -1,7 +1,7 @@
require 'rubygems'
require 'rake'
require 'lib/whenever/version.rb'
require File.expand_path(File.dirname(__FILE__) + "/lib/whenever/version")
begin
require 'jeweler'
@ -13,7 +13,10 @@ begin
gemspec.email = "javan@javan.us"
gemspec.homepage = "http://github.com/javan/whenever"
gemspec.authors = ["Javan Makhmali"]
gemspec.add_dependency("chronic", '>= 0.2.3')
gemspec.add_dependency 'chronic', '>= 0.2.3'
gemspec.add_dependency 'activesupport', '>= 2.3.4'
gemspec.add_development_dependency 'shoulda', '>= 2.1.1'
gemspec.add_development_dependency 'mocha', '>= 0.9.5'
end
Jeweler::GemcutterTasks.new
rescue LoadError
@ -23,9 +26,9 @@ end
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/*.rb'
test.pattern = 'test/{functional,unit}/**/*_test.rb'
test.verbose = true
end
end
task :test => :check_dependencies

View File

@ -1,20 +1,10 @@
require 'chronic'
require 'active_support/all'
# It was previously defined as a dependency of this gem, but that became
# problematic. See: http://github.com/javan/whenever/issues#issue/1
begin
require 'active_support/all'
rescue LoadError
warn 'To use Whenever you need the active_support gem:'
warn '$ gem install activesupport'
exit(1)
end
# Whenever files
require 'whenever/base'
require 'whenever/job_list'
require 'whenever/job'
require 'whenever/outputs/cron'
require 'whenever/outputs/cron/output_redirection'
require 'whenever/cron'
require 'whenever/output_redirection'
require 'whenever/command_line'
require 'whenever/version'

View File

@ -1,6 +1,5 @@
module Whenever
module Output
class Cron
attr_accessor :time, :task
@ -43,7 +42,7 @@ module Whenever
end
def output_redirection
OutputRedirection.new(@output_redirection).to_s unless @output_redirection == :not_set
Whenever::Output::Cron::OutputRedirection.new(@output_redirection).to_s unless @output_redirection == :not_set
end
protected
@ -60,7 +59,7 @@ module Whenever
end
if shortcut
if @at.is_a?(Time) || (@at.is_a?(Numeric) && @at>0)
if @at.is_a?(Time) || (@at.is_a?(Numeric) && @at > 0)
raise ArgumentError, "You cannot specify an ':at' when using the shortcuts for times."
else
return shortcut
@ -134,6 +133,5 @@ module Whenever
end
end
end
end

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class CommandLineTest < Test::Unit::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class OutputAtTest < Test::Unit::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class OutputCommandTest < Test::Unit::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class OutputDefinedJobTest < Test::Unit::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class OutputEnvTest < Test::Unit::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class OutputRakeTest < Test::Unit::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class OutputRedirectionTest < Test::Unit::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class OutputRunnerTest < Test::Unit::TestCase

View File

@ -1,24 +1,11 @@
require 'rubygems'
require 'test/unit'
require File.expand_path(File.dirname(__FILE__) + "/../lib/whenever")
begin
require 'shoulda'
rescue LoadError
warn 'To test Whenever you need the shoulda gem:'
warn '$ sudo gem install thoughtbot-shoulda'
exit(1)
end
begin
require 'mocha'
rescue LoadError
warn 'To test Whenever you need the mocha gem:'
warn '$ sudo gem install mocha'
exit(1)
end
# Want to test the files here, in lib, not in an installed version of the gem.
$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
require 'whenever'
require 'shoulda'
require 'mocha'
module TestExtensions

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class CronTest < Test::Unit::TestCase

View File

@ -1,4 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
class JobTest < Test::Unit::TestCase