Class: Space::Core::CLI::Pack
- Inherits:
-
BaseCommand
- Object
- Dry::CLI::Command
- BaseCommand
- Space::Core::CLI::Pack
- Defined in:
- lib/space_core/cli/pack.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(output: nil, **opts) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/space_core/cli/pack.rb', line 12 def call(output: nil, **opts) setup_terminal(**opts.slice(:color, :colors)) handle_errors do result = store.current.bind do |space| out_dir = output ? Pathname.new(output). : space.path.join("build", "oci") Space::Core::OciPacker.new(space: space, output_dir: out_dir).generate .fmap { |dir| { space: space, dir: dir } } end render(result) do |r| terminal.success "Generated OCI context: #{r[:dir]}" terminal.say "Build: docker build -f #{r[:dir]}/Dockerfile -t #{r[:space].id}:latest ." terminal.say " (run from: #{r[:space].path})" CLI.record_outcome(Outcome.new(exit_code: 0)) end end end |