Skip to content

Commit

Permalink
ci(metacacher): Print out hash in segments
Browse files Browse the repository at this point in the history
  • Loading branch information
ribose-jeffreylau committed Feb 5, 2025
1 parent 837ef52 commit c47158b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions scripts/metacacher
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ JEKYLL_DEPENDENCIES = RUBY_DEPENDENCIES + %w(
relaton
)

def get_fingerprint(*segments)
segments.join('-')
end

def parse_command(args)
case args[0]
when 'jekyll' then
Expand All @@ -92,7 +96,10 @@ def parse_command(args)
@dependencies << jekyll_yaml
@dependencies += JEKYLL_DEPENDENCIES

hash_files @dependencies
puts get_fingerprint(
'jekyll',
hash_files(@dependencies),
)

when 'metanorma' then
args.shift
Expand All @@ -108,7 +115,10 @@ def parse_command(args)
require 'yaml'
@dependencies += YAML.load_file(metanorma_yaml).dig('metanorma', 'source', 'files')

hash_files @dependencies
puts get_fingerprint(
'metanorma',
hash_files(@dependencies),
)

when 'version' then
puts "#{$0} v#{VERSION}"
Expand All @@ -125,9 +135,9 @@ def hash_files(args)
require 'open3'
stdout_str, stderr_str, status = Open3.capture3(HASH_FILES_BIN, *args)

# Re-echo stdout and stderr
# Re-echo stderr
STDERR.puts stderr_str
puts stdout_str
stdout_str
end

def print_usage
Expand Down

0 comments on commit c47158b

Please sign in to comment.