using jeweler, lots of cleanup, updates to readme, etc.
This commit is contained in:
parent
8386e6a417
commit
9968a75e51
@ -1,3 +1,10 @@
|
||||
== 0.4.0 / October 20th, 2009
|
||||
|
||||
* New output option replaces the old cron_log option for output redirection and is much more flexible. #31 [Peer Allan]
|
||||
|
||||
* Reorganized the lib files (http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices) and switched to Jeweler from Echoe.
|
||||
|
||||
|
||||
== 0.3.7 / September 4th, 2009
|
||||
|
||||
* No longer tries (and fails) to combine @shortcut jobs. #20 [Javan Makhmali]
|
||||
|
24
Manifest
24
Manifest
@ -1,24 +0,0 @@
|
||||
bin/whenever
|
||||
bin/wheneverize
|
||||
CHANGELOG.rdoc
|
||||
lib/base.rb
|
||||
lib/command_line.rb
|
||||
lib/job_list.rb
|
||||
lib/job_types/default.rb
|
||||
lib/job_types/rake_task.rb
|
||||
lib/job_types/runner.rb
|
||||
lib/outputs/cron.rb
|
||||
lib/version.rb
|
||||
lib/whenever.rb
|
||||
Manifest
|
||||
Rakefile
|
||||
README.rdoc
|
||||
test/command_line_test.rb
|
||||
test/cron_test.rb
|
||||
test/output_at_test.rb
|
||||
test/output_command_test.rb
|
||||
test/output_env_test.rb
|
||||
test/output_rake_test.rb
|
||||
test/output_runner_test.rb
|
||||
test/test_helper.rb
|
||||
whenever.gemspec
|
65
README.rdoc
65
README.rdoc
@ -8,35 +8,17 @@ Discussion: http://groups.google.com/group/whenever-gem
|
||||
|
||||
== Installation
|
||||
|
||||
Regular (non-Rails) install:
|
||||
If you haven't already, get set up with http://gemcutter.org
|
||||
|
||||
$ gem sources -a http://gems.github.com #you only need to run this once
|
||||
$ sudo gem install javan-whenever
|
||||
$ sudo gem install whenever
|
||||
|
||||
In a Rails (2.1 or greater) application:
|
||||
|
||||
in your "config/environment.rb" file:
|
||||
|
||||
Rails::Initializer.run do |config|
|
||||
config.gem 'javan-whenever', :lib => false, :source => 'http://gems.github.com'
|
||||
config.gem 'whenever', :lib => false, :source => 'http://gemcutter.org/'
|
||||
end
|
||||
|
||||
To install this gem (and all other missing gem dependencies), run rake gems:install (use sudo if necessary).
|
||||
|
||||
In older versions of Rails:
|
||||
|
||||
$ gem sources -a http://gems.github.com #you only need to run this once
|
||||
$ gem install javan-whenever
|
||||
|
||||
in your "config/environment.rb" file:
|
||||
|
||||
Rails::Initializer.run do |config|
|
||||
...
|
||||
end
|
||||
|
||||
require 'whenever'
|
||||
|
||||
NOTE: Requiring the whenever gem inside your Rails application is technically optional. However, if you plan to use something like Capistrano to automatically deploy and write your crontab file, you'll need to have the gem installed on your servers, and requiring it in your app is one way to ensure this.
|
||||
|
||||
== Getting started
|
||||
|
||||
@ -67,51 +49,12 @@ This will create an initial "config/schedule.rb" file you.
|
||||
|
||||
More examples on the wiki: http://wiki.github.com/javan/whenever/instructions-and-examples
|
||||
|
||||
== Output redirection
|
||||
|
||||
In your schedule.rb file you can specify the redirection options for your commands at a global or command level by setting the 'output' variable.
|
||||
|
||||
# adds ">> /path/to/file.log 2>&1" to all commands
|
||||
set :output => '/path/to/file.log'
|
||||
|
||||
Or you can STDOUT and STDERR separately,
|
||||
|
||||
# adds ">> cron.log 2> error.log" to all commands
|
||||
set :output => {:error => 'error.log', :standard => 'cron.log'}
|
||||
|
||||
# adds ">> cron.log" to all commands
|
||||
set :output => {:standard => 'cron.log'}
|
||||
|
||||
# adds "2> error.log" to all commands
|
||||
set :output => {:error => 'error.log'}
|
||||
|
||||
Additionally you can set these values at the command level,
|
||||
|
||||
every 3.hours do
|
||||
runner "MyModel.some_process", :output => 'cron.log'
|
||||
rake "my:rake:task", :output => {:error => 'error.log', :standard => 'cron.log'}
|
||||
command "/usr/bin/cmd"
|
||||
end
|
||||
|
||||
In all cases you can if you explicitly set the value of any output to 'nil' it will add a redirect to /dev/null
|
||||
|
||||
# adds ">> /dev/null 2>&1" to all commands
|
||||
set :output => nil
|
||||
set :output => {:error => nil, :standard => nil}
|
||||
|
||||
# adds ">> /dev/null" to all commands
|
||||
set :output => {:standard => nil}
|
||||
|
||||
# adds "2> /dev/null" to all commands
|
||||
set :output => {:error => nil}
|
||||
|
||||
|
||||
== Cron output
|
||||
|
||||
$ cd /my/rails/app
|
||||
$ whenever
|
||||
|
||||
And you'll see your schedule.rb converted to cron sytax
|
||||
And you'll see your schedule.rb converted to cron sytax. Note: running `whenever' with no options does not display your current crontab file, it simply shows you the output of converting your schedule.rb file.
|
||||
|
||||
== Capistrano integration
|
||||
|
||||
|
37
Rakefile
37
Rakefile
@ -1,13 +1,32 @@
|
||||
require 'rubygems'
|
||||
require 'rake'
|
||||
require 'echoe'
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + "/lib/version")
|
||||
require 'lib/whenever/version.rb'
|
||||
|
||||
Echoe.new('whenever', Whenever::VERSION::STRING) do |p|
|
||||
p.description = "Provides clean ruby syntax for defining messy cron jobs and running them Whenever."
|
||||
p.url = "http://github.com/javan/whenever"
|
||||
p.author = "Javan Makhmali"
|
||||
p.email = "javan@javan.us"
|
||||
p.dependencies = ["chronic >=0.2.3"]
|
||||
end
|
||||
begin
|
||||
require 'jeweler'
|
||||
Jeweler::Tasks.new do |gemspec|
|
||||
gemspec.name = "whenever"
|
||||
gemspec.version = Whenever::VERSION
|
||||
gemspec.summary = "Clean ruby syntax for defining and deploying messy cron jobs."
|
||||
gemspec.description = "Clean ruby syntax for defining and deploying messy cron jobs."
|
||||
gemspec.email = "javan@javan.us"
|
||||
gemspec.homepage = "http://github.com/javan/whenever"
|
||||
gemspec.authors = ["Javan Makhmali"]
|
||||
gemspec.add_dependency("chronic", '>= 0.2.3')
|
||||
end
|
||||
Jeweler::GemcutterTasks.new
|
||||
rescue LoadError
|
||||
puts "Jeweler not available. Install it with: sudo gem install jeweler -s http://gemcutter.org"
|
||||
end
|
||||
|
||||
require 'rake/testtask'
|
||||
Rake::TestTask.new(:test) do |test|
|
||||
test.libs << 'lib' << 'test'
|
||||
test.pattern = 'test/*.rb'
|
||||
test.verbose = true
|
||||
end
|
||||
|
||||
task :test => :check_dependencies
|
||||
|
||||
task :default => :test
|
@ -6,13 +6,11 @@ require 'fileutils'
|
||||
require 'tempfile'
|
||||
require 'whenever'
|
||||
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../lib/version")
|
||||
|
||||
options = Hash.new
|
||||
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = "Usage: whenever [options]"
|
||||
opts.on('-v', '--version') { puts "Whenever v#{Whenever::VERSION::STRING}"; exit }
|
||||
opts.on('-v', '--version') { puts "Whenever v#{Whenever::VERSION}"; exit }
|
||||
opts.on('-w', '--write-crontab') { options[:write] = true }
|
||||
opts.on('-i', '--update-crontab [identifier]', 'Default: full path to schedule.rb file') do |identifier|
|
||||
options[:update] = true
|
||||
|
@ -37,8 +37,6 @@ content = <<-FILE
|
||||
# Example:
|
||||
#
|
||||
# set :output, "/path/to/my/cron_log.log"
|
||||
# set :output, {:error => '/path/to/error.log', :standard => '/path/to/cron.log'}
|
||||
# set :output, {:error => '/path/to/error.log', :standard => nil}
|
||||
#
|
||||
# every 2.hours do
|
||||
# command "/usr/bin/some_great_command"
|
||||
|
@ -21,7 +21,6 @@ end
|
||||
|
||||
# Whenever files
|
||||
require 'whenever/base'
|
||||
require 'whenever/version'
|
||||
require 'whenever/job_list'
|
||||
require 'whenever/job_types/default'
|
||||
require 'whenever/job_types/rake_task'
|
||||
@ -29,3 +28,4 @@ require 'whenever/job_types/runner'
|
||||
require 'whenever/outputs/cron'
|
||||
require 'whenever/outputs/cron/output_redirection'
|
||||
require 'whenever/command_line'
|
||||
require 'whenever/version'
|
@ -11,5 +11,5 @@ module Whenever
|
||||
::RAILS_ROOT
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
@ -1,9 +1,3 @@
|
||||
module Whenever
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 0
|
||||
MINOR = 3
|
||||
TINY = 7
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
VERSION = '0.4.0'
|
||||
end unless defined?(Whenever::VERSION)
|
@ -1,24 +1,65 @@
|
||||
# Generated by jeweler
|
||||
# DO NOT EDIT THIS FILE DIRECTLY
|
||||
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = %q{whenever}
|
||||
s.version = "0.3.7"
|
||||
s.version = "0.4.0"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Javan Makhmali"]
|
||||
s.date = %q{2009-09-04}
|
||||
s.description = %q{Provides clean ruby syntax for defining messy cron jobs and running them Whenever.}
|
||||
s.date = %q{2009-10-20}
|
||||
s.description = %q{Clean ruby syntax for defining and deploying messy cron jobs.}
|
||||
s.email = %q{javan@javan.us}
|
||||
s.executables = ["whenever", "wheneverize"]
|
||||
s.extra_rdoc_files = ["bin/whenever", "bin/wheneverize", "CHANGELOG.rdoc", "lib/base.rb", "lib/command_line.rb", "lib/job_list.rb", "lib/job_types/default.rb", "lib/job_types/rake_task.rb", "lib/job_types/runner.rb", "lib/outputs/cron.rb", "lib/version.rb", "lib/whenever.rb", "README.rdoc"]
|
||||
s.files = ["bin/whenever", "bin/wheneverize", "CHANGELOG.rdoc", "lib/base.rb", "lib/command_line.rb", "lib/job_list.rb", "lib/job_types/default.rb", "lib/job_types/rake_task.rb", "lib/job_types/runner.rb", "lib/outputs/cron.rb", "lib/version.rb", "lib/whenever.rb", "Manifest", "Rakefile", "README.rdoc", "test/command_line_test.rb", "test/cron_test.rb", "test/output_at_test.rb", "test/output_command_test.rb", "test/output_env_test.rb", "test/output_rake_test.rb", "test/output_runner_test.rb", "test/test_helper.rb", "whenever.gemspec"]
|
||||
s.extra_rdoc_files = [
|
||||
"README.rdoc"
|
||||
]
|
||||
s.files = [
|
||||
".gitignore",
|
||||
"CHANGELOG.rdoc",
|
||||
"README.rdoc",
|
||||
"Rakefile",
|
||||
"bin/whenever",
|
||||
"bin/wheneverize",
|
||||
"lib/whenever.rb",
|
||||
"lib/whenever/base.rb",
|
||||
"lib/whenever/command_line.rb",
|
||||
"lib/whenever/job_list.rb",
|
||||
"lib/whenever/job_types/default.rb",
|
||||
"lib/whenever/job_types/rake_task.rb",
|
||||
"lib/whenever/job_types/runner.rb",
|
||||
"lib/whenever/outputs/cron.rb",
|
||||
"lib/whenever/outputs/cron/output_redirection.rb",
|
||||
"lib/whenever/version.rb",
|
||||
"test/command_line_test.rb",
|
||||
"test/cron_test.rb",
|
||||
"test/output_at_test.rb",
|
||||
"test/output_command_test.rb",
|
||||
"test/output_env_test.rb",
|
||||
"test/output_rake_test.rb",
|
||||
"test/output_redirection_test.rb",
|
||||
"test/output_runner_test.rb",
|
||||
"test/test_helper.rb",
|
||||
"whenever.gemspec"
|
||||
]
|
||||
s.homepage = %q{http://github.com/javan/whenever}
|
||||
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Whenever", "--main", "README.rdoc"]
|
||||
s.rdoc_options = ["--charset=UTF-8"]
|
||||
s.require_paths = ["lib"]
|
||||
s.rubyforge_project = %q{whenever}
|
||||
s.rubygems_version = %q{1.3.5}
|
||||
s.summary = %q{Provides clean ruby syntax for defining messy cron jobs and running them Whenever.}
|
||||
s.test_files = ["test/command_line_test.rb", "test/cron_test.rb", "test/output_at_test.rb", "test/output_command_test.rb", "test/output_env_test.rb", "test/output_rake_test.rb", "test/output_runner_test.rb", "test/test_helper.rb"]
|
||||
s.summary = %q{Clean ruby syntax for defining and deploying messy cron jobs.}
|
||||
s.test_files = [
|
||||
"test/command_line_test.rb",
|
||||
"test/cron_test.rb",
|
||||
"test/output_at_test.rb",
|
||||
"test/output_command_test.rb",
|
||||
"test/output_env_test.rb",
|
||||
"test/output_rake_test.rb",
|
||||
"test/output_redirection_test.rb",
|
||||
"test/output_runner_test.rb",
|
||||
"test/test_helper.rb"
|
||||
]
|
||||
|
||||
if s.respond_to? :specification_version then
|
||||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
||||
@ -33,3 +74,4 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency(%q<chronic>, [">= 0.2.3"])
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user