Class: Mofa::CLI
- Inherits:
-
Thor
- Object
- Thor
- Mofa::CLI
- Includes:
- Config, Thor::Actions
- Defined in:
- lib/mofa/cli.rb
Constant Summary collapse
- @@option_verbose =
false- @@option_debug =
false
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Config
Class Method Details
.option_debug ⇒ Object
72 73 74 |
# File 'lib/mofa/cli.rb', line 72 def self.option_debug @@option_debug end |
.option_verbose ⇒ Object
68 69 70 |
# File 'lib/mofa/cli.rb', line 68 def self.option_verbose @@option_verbose end |
Instance Method Details
#config ⇒ Object
47 48 49 |
# File 'lib/mofa/cli.rb', line 47 def config config_print end |
#provision(cookbook_name_or_path) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/mofa/cli.rb', line 22 def provision(cookbook_name_or_path) set_verbosity cookbook_name_or_path ||= '.' target_filter = [:target] target_filter ||= Mofa::Config.config['profiles']['default']['target'] token = MofaCmd.generate_token hostlist = Hostlist.create(target_filter) cookbook = Cookbook.create(cookbook_name_or_path, token) runlist_map = RunlistMap.create(cookbook, hostlist, token, [:runlist]) mofa_cmd = MofaCmd.create(cookbook, hostlist, runlist_map, token) mofa_cmd.prepare mofa_cmd.execute mofa_cmd.cleanup end |
#setup ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/mofa/cli.rb', line 53 def setup set_verbosity case when !File.exists?("#{ENV['HOME']}/.mofa/config.yml") begin config_create end until config_valid? else begin config_edit end until config_valid? end end |