bake-modernize 0.13.1 → 0.13.4

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: a5383d60aadbc5f2385c81dd7a03fba4f571baee7f4286d9dfedca1eee1497a9
4
- data.tar.gz: cc5e62ac4f60879e04d4f73530ca47cac892fd7baa05f31e4d8783ee5df6d0e0
3
+ metadata.gz: e4534d97da05e1d34a66c14d1d923d30e1397301afd743b97f090650b23b6aa1
4
+ data.tar.gz: c04a221171e6ddd346356f2816454b3fcd211adb5515570ce3b452e4969905ae
5
5
  SHA512:
6
- metadata.gz: 76f7fec9e1bae6e30ece5a08fbb88dc10904f8507d81eb86a45ff8b32d755b9ac6f44b3076662f450cfc724351b0146255648e68df7107fce560e3a284c88835
7
- data.tar.gz: 869556c76b862400d67420e808b2ba94a85a78b3caf0924e6eb79bb883ecefb6e57ca2ce6f7ee8a79b1c9807107aaff059a9d70f8fb7430e19bb89da09f6dde3
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
@@ -84,7 +84,7 @@ def update_source_file_authors(path, authors)
84
84
  end
85
85
 
86
86
  # Remove any empty lines:
87
- while input.first.chomp.empty?
87
+ while input.first&.chomp&.empty?
88
88
  input.shift
89
89
  end
90
90
 
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
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Bake
7
7
  module Modernize
8
- VERSION = "0.13.1"
8
+ VERSION = "0.13.4"
9
9
  end
10
10
  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.1
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-25 00:00:00.000000000 Z
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