Class: SplttyCLI::Commands::InstallRunner
- Inherits:
-
Object
- Object
- SplttyCLI::Commands::InstallRunner
- Defined in:
- lib/spltty_cli/commands/install.rb
Overview
Orchestrates the install flow. Extracted from the command so it is unit-testable without going through dry-cli.
Constant Summary collapse
- DEFAULT_LEDGER =
"expenses"- DEFAULT_GROUP =
"Both"
Instance Method Summary collapse
-
#initialize(path, opts) ⇒ InstallRunner
constructor
A new instance of InstallRunner.
- #run ⇒ Object
Constructor Details
#initialize(path, opts) ⇒ InstallRunner
Returns a new instance of InstallRunner.
55 56 57 58 59 |
# File 'lib/spltty_cli/commands/install.rb', line 55 def initialize(path, opts) @root = File.(path.to_s.empty? ? Dir.pwd : path.to_s) @opts = opts @interactive = !opts[:yes] end |
Instance Method Details
#run ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/spltty_cli/commands/install.rb', line 61 def run prepare_root participants = ask_participants group_name, group = ask_group(participants) ledgers = ask_ledgers(participants, group_name) methods = ask_methods(participants, group_name || participants.first) config = write_config(participants, group_name, group, ledgers, methods) ledgers.each { |l| write_ledger(config, l) } write_sources claude_path = write_claude_md(participants, group_name, group, ledgers, methods) maybe_git_init reconcile(config) report(ledgers, claude_path) end |