Class: Catfish::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/catfish/cli.rb,
lib/catfish/cli/init.rb

Defined Under Namespace

Classes: Clean, Init, Plugin, Provision, Resolve

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.



8
9
10
11
12
13
14
# File 'lib/catfish/cli.rb', line 8

def initialize(*args)
  super
rescue UnknownArgumentError => e
  raise InvalidOption, e.message
ensure
  self.options ||= {}
end

Class Method Details

.source_rootObject



16
17
18
# File 'lib/catfish/cli.rb', line 16

def self.source_root
  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#cleanObject



61
62
63
64
# File 'lib/catfish/cli.rb', line 61

def clean
  require 'catfish/cli/clean'
  Clean.new.run
end

#initObject



43
44
45
46
# File 'lib/catfish/cli.rb', line 43

def init
  require 'catfish/cli/init'
  Init.new(options.dup, self).run
end

#pluginObject



55
56
57
58
# File 'lib/catfish/cli.rb', line 55

def plugin
  require 'catfish/cli/plugin'
  Plugin.new(options.dup).run
end

#provisionObject



69
70
71
72
73
74
75
76
77
78
# File 'lib/catfish/cli.rb', line 69

def provision
  exists_before_resolve = File.exist?('Catfishfile.lock')
  resolve
  plugin
  require 'catfish/cli/provision'
  Provision.new(options.dup).run
  # If the Catfishfile.lock existed before the start of the run, then
  # we should leave it there. Otherwise, we should clean it up.
  clean unless exists_before_resolve
end

#resolveObject



49
50
51
52
# File 'lib/catfish/cli.rb', line 49

def resolve
  require 'catfish/cli/resolve'
  Resolve.new(options.dup).run
end