Class: Convergence::CLI

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

Instance Method Summary collapse

Instance Method Details

#apply(file) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/convergence/cli.rb', line 14

def apply(file)
  opts = { input: file }
  if options[:dry_run]
    require 'convergence/command/dryrun'
    Convergence::Command::Dryrun.new(opts, config: config).execute
  elsif options[:rollback_dry_run]
    require 'convergence/command/rollback_dryrun'
    Convergence::Command::RollbackDryrun.new(opts, config: config).execute
  else
    require 'convergence/command/apply'
    Convergence::Command::Apply.new(opts, config: config).execute
  end
end

#diff(file1, file2) ⇒ Object



29
30
31
32
33
# File 'lib/convergence/cli.rb', line 29

def diff(file1, file2)
  require 'convergence/command/diff'
  opts = { diff: [file1, file2] }
  Convergence::Command::Diff.new(opts, config: config).execute
end

#exportObject



37
38
39
40
41
# File 'lib/convergence/cli.rb', line 37

def export
  require 'convergence/command/export'
  opts = {}
  Convergence::Command::Export.new(opts, config: config).execute
end

#versionObject



44
45
46
47
# File 'lib/convergence/cli.rb', line 44

def version
  require 'convergence/version'
  puts "version #{Convergence::VERSION}"
end