Skip to content
This repository was archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Add debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
floriandejonckheere committed Mar 29, 2024
1 parent e12e917 commit dc08ba3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/mosaik/collectors/history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def call
git = Git.open(MOSAIK.options.directory, log: ::Logger.new(File::NULL))

# Fetch commits, limited to the last 1000 commits
commits = git.log(10)
commits = git.log(100)

# Limit commits to the load paths
commits = commits.path(MOSAIK.configuration.load_paths.map { |l| File.join(MOSAIK.options.directory, l) })
Expand Down Expand Up @@ -44,6 +44,8 @@ def call
.each { |(a, b)| matrix[a][b] += 1 }
end

debug "Building graph..."

# For each non-zero element in the matrix, add an edge to the graph
matrix.each do |a, row|
row.each do |b, value|
Expand Down
4 changes: 4 additions & 0 deletions lib/mosaik/commands/collect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,16 @@ def start
.new(options, graph)
.call

debug "Writing graph..."

# Write the graph to a file
graph.output(dot: options[:output])
info "Graph written to #{options[:output]}"

return unless options[:render]

debug "Rendering graph..."

# Render the graph to a PNG image
graph.output(png: "#{File.basename(options[:output], '.dot')}.png")
info "Graph rendered to #{"#{File.basename(options[:output], '.dot')}.png"}"
Expand Down

0 comments on commit dc08ba3

Please sign in to comment.