lib/multi_scheduler.rb in multi_scheduler-0.1.1 vs lib/multi_scheduler.rb in multi_scheduler-0.1.2
- old
+ new
@@ -1,37 +1,18 @@
# encoding: UTF-8
module MultiScheduler
- VERSION = '0.1.1'
+ VERSION = '0.1.2'
def self.schedule id, options = {}
- scheduler(id, options).start
- end
-
- def self.unschedule id, options = {}
- scheduler(id, options).stop
- end
-
- def self.scheduler id, options = {}
- case RbConfig::CONFIG['host_os']
+ host_os = RbConfig::CONFIG['host_os']
+ case host_os
when /darwin/i
Launchd.new id, options
- else
+ when /linux/i
Whenever.new id, options
- end
- end
-
- private
-
- class Scheduler
-
- def initialize id, options = {}
-
- @identifier = id
- raise "identifier is required" unless @identifier
-
- @command_arguments = [ options[:args] ].flatten.compact
- @command = options[:command] || @command_arguments.shift
+ else
+ raise "Unsupported host operating system '#{host_os}'"
end
end
end
Dir[File.join File.dirname(__FILE__), File.basename(__FILE__, '.*'), '*.rb'].each{ |lib| require lib }