Class: Ace::GitCommit::Organisms::CommitOrchestrator
- Inherits:
-
Object
- Object
- Ace::GitCommit::Organisms::CommitOrchestrator
- Defined in:
- lib/ace/git_commit/organisms/commit_orchestrator.rb
Overview
CommitOrchestrator coordinates the entire commit process
Constant Summary collapse
- DEFAULT_SCOPE_NAME =
Reference the default scope name constant
Ace::Support::Config::Models::ConfigGroup::DEFAULT_SCOPE_NAME
Instance Method Summary collapse
-
#execute(options) ⇒ Boolean
Execute the commit process.
-
#initialize(config = nil) ⇒ CommitOrchestrator
constructor
A new instance of CommitOrchestrator.
Constructor Details
#initialize(config = nil) ⇒ CommitOrchestrator
Returns a new instance of CommitOrchestrator.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ace/git_commit/organisms/commit_orchestrator.rb', line 10 def initialize(config = nil) @config = config || load_config @git = Atoms::GitExecutor.new @diff_analyzer = Molecules::DiffAnalyzer.new(@git) @file_stager = Molecules::FileStager.new(@git) @path_resolver = Molecules::PathResolver.new(@git) = Molecules::MessageGenerator.new(@config) @commit_grouper = Molecules::CommitGrouper.new @split_commit_executor = Molecules::SplitCommitExecutor.new( git_executor: @git, diff_analyzer: @diff_analyzer, file_stager: @file_stager, message_generator: ) end |
Instance Method Details
#execute(options) ⇒ Boolean
Execute the commit process
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ace/git_commit/organisms/commit_orchestrator.rb', line 29 def execute() validate_repository! if .debug puts "Debug: Commit options:" .to_h.each { |k, v| puts " #{k}: #{v.inspect}" } end # Stage files if needed staging_result = stage_changes() # Stop if staging failed unless staging_result puts "\nCannot proceed with commit due to staging failure" unless .quiet return false end # Ensure we have changes to commit has_staged_changes = @git.has_staged_changes? unless has_staged_changes puts "No changes to commit" unless .quiet return true end puts "✓ Changes staged successfully" if .stage_all? && !.quiet staged_files = @file_stager.staged_files groups = @commit_grouper.group(staged_files, project_root: @git.repository_root) if .no_split = (, config_override: @config) return handle_single_commit(, ) end if groups.length > 1 display_split_summary(groups) unless .quiet result = @split_commit_executor.execute(groups, ) return result.success? end group_config = groups.first ? groups.first.config : @config = (, config_override: group_config) handle_single_commit(, ) end |