Class: SpaceArchitect::CLI::Init
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- SpaceArchitect::CLI::Init
- Includes:
- GlobalOptions, Helpers
- Defined in:
- lib/space_architect/cli/init.rb
Instance Method Summary collapse
Methods included from Helpers
#display_date, #handle_errors, #project_config, #render, #setup_terminal, #state, #store, #terminal
Methods included from GlobalOptions
Instance Method Details
#call(force: false, **opts) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/space_architect/cli/init.rb', line 12 def call(force: false, **opts) setup_terminal(**opts.slice(:color, :colors)) handle_errors do if force @project_config = SpaceArchitect::Config.new @state = SpaceArchitect::State.new project_config.save state.save else project_config.ensure_exists! state.ensure_exists! end FileUtils.mkdir_p(project_config.spaces_dir) terminal.success "Config: #{terminal.path(project_config.path)}" terminal.success "State: #{terminal.path(state.path)}" terminal.success "Spaces: #{terminal.path(project_config.spaces_dir)}" CLI.record_outcome(Outcome.new(exit_code: 0)) end end |