pragmater 5.0.2 → 5.1.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.tar.gz.sig +0 -0
- data/README.md +42 -4
- data/lib/pragmater/cli.rb +7 -6
- data/lib/pragmater/identity.rb +1 -1
- metadata +41 -31
- metadata.gz.sig +2 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43d44e1947b60d7b411a16fe44c69806b76e30ddb7088d31342f79774164d8ff
|
4
|
+
data.tar.gz: 6489dc53d3557222ed545a280622b806ca781006d699d40dec3611486f3c5486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7b2206f9a09f74bc8bd60f7da523ab908f6d3e1709e311a117c28699ff67985d76e6c9b12e775aeccf4bebfd772029c9eb6be88139cc2ff21e47efba9220eb2
|
7
|
+
data.tar.gz: 32ce7f987dccfe5f0de528dd7354b24b40b24d7945186d9a54b9714f2d99d31c204d854a1162b8a7660b3bd46473e35e8abfe169e19dc3869afbd777c2ff25b4
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/README.md
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/pragmater.svg)](http://badge.fury.io/rb/pragmater)
|
4
4
|
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/f0971ab6985309ce4db4/maintainability)](https://codeclimate.com/github/bkuhlmann/pragmater/maintainability)
|
5
5
|
[![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/f0971ab6985309ce4db4/test_coverage)](https://codeclimate.com/github/bkuhlmann/pragmater/test_coverage)
|
6
|
-
[![Gemnasium Status](https://gemnasium.com/bkuhlmann/pragmater.svg)](https://gemnasium.com/bkuhlmann/pragmater)
|
7
6
|
[![Circle CI Status](https://circleci.com/gh/bkuhlmann/pragmater.svg?style=svg)](https://circleci.com/gh/bkuhlmann/pragmater)
|
8
7
|
|
9
8
|
A command line interface for managing/formatting source file
|
@@ -81,6 +80,14 @@ included files (viewable by running `pragmater --help --add` or `pragmater --hel
|
|
81
80
|
-c, [--comments=one two three] # Pragma comments
|
82
81
|
-i, [--includes=one two three] # File include list
|
83
82
|
|
83
|
+
Example (same options could be used for the `--remove` command too):
|
84
|
+
|
85
|
+
pragmater --add --comments "# frozen_string_literal: true" --includes "Gemfile" "Guardfile" "Rakefile" ".gemspec" "config.ru" "bin/**/*" "**/*.rake" "**/*.rb"
|
86
|
+
|
87
|
+
The `--add` and `--remove` commands default to the current working directory so a path isn't
|
88
|
+
necessary unless you want to run Pragmater on a directory structure *other than* your current
|
89
|
+
working directory.
|
90
|
+
|
84
91
|
### Customization
|
85
92
|
|
86
93
|
This gem can be configured via a global configuration:
|
@@ -111,8 +118,8 @@ The `configuration.yml` file can be configured as follows:
|
|
111
118
|
|
112
119
|
### Frozen String Literals
|
113
120
|
|
114
|
-
|
115
|
-
top of each source file. Example:
|
121
|
+
Support for frozen string literals was added in Ruby 2.3.0. The ability to freeze strings within a
|
122
|
+
source can be done by placing a frozen string pragma at the top of each source file. Example:
|
116
123
|
|
117
124
|
# frozen_string_literal: true
|
118
125
|
|
@@ -122,7 +129,7 @@ the following Ruby command line option:
|
|
122
129
|
|
123
130
|
--enable=frozen-string-literal
|
124
131
|
|
125
|
-
It is important to note that, once enabled,
|
132
|
+
It is important to note that, once enabled, this freezes strings program-wide -- It's an all or
|
126
133
|
nothing option.
|
127
134
|
|
128
135
|
Regardless of whether you leverage the capabilities of this gem or the Ruby command line option
|
@@ -131,6 +138,37 @@ down frozen string literal issues:
|
|
131
138
|
|
132
139
|
--debug=frozen-string-literal
|
133
140
|
|
141
|
+
Ruby 2.3.0 also added the following methods to the `String` class:
|
142
|
+
|
143
|
+
- `String#+@`: Answers a duplicated, mutable, string if not already frozen. Example:
|
144
|
+
|
145
|
+
immutable = "test".freeze
|
146
|
+
mutable = +immutable
|
147
|
+
mutable.capitalize! # => "Test"
|
148
|
+
|
149
|
+
- `String#-@`: Answers a immutable string if not already frozen. Example:
|
150
|
+
|
151
|
+
mutable = "test"
|
152
|
+
immutable = -mutable
|
153
|
+
immutable.capitalize! # => FrozenError
|
154
|
+
|
155
|
+
You can also use the methods, shown above, for variable initialization. Example:
|
156
|
+
|
157
|
+
immutable = -"test"
|
158
|
+
mutable = +"test"
|
159
|
+
|
160
|
+
Despite Ruby allowing you to do this, it is *not recommended* to use the above examples as it leads
|
161
|
+
to hard to read code. Instead use the following:
|
162
|
+
|
163
|
+
immutable = "test".freeze
|
164
|
+
mutable = "test"
|
165
|
+
|
166
|
+
While this requires extra typing, it expresses intent more clearly. There is a slight caveat to this
|
167
|
+
rule in that the use of `String#-@` was [enhanced in Ruby 2.5.0](http://bit.ly/2DGAjgG) to
|
168
|
+
*deduplicate* all instances of the same string thus reducing your memory footprint. This can be
|
169
|
+
valuable in situations where you are not using the frozen string comment and need to selectively
|
170
|
+
freeze strings.
|
171
|
+
|
134
172
|
### Available Comments
|
135
173
|
|
136
174
|
With Ruby 2.3 and higher, the following comments are available:
|
data/lib/pragmater/cli.rb
CHANGED
@@ -13,7 +13,7 @@ module Pragmater
|
|
13
13
|
package_name Identity.version_label
|
14
14
|
|
15
15
|
def self.configuration
|
16
|
-
Runcom::Configuration.new
|
16
|
+
Runcom::Configuration.new Identity.name, defaults: {
|
17
17
|
add: {
|
18
18
|
comments: "",
|
19
19
|
includes: []
|
@@ -45,7 +45,9 @@ module Pragmater
|
|
45
45
|
type: :array,
|
46
46
|
default: configuration.to_h.dig(:add, :includes)
|
47
47
|
def add path = "."
|
48
|
-
settings = configuration.merge
|
48
|
+
settings = configuration.merge(
|
49
|
+
add: {comments: options.comments, includes: options.includes}
|
50
|
+
).to_h
|
49
51
|
|
50
52
|
runner = Runner.new path,
|
51
53
|
comments: settings.dig(:add, :comments),
|
@@ -67,10 +69,9 @@ module Pragmater
|
|
67
69
|
type: :array,
|
68
70
|
default: configuration.to_h.dig(:remove, :includes)
|
69
71
|
def remove path = "."
|
70
|
-
settings = configuration.merge
|
71
|
-
comments: options.comments,
|
72
|
-
|
73
|
-
}
|
72
|
+
settings = configuration.merge(
|
73
|
+
remove: {comments: options.comments, includes: options.includes}
|
74
|
+
).to_h
|
74
75
|
|
75
76
|
runner = Runner.new path,
|
76
77
|
comments: settings.dig(:remove, :comments),
|
data/lib/pragmater/identity.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pragmater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDQDCCAiigAwIBAgIBATANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0xODAyMTQxNTA4NDVaFw0xOTAyMTQx
|
15
|
+
NTA4NDVaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
16
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
17
|
+
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
18
|
+
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
19
|
+
9z0A8KcGhz67SdcoQiD7qiCjL/2NTeWHOzkpPrdGlt088+VerEEGf5I13QCvaftP
|
20
|
+
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
21
|
+
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
22
|
+
AQABo3sweTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
23
|
+
2CdikiiE3fJhP/gY4ggwHwYDVR0RBBgwFoEUYnJvb2tlQGFsY2hlbWlzdHMuaW8w
|
24
|
+
HwYDVR0SBBgwFoEUYnJvb2tlQGFsY2hlbWlzdHMuaW8wDQYJKoZIhvcNAQELBQAD
|
25
|
+
ggEBAImQPNpkb90nkDUCJ4ivQNKK1LCebOjqZnOWGC4HxndvBQBqj78MTZifoODl
|
26
|
+
uPBY4fSnnpVGph+Y1OTWw/xhk3HE2AH0GDGC9xbM75qrg3/+a4D81pM94B6zuBdA
|
27
|
+
7hxUy4kByawrii833IidV0zkI4lCombTNicc8JWXXSlL2G/sWPLndNvn5rzoyyRT
|
28
|
+
pPOLYGdB4hqUam3hBgLOsYIOVp+yXMvj0gvk/Djq8IR2P1RS4NZU7HHD485xkBfL
|
29
|
+
4Zrsxi713z6sndd9JBAm4G7mJiV93MsuCM5N4ZDY7XaxIhvctNSNhX/Yn8LLdtGI
|
30
|
+
b4jw5t40FKyNUvLPPXYAvQALBtk=
|
31
|
+
-----END CERTIFICATE-----
|
32
|
+
date: 2018-04-01 00:00:00.000000000 Z
|
12
33
|
dependencies:
|
13
34
|
- !ruby/object:Gem::Dependency
|
14
35
|
name: runcom
|
@@ -16,14 +37,14 @@ dependencies:
|
|
16
37
|
requirements:
|
17
38
|
- - "~>"
|
18
39
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
40
|
+
version: '3.0'
|
20
41
|
type: :runtime
|
21
42
|
prerelease: false
|
22
43
|
version_requirements: !ruby/object:Gem::Requirement
|
23
44
|
requirements:
|
24
45
|
- - "~>"
|
25
46
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
47
|
+
version: '3.0'
|
27
48
|
- !ruby/object:Gem::Dependency
|
28
49
|
name: thor
|
29
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,47 +102,33 @@ dependencies:
|
|
81
102
|
- !ruby/object:Gem::Version
|
82
103
|
version: '0.6'
|
83
104
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
105
|
+
name: climate_control
|
85
106
|
requirement: !ruby/object:Gem::Requirement
|
86
107
|
requirements:
|
87
108
|
- - "~>"
|
88
109
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
110
|
+
version: '0.2'
|
90
111
|
type: :development
|
91
112
|
prerelease: false
|
92
113
|
version_requirements: !ruby/object:Gem::Requirement
|
93
114
|
requirements:
|
94
115
|
- - "~>"
|
95
116
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
117
|
+
version: '0.2'
|
97
118
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '11.0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '11.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: git-cop
|
119
|
+
name: codeclimate-test-reporter
|
113
120
|
requirement: !ruby/object:Gem::Requirement
|
114
121
|
requirements:
|
115
122
|
- - "~>"
|
116
123
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
124
|
+
version: '1.0'
|
118
125
|
type: :development
|
119
126
|
prerelease: false
|
120
127
|
version_requirements: !ruby/object:Gem::Requirement
|
121
128
|
requirements:
|
122
129
|
- - "~>"
|
123
130
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
131
|
+
version: '1.0'
|
125
132
|
- !ruby/object:Gem::Dependency
|
126
133
|
name: guard-rspec
|
127
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +205,14 @@ dependencies:
|
|
198
205
|
requirements:
|
199
206
|
- - "~>"
|
200
207
|
- !ruby/object:Gem::Version
|
201
|
-
version: '4.
|
208
|
+
version: '4.8'
|
202
209
|
type: :development
|
203
210
|
prerelease: false
|
204
211
|
version_requirements: !ruby/object:Gem::Requirement
|
205
212
|
requirements:
|
206
213
|
- - "~>"
|
207
214
|
- !ruby/object:Gem::Version
|
208
|
-
version: '4.
|
215
|
+
version: '4.8'
|
209
216
|
- !ruby/object:Gem::Dependency
|
210
217
|
name: rspec
|
211
218
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,14 +233,14 @@ dependencies:
|
|
226
233
|
requirements:
|
227
234
|
- - "~>"
|
228
235
|
- !ruby/object:Gem::Version
|
229
|
-
version: '0.
|
236
|
+
version: '0.54'
|
230
237
|
type: :development
|
231
238
|
prerelease: false
|
232
239
|
version_requirements: !ruby/object:Gem::Requirement
|
233
240
|
requirements:
|
234
241
|
- - "~>"
|
235
242
|
- !ruby/object:Gem::Version
|
236
|
-
version: '0.
|
243
|
+
version: '0.54'
|
237
244
|
- !ruby/object:Gem::Dependency
|
238
245
|
name: wirb
|
239
246
|
requirement: !ruby/object:Gem::Requirement
|
@@ -271,7 +278,10 @@ files:
|
|
271
278
|
homepage: https://github.com/bkuhlmann/pragmater
|
272
279
|
licenses:
|
273
280
|
- Apache-2.0
|
274
|
-
metadata:
|
281
|
+
metadata:
|
282
|
+
source_code_uri: https://github.com/bkuhlmann/pragmater
|
283
|
+
changelog_uri: https://github.com/bkuhlmann/pragmater/blob/master/CHANGES.md
|
284
|
+
bug_tracker_uri: https://github.com/bkuhlmann/pragmater/issues
|
275
285
|
post_install_message:
|
276
286
|
rdoc_options: []
|
277
287
|
require_paths:
|
@@ -288,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
298
|
version: '0'
|
289
299
|
requirements: []
|
290
300
|
rubyforge_project:
|
291
|
-
rubygems_version: 2.7.
|
301
|
+
rubygems_version: 2.7.6
|
292
302
|
signing_key:
|
293
303
|
specification_version: 4
|
294
304
|
summary: A command line interface for managing/formatting source file pragma comments.
|
metadata.gz.sig
ADDED