bake-modernize 0.13.1 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/modernize/frozen_string_literal.rb +53 -0
- data/bake/modernize/license.rb +1 -1
- data/bake/modernize.rb +1 -1
- data/lib/bake/modernize/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +3 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4534d97da05e1d34a66c14d1d923d30e1397301afd743b97f090650b23b6aa1
|
4
|
+
data.tar.gz: c04a221171e6ddd346356f2816454b3fcd211adb5515570ce3b452e4969905ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f96f05c129bbc247cd998acbe596a113029688f82156ed0663f80030fcdc8c0097bf7f0c3d55602043024d0c566bd29d7ac9d8e5e233b2c5cd014ff66cd66bb
|
7
|
+
data.tar.gz: f91699bc8222e821353cdd415e941c1da9196e46ad6641c806aff7536505c025159e3824efbf2b083236efc87244cba635e12c983c495f0ad2bb82b5f80ef222
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2022, by Samuel Williams.
|
5
|
+
|
6
|
+
def frozen_string_literal
|
7
|
+
update(root: Dir.pwd)
|
8
|
+
end
|
9
|
+
|
10
|
+
def update(root:)
|
11
|
+
Dir.glob("**/*.rb", base: root).each do |path|
|
12
|
+
case path
|
13
|
+
when /\.rb$/
|
14
|
+
update_source_file(path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def update_source_file(path)
|
22
|
+
input = File.readlines(path)
|
23
|
+
output = []
|
24
|
+
|
25
|
+
# Skip the hash-bang line:
|
26
|
+
if input.first =~ /^\#!/
|
27
|
+
output.push input.shift
|
28
|
+
end
|
29
|
+
|
30
|
+
options = {}
|
31
|
+
|
32
|
+
while input.first =~ /^\#\s*(.*?):(.*)$/
|
33
|
+
options[$1.strip] = $2.strip
|
34
|
+
input.shift
|
35
|
+
end
|
36
|
+
|
37
|
+
options['frozen_string_literal'] ||= 'true'
|
38
|
+
|
39
|
+
options.each do |key, value|
|
40
|
+
output.push "# #{key}: #{value}"
|
41
|
+
end
|
42
|
+
|
43
|
+
unless input.first&.chomp&.empty?
|
44
|
+
output.push "\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
# Add the rest of the file:
|
48
|
+
output.push(*input)
|
49
|
+
|
50
|
+
File.open(path, "w") do |file|
|
51
|
+
file.puts(output)
|
52
|
+
end
|
53
|
+
end
|
data/bake/modernize/license.rb
CHANGED
data/bake/modernize.rb
CHANGED
@@ -4,5 +4,5 @@
|
|
4
4
|
# Copyright, 2020-2022, by Samuel Williams.
|
5
5
|
|
6
6
|
def modernize
|
7
|
-
call('modernize:git', 'modernize:readme', 'modernize:actions', 'modernize:editorconfig', 'modernize:gemfile', 'modernize:signing', 'modernize:gemspec', 'modernize:license')
|
7
|
+
call('modernize:git', 'modernize:readme', 'modernize:actions', 'modernize:editorconfig', 'modernize:gemfile', 'modernize:signing', 'modernize:gemspec', 'modernize:license', 'modernize:frozen_string_literal')
|
8
8
|
end
|
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.13.
|
4
|
+
version: 0.13.4
|
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-08-
|
41
|
+
date: 2022-08-26 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: async-http
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- bake/modernize.rb
|
134
134
|
- bake/modernize/actions.rb
|
135
135
|
- bake/modernize/editorconfig.rb
|
136
|
+
- bake/modernize/frozen_string_literal.rb
|
136
137
|
- bake/modernize/gemfile.rb
|
137
138
|
- bake/modernize/gemspec.rb
|
138
139
|
- bake/modernize/git.rb
|
metadata.gz.sig
CHANGED
Binary file
|