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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +1 -1
- data/lib/pragmater/cli.rb +35 -7
- data/lib/pragmater/formatter.rb +2 -2
- data/lib/pragmater/identity.rb +1 -1
- data/lib/pragmater/writer.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +10 -24
- metadata.gz.sig +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b4bd6f366db8087d288d4fc3e9d9c3e338f33b7
|
4
|
+
data.tar.gz: 62d0d34268ee450e4c512bf029853a4511ffeb8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12023ec6ca9e1e888a91e9958c3d627e15726408c419232fc6d5fad3eed53975848c9f8e72e717eac74e1d2094896fdae245e2b4c1a4610dd9835cec7736f0b8
|
7
|
+
data.tar.gz: 8940fdf713203c15ee133cc7d776a736d18b0dc34d17cbebf41619310b7e0b8f9b509cce38bb6dfac8787422ff65feba5464ddf227bb6e6960177677a4104fbc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
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,
|
37
|
-
|
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: {
|
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,
|
46
|
-
|
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: {
|
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
|
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
|
data/lib/pragmater/formatter.rb
CHANGED
@@ -29,14 +29,14 @@ module Pragmater
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def format_shebang
|
32
|
-
return string unless string
|
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
|
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}"
|
data/lib/pragmater/identity.rb
CHANGED
data/lib/pragmater/writer.rb
CHANGED
@@ -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:
|
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:
|
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: '
|
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: '
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|
-
|
1
|
+
o��+����5��!O��A�0b7�MM���T4�t %��%2Z�$�x�+K���j�Zj����,j{��w���&NY,�|��T�j�iL�C2�Jq(&�o�EI�1�s�\��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�&�
|