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
- #config ⇒ Object
- #provision(cookbook_name_or_path) ⇒ Object
- #setup ⇒ Object
- #upload(cookbook_path) ⇒ Object
- #version ⇒ Object
Methods included from Config
Class Method Details
.option_debug ⇒ Object
106 107 108 |
# File 'lib/mofa/cli.rb', line 106 def self.option_debug @@option_debug end |
.option_verbose ⇒ Object
102 103 104 |
# File 'lib/mofa/cli.rb', line 102 def self.option_verbose @@option_verbose end |
Instance Method Details
#config ⇒ Object
81 82 83 |
# File 'lib/mofa/cli.rb', line 81 def config config_print end |
#provision(cookbook_name_or_path) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/mofa/cli.rb', line 26 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, [:service_hostlist_url], [:concrete_target]) cookbook = Cookbook.create(cookbook_name_or_path, token) runlist_map = RunlistMap.create(cookbook, hostlist, token, [:runlist]) attributes_map = AttributesMap.create(cookbook, hostlist, token, [:runlist], [:attributes]) cmd = ProvisionCmd.new(token, cookbook) cmd.hostlist = hostlist cmd.runlist_map = runlist_map cmd.attributes_map = attributes_map cmd. = cmd.prepare cmd.execute cmd.cleanup end |
#setup ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/mofa/cli.rb', line 87 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 |
#upload(cookbook_path) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/mofa/cli.rb', line 58 def upload(cookbook_path) set_verbosity cookbook_path ||= '.' token = MofaCmd.generate_token cookbook = Cookbook.create(cookbook_path, token) cmd = UploadCmd.new(token, cookbook) cmd.prepare cmd.execute cmd.cleanup end |
#version ⇒ Object
75 76 77 |
# File 'lib/mofa/cli.rb', line 75 def version puts VERSION end |