Class: Eien::CLI::Deploy

Inherits:
CLI
  • Object
show all
Defined in:
lib/eien/cli/deploy.rb

Instance Method Summary collapse

Methods inherited from CLI

exit_on_failure?

Instance Method Details

#applyObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/eien/cli/deploy.rb', line 33

def apply
  rescue_and_exit do
    context = ::Eien.context_or_default(options[:context])
    app = ::Eien.app_or_default(options[:app])

    require_context!(context)
    require_app!(app)

    ::Eien::Deploy::ApplyTask.new(
      context,
      app,
    ).run!
  end
end

#generateObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/eien/cli/deploy.rb', line 11

def generate
  rescue_and_exit do
    context = ::Eien.context_or_default(options[:context])
    app = ::Eien.app_or_default(options[:app])

    require_context!(context)
    require_app!(app)

    resources = ::Eien::Deploy::GenerateTask.new(
      context,
      app,
    ).run!
    puts resources
      .map(&:to_h)
      .map(&:deep_stringify_keys)
      .map(&:to_yaml)
      .join("\n")
  end
end