pragmater 2.2.0 → 3.0.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
  SHA1:
3
- metadata.gz: b140b2b4a52f69104b7e2d964c895b9f7da4e749
4
- data.tar.gz: 2f452508c69af0f4a390929266e12ec82a025a88
3
+ metadata.gz: 7b4bd6f366db8087d288d4fc3e9d9c3e338f33b7
4
+ data.tar.gz: 62d0d34268ee450e4c512bf029853a4511ffeb8f
5
5
  SHA512:
6
- metadata.gz: 2a1fa5a959887e86f57b8cb2ed06f65fefc92566ef357b469f5be0692428fed17c3958189023669d5a51a63fb0fe99a8b7e295ca22e861f10d57cf9fe56c981f
7
- data.tar.gz: 128a7a158e19e8db0d3b25e8f539225abe3c80f4a6f44be4f3947b789cb0845b3ad80faacba644da275930f6c02ab2623946a8f8bf4f80cf86c5d3f82928209c
6
+ metadata.gz: 12023ec6ca9e1e888a91e9958c3d627e15726408c419232fc6d5fad3eed53975848c9f8e72e717eac74e1d2094896fdae245e2b4c1a4610dd9835cec7736f0b8
7
+ data.tar.gz: 8940fdf713203c15ee133cc7d776a736d18b0dc34d17cbebf41619310b7e0b8f9b509cce38bb6dfac8787422ff65feba5464ddf227bb6e6960177677a4104fbc
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -56,7 +56,7 @@ or multiple Ruby source files in order to benefit from improved memory and concu
56
56
 
57
57
  # Requirements
58
58
 
