bake-modernize 0.14.0 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23c20cae9dae81e435771d980f8c7944a78e818809cca3161ac428d94fd690f6
4
- data.tar.gz: 1bb494fe765f62e0da2ad5b4a690e519499acc01db7e19ec66949d574cb83a7b
3
+ metadata.gz: d59918cbe614fb303d0eb679b167205430ba98ad6584fb24408466a7d1a4da7a
4
+ data.tar.gz: 8a0fa7d2d03cd7851fabc5a38812f01e61704229a7be2caee72cc75769a7def9
5
5
  SHA512:
6
- metadata.gz: f287b0e61d32d6d3f9b60e6b93a796a3de8529581617691b6bfc784a5a6f30e9c7405b994736d5c0cbed774a89371431fd2b2202ec044b92705a06e981ed390c
7
- data.tar.gz: e36f6ef0a58d24e8196726d732fdb2b4d09643ea299636ff66279b326e2eccd07c47ab1387c903edb03442dc540b93118b8ca811123040a6d030014e4490ee4e
6
+ metadata.gz: 61d8594e2e976bd22619bbb34016c96e8fcd1622adba9610105a64c86ff06809405d6b16cd57a46215bb5b1262fbad05f2f6597dd1acaa991edaeb520bd1be57
7
+ data.tar.gz: b8db4b4096a4a409d179062c8652d2f10f6394fa92ca6bed74d82b7693dd1ada770f106f191014269183a0a07ce2ef8b1a63dc8625c7e60d0e163081ed0413e6
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2021-2022, by Samuel Williams.
4
+ # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  require 'bake/modernize'
7
7
 
@@ -10,7 +10,7 @@ def git
10
10
  end
11
11
 
12
12
  def update(root:)
13
- if current_branch != "main"
13
+ if current_branch == "master"
14
14
  # https://github.com/github/renaming
15
15
  system("git", "branch", "-M", "main")
16
16
  system("git", "push", "-u", "origin", "main")
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2022, by Samuel Williams.
5
5
 
6
6
  require 'rugged'
7
+ require 'yaml'
7
8
 
8
9
  module Bake
9
10
  module Modernize
@@ -42,6 +43,35 @@ module Bake
42
43
  end
43
44
  end
44
45
 
46
+ class Contributors
47
+ # The default path is the root of the repository and for authors who have contributed to the entire repository or unspecified paths in the past.
48
+ DEFAULT_PATH = '.'
49
+
50
+ def self.for(root)
51
+ full_path = File.join(root, '.contributors.yaml')
52
+
53
+ if File.exist?(full_path)
54
+ contributors = self.new
55
+ contributors.extract(full_path)
56
+ return contributors
57
+ end
58
+ end
59
+
60
+ def initialize
61
+ @contributions = []
62
+ end
63
+
64
+ def each(&block)
65
+ @contributions.each do |contribution|
66
+ yield (contribution[:path] || DEFAULT_PATH), contribution[:author], contribution[:time]
67
+ end
68
+ end
69
+
70
+ def extract(path)
71
+ YAML.load_file(path, aliases: true, symbolize_names: true)
72
+ end
73
+ end
74
+
45
75
  class Authorship
46
76
  Modification = Struct.new(:author, :time, :path) do
47
77
  def full_name
@@ -66,9 +96,20 @@ module Bake
66
96
 
67
97
  attr :paths
68
98
 
99
+ def add(author, time, path)
100
+ @paths[path] ||= []
101
+ @paths[path] << Modification.new(author, time, path)
102
+ end
103
+
69
104
  def extract(root = Dir.pwd)
70
105
  mailmap = Mailmap.for(root)
71
106
 
107
+ if contributors = Contributors.for(root)
108
+ contributors.each do |author, time, path|
109
+ add(author, time, path)
110
+ end
111
+ end
112
+
72
113
  walk(Rugged::Repository.discover(root), mailmap: mailmap)
73
114
 
74
115
  return self
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Bake
7
7
  module Modernize
8
- VERSION = "0.14.0"
8
+ VERSION = "0.14.2"
9
9
  end
10
10
  end
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2020-2022, by Samuel Williams.
3
+ Copyright, 2020-2023, by Samuel Williams.
4
4
  Copyright, 2021-2022, by Olle Jonsson.
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -21,7 +21,7 @@ jobs:
21
21
  - macos
22
22
 
23
23
  ruby:
24
- - "3.1"
24
+ - "3.2"
25
25
 
26
26
  steps:
27
27
  - uses: actions/checkout@v3
@@ -47,7 +47,7 @@ jobs:
47
47
  - uses: actions/checkout@v3
48
48
  - uses: ruby/setup-ruby@v1
49
49
  with:
50
- ruby-version: "3.1"
50
+ ruby-version: "3.2"
51
51
  bundler-cache: true
52
52
 
53
53
  - uses: actions/download-artifact@v3
@@ -32,7 +32,7 @@ jobs:
32
32
 
33
33
  - uses: ruby/setup-ruby@v1
34
34
  with:
35
- ruby-version: "3.1"
35
+ ruby-version: "3.2"
36
36
  bundler-cache: true
37
37
 
38
38
  - name: Installing packages
@@ -23,6 +23,7 @@ jobs:
23
23
  - "2.7"
24
24
  - "3.0"
25
25
  - "3.1"
26
+ - "3.2"
26
27
 
27
28
  steps:
28
29
  - uses: actions/checkout@v3
@@ -24,6 +24,7 @@ jobs:
24
24
  - "2.7"
25
25
  - "3.0"
26
26
  - "3.1"
27
+ - "3.2"
27
28
 
28
29
  experimental: [false]
29
30
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-modernize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,7 +38,7 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2022-09-02 00:00:00.000000000 Z
41
+ date: 2023-01-17 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: async-http
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  requirements: []
175
- rubygems_version: 3.3.7
175
+ rubygems_version: 3.4.1
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: Automatically modernize parts of your project/gem.
metadata.gz.sig CHANGED
Binary file