pragmater 1.2.0 → 1.3.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 +27 -13
- data/lib/pragmater/cli.rb +9 -10
- data/lib/pragmater/identity.rb +1 -1
- data.tar.gz.sig +2 -3
- metadata +19 -61
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e86d124630ff11d3a04bed3059baa0875a36dbee
|
4
|
+
data.tar.gz: f5961efc8428ed964111a6f5437b5b095e9a9857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99fc8efe9b5f937cc2ad5f0c6e85ff8aab88a5e881da0d7f7a5c105c926b06489c1c0a4052c6f5ce8783ed509815ba762b5d0f01943813cf8166eb213f90e1c9
|
7
|
+
data.tar.gz: add8946a9e598585554ca4d01fba1797722692e26b92bd5a393f7c54264a10988cf2e16023965e26bea1e506a87a2da4f74e0922c29380f360dcad59473e59ec
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -14,9 +14,9 @@ pragma](https://en.wikipedia.org/wiki/Directive_(programming)) comments (a.k.a.
|
|
14
14
|
# frozen_string_literal: true
|
15
15
|
# encoding: UTF-8
|
16
16
|
|
17
|
-
With
|
18
|
-
|
19
|
-
|
17
|
+
With [Ruby 2.3.0](https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released), frozen strings are supported via a
|
18
|
+
pragma comment. This gem provides an easy way to add pragma comments to single or multiple Ruby source files in order
|
19
|
+
to benefit from improved memory and concurrency performance.
|
20
20
|
|
21
21
|
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
22
22
|
|
@@ -30,6 +30,7 @@ multiple Ruby source files in order to benefit from improved memory and concurre
|
|
30
30
|
- [Command Line Interface (CLI)](#command-line-interface-cli)
|
31
31
|
- [Customization](#customization)
|
32
32
|
- [Frozen String Literals](#frozen-string-literals)
|
33
|
+
- [Available Comments](#available-comments)
|
33
34
|
- [Tests](#tests)
|
34
35
|
- [Versioning](#versioning)
|
35
36
|
- [Code of Conduct](#code-of-conduct)
|
@@ -46,7 +47,7 @@ multiple Ruby source files in order to benefit from improved memory and concurre
|
|
46
47
|
- Supports removing a pragma comment or multiple pragma comments from single or multiple source files.
|
47
48
|
- Supports whitelist filtering. Defaults to any file.
|
48
49
|
- Ensures duplicate pragma comments never exist.
|
49
|
-
- Ensures pragma comments are
|
50
|
+
- Ensures pragma comments are consistently formatted.
|
50
51
|
|
51
52
|
# Screencasts
|
52
53
|
|
@@ -76,13 +77,14 @@ For an insecure install, type the following (not recommended):
|
|
76
77
|
|
77
78
|
From the command line, type: `pragmater help`
|
78
79
|
|
79
|
-
pragmater -a, [--add=
|
80
|
-
pragmater -e, [--edit]
|
81
|
-
pragmater -h, [--help=
|
82
|
-
pragmater -r, [--remove=
|
83
|
-
pragmater -v, [--version]
|
80
|
+
pragmater -a, [--add=PATH] # Add pragma comments to source file(s).
|
81
|
+
pragmater -e, [--edit] # Edit gem settings in default editor.
|
82
|
+
pragmater -h, [--help=COMMAND] # Show this message or get help for a command.
|
83
|
+
pragmater -r, [--remove=PATH] # Remove pragma comments from source file(s).
|
84
|
+
pragmater -v, [--version] # Show gem version.
|
84
85
|
|
85
|
-
Both the `--add` and `--remove`
|
86
|
+
Both the `--add` and `--remove` commands support options for specifying pragma comments and/or whitelisted files
|
87
|
+
(viewable by running `pragmater --help --add` or `pragmater --help --remove`):
|
86
88
|
|
87
89
|
-c, [--comments=one two three] # Pragma comments
|
88
90
|
-w, [--whitelist=one two three] # File extension whitelist
|
@@ -124,8 +126,8 @@ Each `.pragmaterrc` setting can be configured as follows:
|
|
124
126
|
|
125
127
|
## Frozen String Literals
|
126
128
|
|
127
|
-
With Ruby 2.3.0, support
|
128
|
-
|
129
|
+
With Ruby 2.3.0, support for frozen strings was added. These comments are meant to be placed at the top of each source
|
130
|
+
file. Example:
|
129
131
|
|
130
132
|
# frozen_string_literal: true
|
131
133
|
|
@@ -134,13 +136,25 @@ aid of this gem). As an alternative, frozen string literals can be enabled via t
|
|
134
136
|
|
135
137
|
--enable=frozen-string-literal
|
136
138
|
|
137
|
-
It is important to note that once enabled, it freezes strings program-wide -- It's an all or nothing option.
|
139
|
+
It is important to note that, once enabled, it freezes strings program-wide -- It's an all or nothing option.
|
138
140
|
|
139
141
|
Regardless of whether you leverage the capabilities of this gem or the Ruby command line option mentioned above, the
|
140
142
|
following Ruby command line option is available to aid debugging and tracking down frozen string literal issues:
|
141
143
|
|
142
144
|
--debug=frozen-string-literal
|
143
145
|
|
146
|
+
## Available Comments
|
147
|
+
|
148
|
+
With Ruby 2.3 and higher, the following comments are available:
|
149
|
+
|
150
|
+
- `# encoding:` Defaults to `UTF-8` but any supported encoding can be used. For a list of values, launch an IRB session
|
151
|
+
and run `Encoding.name_list`.
|
152
|
+
- `# coding:` The shorthand for `# encoding:`. Supports the same values as mentioned above.
|
153
|
+
- `# frozen_string_literal:` Defaults to `false` but can take either `true` or `false` as a value. When enabled, Ruby
|
154
|
+
will throw errors when strings are used in a mutable fashion.
|
155
|
+
- `# warn_indent:` Defaults to `false` but can take either `true` or `false` as a value. When enabled, and running Ruby
|
156
|
+
with the `-w` option, it'll throw warnings for code that isn't indented by two spaces.
|
157
|
+
|
144
158
|
# Tests
|
145
159
|
|
146
160
|
To test, run:
|
data/lib/pragmater/cli.rb
CHANGED
@@ -19,7 +19,7 @@ module Pragmater
|
|
19
19
|
@configuration = Configuration.new Identity.file_name
|
20
20
|
end
|
21
21
|
|
22
|
-
desc "-a, [--add=
|
22
|
+
desc "-a, [--add=PATH]", "Add pragma comments to source file(s)."
|
23
23
|
map %w[-a --add] => :add
|
24
24
|
method_option :comments, aliases: "-c", desc: "Pragma comments", type: :array, default: []
|
25
25
|
method_option :whitelist, aliases: "-w", desc: "File extension whitelist", type: :array, default: []
|
@@ -28,7 +28,7 @@ module Pragmater
|
|
28
28
|
write path, settings, :add
|
29
29
|
end
|
30
30
|
|
31
|
-
desc "-r, [--remove=
|
31
|
+
desc "-r, [--remove=PATH]", "Remove pragma comments from source file(s)."
|
32
32
|
map %w[-r --remove] => :remove
|
33
33
|
method_option :comments, aliases: "-c", desc: "Pragma comments", type: :array, default: []
|
34
34
|
method_option :whitelist, aliases: "-w", desc: "File extension whitelist", type: :array, default: []
|
@@ -51,7 +51,7 @@ module Pragmater
|
|
51
51
|
say Pragmater::Identity.version_label
|
52
52
|
end
|
53
53
|
|
54
|
-
desc "-h, [--help=
|
54
|
+
desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
|
55
55
|
map %w[-h --help] => :help
|
56
56
|
def help task = nil
|
57
57
|
say and super
|
@@ -76,13 +76,12 @@ module Pragmater
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def update_files path, comments, whitelist, action
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
error "Invalid path: #{path}."
|
79
|
+
if path.file?
|
80
|
+
update_file path, comments, action
|
81
|
+
elsif path.directory?
|
82
|
+
whitelisted_files(path, whitelist).each { |file_path| update_file file_path, comments, action }
|
83
|
+
else
|
84
|
+
error %(Invalid source path: "#{path}".)
|
86
85
|
end
|
87
86
|
end
|
88
87
|
|
data/lib/pragmater/identity.rb
CHANGED
data.tar.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
�j����3ZC+XF�ܺ�����D�
|
1
|
+
H)��X)}�.�ۦ������[��l����t�w$��o��C� 3���%I�;Ȍ:��$�<�o؞h����[�=K�bSrx�*�V����F��Y�-ßؾ&�e�1p~��#�ڰI��^�X�$���(��<�����-�|H��)��E5�%'L,����~~
|
2
|
+
:0� c�(��lq������~��(�wpTG�)!F�q"�x[�o�������Lo}ƛL�����7 ��/GK�~���
|
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: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
aSif+qBc6oHD7EQWPF5cZkzkIURuwNwPBngZGxIKaMAgRhjGFXzUMAaq++r59cS9
|
31
31
|
xTfQ4k6fglKEgpnLAXiKdo2c8Ym+X4rIKFfedQ==
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2016-
|
33
|
+
date: 2016-06-17 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: thor
|
@@ -52,14 +52,14 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '3.
|
55
|
+
version: '3.1'
|
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: '3.
|
62
|
+
version: '3.1'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: refinements
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,30 +78,30 @@ dependencies:
|
|
78
78
|
name: rake
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
83
|
+
version: '11.0'
|
84
84
|
type: :development
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
90
|
+
version: '11.0'
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: gemsmith
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '7.
|
97
|
+
version: '7.7'
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: '7.
|
104
|
+
version: '7.7'
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: pry
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,20 +130,6 @@ dependencies:
|
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
|
-
- !ruby/object:Gem::Dependency
|
134
|
-
name: pry-remote
|
135
|
-
requirement: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
140
|
-
type: :development
|
141
|
-
prerelease: false
|
142
|
-
version_requirements: !ruby/object:Gem::Requirement
|
143
|
-
requirements:
|
144
|
-
- - ">="
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version: '0'
|
147
133
|
- !ruby/object:Gem::Dependency
|
148
134
|
name: pry-state
|
149
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,34 +144,6 @@ dependencies:
|
|
158
144
|
- - ">="
|
159
145
|
- !ruby/object:Gem::Version
|
160
146
|
version: '0'
|
161
|
-
- !ruby/object:Gem::Dependency
|
162
|
-
name: pry-rescue
|
163
|
-
requirement: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - ">="
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: '0'
|
168
|
-
type: :development
|
169
|
-
prerelease: false
|
170
|
-
version_requirements: !ruby/object:Gem::Requirement
|
171
|
-
requirements:
|
172
|
-
- - ">="
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version: '0'
|
175
|
-
- !ruby/object:Gem::Dependency
|
176
|
-
name: pry-stack_explorer
|
177
|
-
requirement: !ruby/object:Gem::Requirement
|
178
|
-
requirements:
|
179
|
-
- - ">="
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
182
|
-
type: :development
|
183
|
-
prerelease: false
|
184
|
-
version_requirements: !ruby/object:Gem::Requirement
|
185
|
-
requirements:
|
186
|
-
- - ">="
|
187
|
-
- !ruby/object:Gem::Version
|
188
|
-
version: '0'
|
189
147
|
- !ruby/object:Gem::Dependency
|
190
148
|
name: bond
|
191
149
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,16 +204,16 @@ dependencies:
|
|
246
204
|
name: rspec
|
247
205
|
requirement: !ruby/object:Gem::Requirement
|
248
206
|
requirements:
|
249
|
-
- - "
|
207
|
+
- - "~>"
|
250
208
|
- !ruby/object:Gem::Version
|
251
|
-
version: '
|
209
|
+
version: '3.4'
|
252
210
|
type: :development
|
253
211
|
prerelease: false
|
254
212
|
version_requirements: !ruby/object:Gem::Requirement
|
255
213
|
requirements:
|
256
|
-
- - "
|
214
|
+
- - "~>"
|
257
215
|
- !ruby/object:Gem::Version
|
258
|
-
version: '
|
216
|
+
version: '3.4'
|
259
217
|
- !ruby/object:Gem::Dependency
|
260
218
|
name: climate_control
|
261
219
|
requirement: !ruby/object:Gem::Requirement
|
@@ -330,16 +288,16 @@ dependencies:
|
|
330
288
|
name: rubocop
|
331
289
|
requirement: !ruby/object:Gem::Requirement
|
332
290
|
requirements:
|
333
|
-
- - "
|
291
|
+
- - "~>"
|
334
292
|
- !ruby/object:Gem::Version
|
335
|
-
version: '0'
|
293
|
+
version: '0.40'
|
336
294
|
type: :development
|
337
295
|
prerelease: false
|
338
296
|
version_requirements: !ruby/object:Gem::Requirement
|
339
297
|
requirements:
|
340
|
-
- - "
|
298
|
+
- - "~>"
|
341
299
|
- !ruby/object:Gem::Version
|
342
|
-
version: '0'
|
300
|
+
version: '0.40'
|
343
301
|
- !ruby/object:Gem::Dependency
|
344
302
|
name: codeclimate-test-reporter
|
345
303
|
requirement: !ruby/object:Gem::Requirement
|
@@ -397,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
397
355
|
version: '0'
|
398
356
|
requirements: []
|
399
357
|
rubyforge_project:
|
400
|
-
rubygems_version: 2.6.
|
358
|
+
rubygems_version: 2.6.4
|
401
359
|
signing_key:
|
402
360
|
specification_version: 4
|
403
361
|
summary: A command line interface for managing/formatting source file pragma comments.
|
metadata.gz.sig
CHANGED
Binary file
|