bake-modernize 0.11.0 → 0.12.0

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: 012e9e59e04aa7059ad4abf12835bdb6a5d8f35e6b6d76db9981a354fded0822
4
- data.tar.gz: 0d0a46d21507a7740157d5a1821dc519623a3459d9a3c5799a84d3ac423c578f
3
+ metadata.gz: b651d9ec9908359c42ea7d28ac252a68aac3f501747ffd8686d72b2af9092ad8
4
+ data.tar.gz: 51cec1d69dde6eb4793004914fb9ae75e732f1cb742228aaf61392b4a11ab6d9
5
5
  SHA512:
6
- metadata.gz: 217d8a4315aae3596336aca9f095e091a2a6b438af5d676d6b610bcf8ac77c35bea347d38cfea73cf93d0d3262dc9edff2eb83d473f7c9cc07c911eb309d8aea
7
- data.tar.gz: ac4f26b016cbc70611081b911a2e7d53e713949477c546d41c927f6d238115db31ff6b1de80c2906e5233930920cec1bfd4ec4e29739ecd1880438594bbd269c
6
+ metadata.gz: 44fa671dfdb50020b465379804792c01ea58ccfcd03acf8ec7ececea09b72cba68dcf03c9b2ecee34465f4d160c8ee34bbccba5d63b61001333abea940e8fda0
7
+ data.tar.gz: f51cbb00b3ccb8cacc58a76d24fb9d51732506f7d35edf4ac8d54142a01ee4b35bbf88e6f7f307c2a9aaaef4e21e2a0b3ff23e486eee9be9bceea36a8b6f3d43
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,100 @@
1
+
2
+ require 'console'
3
+
4
+ LICENSE = <<~LICENSE
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+ LICENSE
23
+
24
+ # @parameter root [String] The root directory to scan for changes.
25
+ def license
26
+ update(root: Dir.pwd)
27
+ end
28
+
29
+ def update(root:)
30
+ authors = self.authors(root)
31
+
32
+ buffer = StringIO.new
33
+ buffer.puts "# MIT License"
34
+ buffer.puts
35
+
36
+ authors.map do |author, dates|
37
+ years = dates.map(&:year).uniq
38
+
39
+ buffer.puts "Copyright, #{years.join('-')}, by #{author}."
40
+ end
41
+
42
+ buffer.puts
43
+ buffer.puts LICENSE
44
+
45
+ File.open("license.md", "w") do |file|
46
+ file.write(buffer.string)
47
+ end
48
+ end
49
+
50
+ private
51
+
52
+ def authors(root)
53
+ paths = {}
54
+ authors = {}
55
+
56
+ total = `git rev-list --count HEAD`.to_i
57
+
58
+ input, output = IO.pipe
59
+ pid = Process.spawn("git", "log", "--name-only", "--pretty=format:%ad\t%an", out: output, chdir: root)
60
+
61
+ output.close
62
+
63
+ progress = Console.logger.progress(self, total)
64
+
65
+ while header = (input.readline.chomp rescue nil)
66
+ break if header.empty?
67
+ progress.increment
68
+
69
+ date, author = header.split("\t", 2)
70
+ date = Date.parse(date)
71
+
72
+ while path = (input.readline.chomp rescue nil)
73
+ break if path.empty?
74
+
75
+ paths[path] ||= {}
76
+ paths[path][author] ||= []
77
+ paths[path][author] << date
78
+
79
+ authors[author] ||= []
80
+ authors[author] << date
81
+ end
82
+ end
83
+
84
+ input.close
85
+ Process.wait2(pid)
86
+
87
+ paths.each do |path, authors|
88
+ authors.transform_values! do |dates|
89
+ dates.minmax
90
+ end
91
+ end
92
+
93
+ authors.transform_values! do |dates|
94
+ dates.minmax
95
+ end.to_a.sort_by! do |author, dates|
96
+ dates
97
+ end
98
+
99
+ return authors
100
+ end
data/bake/modernize.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  def modernize
3
- call('modernize:git', 'modernize:readme', 'modernize:actions', 'modernize:editorconfig', 'modernize:gemfile', 'modernize:signing', 'modernize:gemspec')
3
+ call('modernize:git', 'modernize:readme', 'modernize:actions', 'modernize:editorconfig', 'modernize:gemfile', 'modernize:signing', 'modernize:gemspec', 'modernize:license')
4
4
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Bake
22
22
  module Modernize
23
- VERSION = "0.11.0"
23
+ VERSION = "0.12.0"
24
24
  end
25
25
  end
@@ -32,7 +32,7 @@ jobs:
32
32
 
33
33
  - name: Run tests
34
34
  timeout-minutes: 5
35
- run: bundle exec rspec
35
+ run: bundle exec bake test
36
36
 
37
37
  - uses: actions/upload-artifact@v2
38
38
  with:
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.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -11,33 +11,34 @@ bindir: bin
11
11
  cert_chain:
12
12
  - |
13
13
  -----BEGIN CERTIFICATE-----
14
- MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
15
- ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
16
- MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
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hwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
39
40
  -----END CERTIFICATE-----
40
- date: 2022-08-06 00:00:00.000000000 Z
41
+ date: 2022-08-18 00:00:00.000000000 Z
41
42
  dependencies:
42
43
  - !ruby/object:Gem::Dependency
43
44
  name: async-http
@@ -135,6 +136,7 @@ files:
135
136
  - bake/modernize/gemfile.rb
136
137
  - bake/modernize/gemspec.rb
137
138
  - bake/modernize/git.rb
139
+ - bake/modernize/license.rb
138
140
  - bake/modernize/readme.rb
139
141
  - bake/modernize/signing.rb
140
142
  - lib/bake/modernize.rb
metadata.gz.sig CHANGED
Binary file