Module: Formatron::CLI::Deploy
- Defined in:
- lib/formatron/cli/deploy.rb
Overview
CLI command for deploy
Instance Method Summary collapse
- #deploy_action(c) ⇒ Object
- #deploy_credentials(options) ⇒ Object
- #deploy_directory(options) ⇒ Object
- #deploy_formatron_command ⇒ Object
- #deploy_ok(options, formatron, target) ⇒ Object
- #deploy_target(target, directory) ⇒ Object
Instance Method Details
#deploy_action(c) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/formatron/cli/deploy.rb', line 34 def deploy_action(c) c.action do |args, | directory = deploy_directory target = deploy_target args[0], directory formatron = Formatron.new( credentials: deploy_credentials(), directory: directory, target: target ) formatron.deploy if deploy_ok , formatron, target end end |
#deploy_credentials(options) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/formatron/cli/deploy.rb', line 12 def deploy_credentials() .credentials || Generators::Credentials.default_credentials( deploy_directory() ) end |
#deploy_directory(options) ⇒ Object
8 9 10 |
# File 'lib/formatron/cli/deploy.rb', line 8 def deploy_directory() .directory || Dir.pwd end |
#deploy_formatron_command ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/formatron/cli/deploy.rb', line 47 def deploy_formatron_command command :deploy do |c| c.syntax = 'formatron deploy [options] [TARGET]' c.summary = 'Deploy or update a Formatron stack' c.description = 'Deploy or update a Formatron stack' deploy_action c end end |
#deploy_ok(options, formatron, target) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/formatron/cli/deploy.rb', line 26 def deploy_ok(, formatron, target) .yes || !formatron.protected? || agree( "Are you sure you wish to deploy protected target: #{target}?" ) do |q| q.default = 'no' end end |