59
- 0. [Ruby 2.3.x](https://www.ruby-lang.org)
59
+ 0. [Ruby 2.4.x](https://www.ruby-lang.org)
60
60
 
61
61
  # Setup
62
62
 
data/lib/pragmater/cli.rb CHANGED
@@ -8,6 +8,7 @@ require "runcom"
8
8
 
9
9
  module Pragmater
10
10
  # The Command Line Interface (CLI) for the gem.
11
+ # rubocop:disable Metrics/ClassLength
11
12
  class CLI < Thor
12
13
  include Thor::Actions
13
14
  include ThorPlus::Actions
@@ -33,19 +34,43 @@ module Pragmater
33
34
 
34
35
  desc "-a, [--add=PATH]", "Add pragma comments to source file(s)."
35
36
  map %w[-a --add] => :add
36
- method_option :comments, aliases: "-c", desc: "Pragma comments", type: :array, default: []
37
- method_option :whitelist, aliases: "-w", desc: "File extension whitelist", type: :array, default: []
37
+ method_option :comments,
38
+ aliases: "-c",
39
+ desc: "Pragma comments",
40
+ type: :array,
41
+ default: []
42
+ method_option :whitelist,
43
+ aliases: "-w",
44
+ desc: "File extension whitelist",
45
+ type: :array,
46
+ default: []
38
47
  def add path
39
- settings = self.class.configuration.merge add: {comments: options[:comments], whitelist: options[:whitelist]}
48
+ settings = self.class.configuration.merge add: {
49
+ comments: options[:comments],
50
+ whitelist: options[:whitelist]
51
+ }
52
+
40
53
  write path, settings, :add
41
54
  end
42
55
 
43
56
  desc "-r, [--remove=PATH]", "Remove pragma comments from source file(s)."
44
57
  map %w[-r --remove] => :remove
45
- method_option :comments, aliases: "-c", desc: "Pragma comments", type: :array, default: []
46
- method_option :whitelist, aliases: "-w", desc: "File extension whitelist", type: :array, default: []
58
+ method_option :comments,
59
+ aliases: "-c",
60
+ desc: "Pragma comments",
61
+ type: :array,
62
+ default: []
63
+ method_option :whitelist,
64
+ aliases: "-w",
65
+ desc: "File extension whitelist",
66
+ type: :array,
67
+ default: []
47
68
  def remove path
48
- settings = self.class.configuration.merge remove: {comments: options[:comments], whitelist: options[:whitelist]}
69
+ settings = self.class.configuration.merge remove: {
70
+ comments: options[:comments],
71
+ whitelist: options[:whitelist]
72
+ }
73
+
49
74
  write path, settings, :remove
50
75
  end
51
76
 
@@ -96,11 +121,14 @@ module Pragmater
96
121
  error "#{formatted_message}: #{path}."
97
122
  end
98
123
 
124
+ # rubocop:disable Metrics/ParameterLists
99
125
  def update_files path, comments, whitelist, action
100
126
  if path.file?
101
127
  update_file path, comments, action
102
128
  elsif path.directory?
103
- whitelisted_files(path, whitelist).each { |file_path| update_file file_path, comments, action }
129
+ whitelisted_files(path, whitelist).each do |file_path|
130
+ update_file file_path, comments, action
131
+ end
104
132
  else
105
133
  error %(Invalid source path: "#{path}".)
106
134
  end
@@ -29,14 +29,14 @@ module Pragmater
29
29
  end
30
30
 
31
31
  def format_shebang
32
- return string unless string =~ self.class.shebang_format
32
+ return string unless string.match?(self.class.shebang_format)
33
33
 
34
34
  _, path = string.split "!"
35
35
  "#! #{path.strip}"
36
36
  end
37
37
 
38
38
  def format_pragma
39
- return string unless string =~ self.class.pragma_format
39
+ return string unless string.match?(self.class.pragma_format)
40
40
 
41
41
  key, value = string.split ":"
42
42
  "# #{key.gsub(/\#\s?/, "")}: #{value.strip}"
@@ -12,7 +12,7 @@ module Pragmater
12
12
  end
13
13
 
14
14
  def self.version
15
- "2.2.0"
15
+ "3.0.0"
16
16
  end
17
17
 
18
18
  def self.version_label
@@ -3,6 +3,7 @@
3
3
  module Pragmater
4
4
  # Writes formatted pragma comments to source file.
5
5
  class Writer
6
+ # rubocop:disable Metrics/ParameterLists
6
7
  def initialize file_path, new_comments, formatter: Formatter, commenter: Commenter
7
8
  @file_path = file_path
8
9
  @file_lines = File.open(file_path).to_a
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pragmater
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -30,7 +30,7 @@ cert_chain:
30
30
  n/LUZ1dKhIHzfKx1B4+TEIefArObGfkLIDM8+Dq1RX7TF1k81Men7iu4MgE9bYBn
31
31
  3dE+xI3FdB5gWcdWxdtgRCmWjtXeYYyb4z6NQQ==
32
32
  -----END CERTIFICATE-----
33
- date: 2016-12-18 00:00:00.000000000 Z
33
+ date: 2017-01-22 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: thor
@@ -52,28 +52,28 @@ dependencies:
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '4.1'
55
+ version: '5.0'
56
56
  type: :runtime
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '4.1'
62
+ version: '5.0'
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: runcom
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.3'
69
+ version: '0.5'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0.3'
76
+ version: '0.5'
77
77
  - !ruby/object:Gem::Dependency
78
78
  name: rake
79
79
  requirement: !ruby/object:Gem::Requirement
@@ -88,20 +88,6 @@ dependencies:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: '12.0'
91
- - !ruby/object:Gem::Dependency
92
- name: gemsmith
93
- requirement: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '8.2'
98
- type: :development
99
- prerelease: false
100
- version_requirements: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - "~>"
103
- - !ruby/object:Gem::Version
104
- version: '8.2'
105
91
  - !ruby/object:Gem::Dependency
106
92
  name: pry
107
93
  requirement: !ruby/object:Gem::Requirement
@@ -248,14 +234,14 @@ dependencies:
248
234
  requirements:
249
235
  - - "~>"
250
236
  - !ruby/object:Gem::Version
251
- version: '0.46'
237
+ version: '0.47'
252
238
  type: :development
253
239
  prerelease: false
254
240
  version_requirements: !ruby/object:Gem::Requirement
255
241
  requirements:
256
242
  - - "~>"
257
243
  - !ruby/object:Gem::Version
258
- version: '0.46'
244
+ version: '0.47'
259
245
  - !ruby/object:Gem::Dependency
260
246
  name: codeclimate-test-reporter
261
247
  requirement: !ruby/object:Gem::Requirement
@@ -301,7 +287,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
301
287
  requirements:
302
288
  - - "~>"
303
289
  - !ruby/object:Gem::Version
304
- version: '2.3'
290
+ version: '2.4'
305
291
  required_rubygems_version: !ruby/object:Gem::Requirement
306
292
  requirements:
307
293
  - - ">="
@@ -309,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
295
  version: '0'
310
296
  requirements: []
311
297
  rubyforge_project:
312
- rubygems_version: 2.6.8
298
+ rubygems_version: 2.6.9
313
299
  signing_key:
314
300
  specification_version: 4
315
301
  summary: A command line interface for managing/formatting source file pragma comments.
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- yv��Yf՜޻�bL�Az.���``C n�05�\qqšU"���r!�R��{MV��׀��h�����GkJ_���ٱrC1O������ءs���D���ߝ��l���������sRF7_�n�K�)QM^���m4� S����ʳ��:s�͆�,�h'������ ɋ������p@�])Lk��ff���e u7��W�2��!�M���,�Φ�ibp���B�Xk�E]x���P4���(
1
+ o ��+����5��!O��A0b7MM޺���T4t %��%2Z�$�x�+K���jZj����,j{��w���&NY,�|��TjiL�C2�Jq(&�o�EI�1s�\��c)R�)S+j�!̦ k`��^*�A
2
+ �Z�3](�L.�L��n��쿄\Hnـ��?��#�h�ۍ��Q�pS'5y�8��J�i/@r�w�z�=A�ڣ ������R�U7������AR���g�&