Class: Humidifier::Reservoir::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/humidifier/reservoir/cli.rb

Overview

A CLI for running commands to manipulate the stacks that Reservoir knows about.

Instance Method Summary collapse

Instance Method Details

#change(name = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/humidifier/reservoir/cli.rb', line 12

def change(name = nil)
  stack_names = stack_names_from(name)
  authorize

  stack_names.each do |stack_name|
    stack = Stack.new(stack_name)
    puts "Creating a changeset for #{stack.stack_name}"
    stack.create_change_set
  end
end

#deploy(name = nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/humidifier/reservoir/cli.rb', line 26

def deploy(name = nil)
  stack_names = stack_names_from(name)
  authorize

  stack_names.each do |stack_name|
    stack = Stack.new(stack_name, prefix: options[:prefix])
    puts "Deploying #{stack.stack_name}"
    stack.deploy(options[:wait])
  end
end

#display(name, pattern = nil) ⇒ Object



38
39
40
# File 'lib/humidifier/reservoir/cli.rb', line 38

def display(name, pattern = nil)
  puts Stack.new(name, pattern: pattern && /#{pattern}/i).to_cf
end

#validate(name = nil) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/humidifier/reservoir/cli.rb', line 43

def validate(name = nil)
  stack_names = stack_names_from(name)
  authorize

  print 'Validating... '
  puts 'Valid.' if stack_names.all? { |stack_name| Stack.new(stack_name).valid? }
end