bake/modernize/gemspec.rb in bake-modernize-0.17.4 vs bake/modernize/gemspec.rb in bake-modernize-0.17.5

- old
+ new

@@ -31,11 +31,11 @@ .join("::") spec.metadata["funding_uri"] ||= detect_funding_uri(spec) spec.metadata["documentation_uri"] ||= detect_documentation_uri(spec) - spec.authors = sorted_authors(spec) + spec.authors = sorted_authors(Dir.pwd) spec.metadata.delete_if{|_, value| value.nil?} output.puts "# frozen_string_literal: true" output.puts @@ -218,26 +218,14 @@ return documentation_uri end end end -def sorted_authors(spec) - input, output = IO.pipe +def sorted_authors(root) + authorship = Bake::Modernize::License::Authorship.new + authorship.extract(root) - pid = Process.spawn("git", "log", "--format=%aN", out: output) - output.close - - authors = Hash.new{|h,k| h[k] = 0} - - input.each_line do |author| - author = author.chomp! - authors[author] += 1 - end - - Process.wait(pid) - input.close - - return authors.sort_by{|k,v| [-v, k]}.map(&:first) + return authorship.sorted_authors end IGNORE_GEMS = %w[ bundler ].freeze