Class: Demae::CLI

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

Constant Summary collapse

CONFIG_DIR =
'config/demae'

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



9
10
11
12
13
# File 'lib/demae/cli.rb', line 9

def initialize(*)
  super
  Itamae.logger.level = ::Logger.const_get('INFO')
  Itamae.logger.formatter.colored = true
end

Instance Method Details

#apply(environment) ⇒ Object



25
26
27
# File 'lib/demae/cli.rb', line 25

def apply(environment)
  run(environment)
end

#installObject



16
17
18
19
20
21
22
# File 'lib/demae/cli.rb', line 16

def install
  templates_dir = File.expand_path('../templates', __FILE__)
  FileUtils.mkdir_p(CONFIG_DIR)
  %w(staging production).each do |environment|
    FileUtils.copy("#{templates_dir}/environment.yml", config_path(environment))
  end
end

#plan(environment) ⇒ Object



30
31
32
# File 'lib/demae/cli.rb', line 30

def plan(environment)
  run(environment, dry_run: true)
end