29 lines
906 B
Ruby
29 lines
906 B
Ruby
#!/usr/bin/env ruby
|
|
|
|
require 'rubygems'
|
|
require 'optparse'
|
|
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('-w', '--write-crontab') { options[:write] = true }
|
|
opts.on('-i', '--update-crontab [identifier]', 'Default: full path to schedule.rb file') do |identifier|
|
|
options[:update] = true
|
|
options[:identifier] = identifier if identifier
|
|
end
|
|
opts.on('-f', '--load-file [schedule file]', 'Default: config/schedule.rb') do |file|
|
|
options[:file] = file if file
|
|
end
|
|
opts.on('-u', '--user [user]', 'Default: current user') do |user|
|
|
options[:user] = user if user
|
|
end
|
|
end.parse!
|
|
|
|
Whenever::CommandLine.execute(options) |