Class: Space::Core::CLI::Build

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/space_core/cli/build.rb

Instance Method Summary collapse

Methods included from Helpers

#display_date, #handle_errors, #project_config, #render, #setup_terminal, #state, #store, #terminal

Instance Method Details

#call(**opts) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/space_core/cli/build.rb', line 10

def call(**opts)
  setup_terminal(**opts.slice(:color, :colors))
  handle_errors do
    result = store.current.bind do |space|
      out_dir = space.path.join("build", "oci")
      Space::Core::OciPacker.new(space: space, output_dir: out_dir).generate.bind do
        Space::Core::OciBuilder.new(space: space, output_dir: out_dir).command
      end
    end
    render(result) do |argv|
      terminal.say "Building: #{argv.join(' ')}"
      out.flush
      Kernel.exec(*argv)
    end
  end
end