-
Notifications
You must be signed in to change notification settings - Fork 726
/
Copy pathwhenever.rb
41 lines (33 loc) · 853 Bytes
/
whenever.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'whenever/numeric'
require 'whenever/numeric_seconds'
require 'whenever/job_list'
require 'whenever/job'
require 'whenever/command_line'
require 'whenever/cron'
require 'whenever/output_redirection'
require 'whenever/os'
module Whenever
def self.cron(options)
Whenever::JobList.new(options).generate_cron_output
end
def self.seconds(number, units)
Whenever::NumericSeconds.seconds(number, units)
end
def self.path
Dir.pwd
end
def self.bin_rails?
File.exist?(File.join(path, 'bin', 'rails'))
end
def self.script_rails?
File.exist?(File.join(path, 'script', 'rails'))
end
def self.bundler?
File.exist?(File.join(path, 'Gemfile'))
end
def self.update_cron options
o = { 'update' => true, 'console' => false}
o.merge! options if options
Whenever::CommandLine.execute o
end
end