Class: Xronor::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/xronor/cli.rb

Constant Summary collapse

DEFAULT_JOB_PREFIX =
"scheduler-"

Instance Method Summary collapse

Instance Method Details

#crontab(filename) ⇒ Object



6
7
8
9
# File 'lib/xronor/cli.rb', line 6

def crontab(filename)
  body = Xronor::Generator::Crontab.generate(filename, options)
  puts body
end

#cwa(filename) ⇒ Object



19
20
21
# File 'lib/xronor/cli.rb', line 19

def cwa(filename)
  Xronor::Generator::CloudWatchEvents.generate(filename, options)
end

#template(filename) ⇒ Object



25
26
27
28
# File 'lib/xronor/cli.rb', line 25

def template(filename)
  body = Xronor::Generator::ERB.generate_all_in_one(filename, options)
  puts body
end

#template_per_job(filename) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/xronor/cli.rb', line 34

def template_per_job(filename)
  contents = Xronor::Generator::ERB.generate_per_job(filename, options)

  contents.each do |name, body|
    path = File.join(options[:outdir], options[:ext] ? "#{name}.#{options[:ext]}" : name)
    open(path, "w+") { |f| f.puts body }
  end
end