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
86 87 88 |
# File 'lib/mofa/cli.rb', line 86 def self.option_debug @@option_debug end |
.option_verbose ⇒ Object
82 83 84 |
# File 'lib/mofa/cli.rb', line 82 def self.option_verbose @@option_verbose end |
Instance Method Details
#provision(cookbook_name_or_path) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mofa/cli.rb', line 31 def provision(cookbook_name_or_path) set_verbosity cookbook_name_or_path ||= '.' token = MofaCmd.generate_token hostlist = Hostlist.create([:concrete_target]) cookbook = Cookbook.create(cookbook_name_or_path, token, [:override_mofa_secrets]) 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([:ssh_port], [:ssh_user], [:ssh_keyfile]) cmd.cleanup end |
#upload(cookbook_path) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/mofa/cli.rb', line 60 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 # FIXME: bring in the ssh-port in a different way cmd.execute(22) cmd.cleanup end |
#version ⇒ Object
78 79 80 |
# File 'lib/mofa/cli.rb', line 78 def version puts VERSION end |