Module: Formatron::CLI::Provision
- Defined in:
- lib/formatron/cli/provision.rb
Overview
CLI command for provision
Instance Method Summary collapse
-
#provision_action(c) ⇒ Object
rubocop:disable Metrics/MethodLength.
- #provision_credentials(options) ⇒ Object
- #provision_directory(options) ⇒ Object
-
#provision_formatron_command ⇒ Object
rubocop:enable Metrics/MethodLength.
- #provision_ok(options, formatron, target) ⇒ Object
- #provision_options(c) ⇒ Object
- #provision_target(target, directory) ⇒ Object
Instance Method Details
#provision_action(c) ⇒ Object
rubocop:disable Metrics/MethodLength
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/formatron/cli/provision.rb', line 44 def provision_action(c) c.action do |args, | directory = provision_directory target = provision_target args[0], directory formatron = Formatron.new( credentials: provision_credentials(), directory: directory, target: target ) formatron.provision( guid: .guid ) if provision_ok , formatron, target end end |
#provision_credentials(options) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/formatron/cli/provision.rb', line 21 def provision_credentials() .credentials || Generators::Credentials.default_credentials( deploy_directory() ) end |
#provision_directory(options) ⇒ Object
17 18 19 |
# File 'lib/formatron/cli/provision.rb', line 17 def provision_directory() .directory || Dir.pwd end |
#provision_formatron_command ⇒ Object
rubocop:enable Metrics/MethodLength
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/formatron/cli/provision.rb', line 60 def provision_formatron_command command :provision do |c| c.syntax = 'formatron provision [options] [TARGET]' c.summary = 'Provision the instances in a Formatron ' \ 'stack using Opscode Chef' c.description = 'Provision the instances in a Formatron ' \ 'stack using Opscode Chef' c provision_action c end end |
#provision_ok(options, formatron, target) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/formatron/cli/provision.rb', line 35 def provision_ok(, formatron, target) .yes || !formatron.protected? || agree( "Are you sure you wish to provision protected target: #{target}?" ) do |q| q.default = 'no' end end |
#provision_options(c) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/formatron/cli/provision.rb', line 8 def (c) c.option( '-g', '--guid STRING', 'The guid of an instance to provision ' \ '(will provision all instances if not specified)' ) end |