pragmater 7.0.1 → 7.1.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
  SHA256:
3
- metadata.gz: 527b35a68d9a53c5769abad8a35a99991dd9d46875c9272168439520187ecc10
4
- data.tar.gz: 27b54ea28296b1a5ecaa294e78b159f83fa9a89874cbede35f7f0d1f1fd4dd84
3
+ metadata.gz: 8f520d4523de27f6ff372f701a852edcd1cd98227c1c86baa5eb3377290be461
4
+ data.tar.gz: '08e91032f9bb0515d06da796305caf512f248e8488dd7e71f895cd1cc6e6f0c5'
5
5
  SHA512:
6
- metadata.gz: 2223e05790fd7b7620ecf5021cca51f0a325d8a0c69846d238b4f473ccd4fa1808bb1cd62e5750091ab87e90e57a57122cd810fe729473fe51eb783bed40301c
7
- data.tar.gz: a264a5e42da926e90e4acbce8cc8f5098e69c160c4f3c8f479504e8c226ae6e4785b80c616a1d3f900496547a544563d3ac3b60907d5e4456f904cc515f8afc7
6
+ metadata.gz: ca422a74af731888d2c06c4b7772e1ce09ccf5e9b1e41c22590796f15faea84ba57d296de218ece4627eeb0f636ff592bee4cfa9c2288c48c353fe8513b519c9
7
+ data.tar.gz: 98b0e252098ac3b158e6abdadb982dd43aed0dbb0763b51adea6b1d6b165279e5ffdaa4feab781dad9045e6be69add27bdb5cad45db27d41ee9e08fc7c536dfe
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,4 +1,4 @@
1
- # Apache License
1
+ = Apache License
2
2
 
3
3
  Version 2.0, January 2004
4
4
 
@@ -6,7 +6,7 @@ http://www.apache.org/licenses
6
6
 
7
7
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
8
 
9
- ## 1. Definitions
9
+ == 1. Definitions
10
10
 
11
11
  "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
12
12
  Sections 1 through 9 of this document.
@@ -54,14 +54,14 @@ Contribution."
54
54
  "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
55
55
  Contribution has been received by Licensor and subsequently incorporated within the Work.
56
56
 
57
- ## 2. Grant of Copyright License
57
+ == 2. Grant of Copyright License
58
58
 
59
59
  Subject to the terms and conditions of this License, each Contributor hereby grants to You a
60
60
  perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
61
61
  reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
62
62
  distribute the Work and such Derivative Works in Source or Object form.
63
63
 
64
- ## 3. Grant of Patent License
64
+ == 3. Grant of Patent License
65
65
 
66
66
  Subject to the terms and conditions of this License, each Contributor hereby grants to You a
67
67
  perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
@@ -74,39 +74,38 @@ a Contribution incorporated within the Work constitutes direct or contributory p
74
74
  then any patent licenses granted to You under this License for that Work shall terminate as of the
75
75
  date such litigation is filed.
76
76
 
77
- ## 4. Redistribution
77
+ == 4. Redistribution
78
78
 
79
79
  You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
80
80
  or without modifications, and in Source or Object form, provided that You meet the following
81
81
  conditions:
82
82
 
83
- 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
83
+ . You must give any other recipients of the Work or Derivative Works a copy of this License; and
84
84
 
85
- 2. You must cause any modified files to carry prominent notices stating that You changed the
86
- files; and
85
+ . You must cause any modified files to carry prominent notices stating that You changed the files;
86
+ and
87
87
 
88
- 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
89
- patent, trademark, and attribution notices from the Source form of the Work, excluding those
90
- notices that do not pertain to any part of the Derivative Works; and
88
+ . You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
89
+ patent, trademark, and attribution notices from the Source form of the Work, excluding those
90
+ notices that do not pertain to any part of the Derivative Works; and
91
91
 
92
- 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative
93
- Works that You distribute must include a readable copy of the attribution notices contained
94
- within such NOTICE file, excluding those notices that do not pertain to any part of the
95
- Derivative Works, in at least one of the following places: within a NOTICE text file
96
- distributed as part of the Derivative Works; within the Source form or documentation, if
97
- provided along with the Derivative Works; or, within a display generated by the Derivative
98
- Works, if and wherever such third-party notices normally appear. The contents of the NOTICE
99
- file are for informational purposes only and do not modify the License. You may add Your own
100
- attribution notices within Derivative Works that You distribute, alongside or as an addendum to
101
- the NOTICE text from the Work, provided that such additional attribution notices cannot be
102
- construed as modifying the License.
92
+ . If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
93
+ that You distribute must include a readable copy of the attribution notices contained within such
94
+ NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
95
+ at least one of the following places: within a NOTICE text file distributed as part of the
96
+ Derivative Works; within the Source form or documentation, if provided along with the Derivative
97
+ Works; or, within a display generated by the Derivative Works, if and wherever such third-party
98
+ notices normally appear. The contents of the NOTICE file are for informational purposes only and
99
+ do not modify the License. You may add Your own attribution notices within Derivative Works that
100
+ You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
101
+ additional attribution notices cannot be construed as modifying the License.
103
102
 
104
103
  You may add Your own copyright statement to Your modifications and may provide additional or
105
104
  different license terms and conditions for use, reproduction, or distribution of Your modifications,
106
105
  or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
107
106
  the Work otherwise complies with the conditions stated in this License.
108
107
 
109
- ## 5. Submission of Contributions
108
+ == 5. Submission of Contributions
110
109
 
111
110
  Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
112
111
  Work by You to the Licensor shall be under the terms and conditions of this License, without any
@@ -114,13 +113,13 @@ additional terms or conditions. Notwithstanding the above, nothing herein shall
114
113
  the terms of any separate license agreement you may have executed with Licensor regarding such
115
114
  Contributions.
116
115
 
117
- ## 6. Trademarks
116
+ == 6. Trademarks
118
117
 
119
118
  This License does not grant permission to use the trade names, trademarks, service marks, or product
120
119
  names of the Licensor, except as required for reasonable and customary use in describing the origin
121
120
  of the Work and reproducing the content of the NOTICE file.
122
121
 
123
- ## 7. Disclaimer of Warranty
122
+ == 7. Disclaimer of Warranty
124
123
 
125
124
  Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
126
125
  Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -129,7 +128,7 @@ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Y
129
128
  responsible for determining the appropriateness of using or redistributing the Work and assume any
130
129
  risks associated with Your exercise of permissions under this License.
131
130
 
132
- ## 8. Limitation of Liability
131
+ == 8. Limitation of Liability
133
132
 
134
133
  In no event and under no legal theory, whether in tort (including negligence), contract, or
135
134
  otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
@@ -139,7 +138,7 @@ License or out of the use or inability to use the Work (including but not limite
139
138
  loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
140
139
  damages or losses), even if such Contributor has been advised of the possibility of such damages.
141
140
 
142
- ## 9. Accepting Warranty or Additional Liability
141
+ == 9. Accepting Warranty or Additional Liability
143
142
 
144
143
  While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
145
144
  for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
@@ -151,11 +150,11 @@ additional liability.
151
150
 
152
151
  END OF TERMS AND CONDITIONS
153
152
 
154
- Copyright 2015 [Alchemists](https://www.alchemists.io).
153
+ Copyright link:https://www.alchemists.io[Alchemists].
155
154
 
156
155
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
157
- compliance with the License. You may obtain a [copy](http://www.apache.org/licenses/LICENSE-2.0) of
158
- the License.
156
+ compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
157
+ of the License.
159
158
 
160
159
  Unless required by applicable law or agreed to in writing, software distributed under the License is
161
160
  distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
@@ -0,0 +1,310 @@
1
+ :toc: macro
2
+ :toclevels: 5
3
+ :figure-caption!:
4
+
5
+ = Pragmater
6
+
7
+ [link=http://badge.fury.io/rb/pragmater]
8
+ image::https://badge.fury.io/rb/pragmater.svg[Gem Version]
9
+ [link=https://circleci.com/gh/bkuhlmann/pragmater]
10
+ image::https://circleci.com/gh/bkuhlmann/pragmater.svg?style=svg[Circle CI Status]
11
+
12
+ A command line interface for managing/formatting source file
13
+ https://en.wikipedia.org/wiki/Directive_(programming)[directive pragmas] (a.k.a. _magic comments_).
14
+ Examples:
15
+
16
+ [source,ruby]
17
+ ----
18
+ #! /usr/bin/env ruby
19
+ # frozen_string_literal: true
20
+ # encoding: UTF-8
21
+ ----
22
+
23
+ With https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released[Ruby 2.3.0], frozen strings
24
+ are supported via a pragma. This gem provides an easy way to add pragmas to single or multiple Ruby
25
+ source files in order to benefit from improved memory and concurrency performance.
26
+
27
+ toc::[]
28
+
29
+ == Features
30
+
31
+ * Supports adding a pragma or multiple pragmas to single or multiple source files.
32
+ * Supports removing pragma(s) from single or multiple source files.
33
+ * Supports file list filtering. Defaults to any file.
34
+ * Ensures duplicate pragmas never exist.
35
+ * Ensures pragmas are consistently formatted.
36
+
37
+ == Screencasts
38
+
39
+ [link=https://www.alchemists.io/screencasts/pragmater.html]
40
+ image::https://www.alchemists.io/images/screencasts/pragmater/cover-original.png[Screencast,role=focal_point]
41
+
42
+ == Requirements
43
+
44
+ . https://www.ruby-lang.org[Ruby 2.7.x]
45
+
46
+ == Setup
47
+
48
+ === Production
49
+
50
+ To install, run:
51
+
52
+ [source,bash]
53
+ ----
54
+ gem install pragmater
55
+ ----
56
+
57
+ === Development
58
+
59
+ To contribute, run:
60
+
61
+ [source,bash]
62
+ ----
63
+ git clone https://github.com/bkuhlmann/pragmater.git
64
+ cd pragmater
65
+ bin/setup
66
+ ----
67
+
68
+ You can also use the IRB console for direct access to all objects:
69
+
70
+ [source,bash]
71
+ ----
72
+ bin/console
73
+ ----
74
+
75
+ == Usage
76
+
77
+ === Command Line Interface (CLI)
78
+
79
+ From the command line, type: `+pragmater help+`
80
+
81
+ ....
82
+ pragmater -a, [--add=PATH] # Add comments to source file(s).
83
+ pragmater -c, [--config] # Manage gem configuration.
84
+ pragmater -h, [--help=COMMAND] # Show this message or get help for a command.
85
+ pragmater -r, [--remove=PATH] # Remove comments from source file(s).
86
+ pragmater -v, [--version] # Show gem version.
87
+ ....
88
+
89
+ Both the `+--add+` and `+--remove+` commands support options for specifying pragmas and/or included
90
+ files (viewable by running `+pragmater --help --add+` or `+pragmater --help --remove+`):
91
+
92
+ ....
93
+ -c, [--comments=one two three] # Define desired comments
94
+ -i, [--includes=one two three] # Include specific files and/or directories
95
+ ....
96
+
97
+ Example (same options could be used for the `+--remove+` command too):
98
+
99
+ [source,bash]
100
+ ----
101
+ pragmater --add --comments "# frozen_string_literal: true" --includes "Gemfile" "Guardfile" "Rakefile" ".gemspec" "config.ru" "bin/**/*" "**/*.rake" "**/*.rb"
102
+ ----
103
+
104
+ The `--add` and `--remove` commands default to the current working directory so a path isn’t
105
+ necessary unless you want to run Pragmater on a directory structure _other than_ your current
106
+ working directory.
107
+
108
+ === Customization
109
+
110
+ This gem can be configured via a global configuration: `$HOME/.config/pragmater/configuration.yml`
111
+
112
+ It can also be configured via link:https://www.alchemists.io/projects/xdg[XDG] environment
113
+ variables.
114
+
115
+ The default configuration is as follows:
116
+
117
+ [source,yaml]
118
+ ----
119
+ :add:
120
+ :comments: []
121
+ :includes: []
122
+ :remove:
123
+ :comments: []
124
+ :includes: []
125
+ ----
126
+
127
+ Feel free to take this default configuration, modify, and save as your own custom
128
+ `configuration.yml`.
129
+
130
+ The `configuration.yml` file can be configured as follows:
131
+
132
+ * `add`: Defines global/local comments and/or file include lists when adding pragmas. The `comments`
133
+ and `includes` options can be either a single string or an array.
134
+ * `remove`: Defines global/local comments and/or file include lists when removing pragmas. The
135
+ `comments` and `includes` options can be either a single string or an array.
136
+
137
+ === Available Pragmas
138
+
139
+ With Ruby 2.3 and higher, the following pragmas are available:
140
+
141
+ * `# encoding:` Defaults to `UTF-8` but any supported encoding can be used. For a list of values,
142
+ launch an IRB session and run `Encoding.name_list`.
143
+ * `# coding:` The shorthand for `# encoding:`. Supports the same values as mentioned above.
144
+ * `# frozen_string_literal:` Defaults to `false` but can take either `true` or `false` as a value.
145
+ When enabled, Ruby will throw errors when strings are used in a mutable fashion.
146
+ * `# warn_indent:` Defaults to `false` but can take either `true` or `false` as a value. When
147
+ enabled, and running Ruby with the `-w` option, it’ll throw warnings for code that isn’t indented
148
+ by two spaces.
149
+
150
+ === Syntax
151
+
152
+ The pragma syntax allows for two kinds of styles. Example:
153
+
154
+ [source,ruby]
155
+ ----
156
+ # encoding: UTF-8
157
+ # -*- encoding: UTF-8 -*-
158
+ ----
159
+
160
+ Only the former syntax is supported by this gem as the latter syntax is more verbose and requires
161
+ additional typing.
162
+
163
+ === Precedence
164
+
165
+ When different multiple pragmas are defined, they all take precedence:
166
+
167
+ [source,ruby]
168
+ ----
169
+ # encoding: binary
170
+ # frozen_string_literal: true
171
+ ----
172
+
173
+ In the above example, both _binary_ encoding and _frozen string literals_ behavior will be applied.
174
+
175
+ When defining multiple pragmas that are similar, behavior can differ based on the _kind_ of pragma
176
+ used. The following walks through each use case so you know what to expect:
177
+
178
+ [source,ruby]
179
+ ----
180
+ # encoding: binary
181
+ # encoding: UTF-8
182
+ ----
183
+
184
+ In the above example, only the _binary_ encoding will be applied while the _UTF-8_ encoding will be
185
+ ignored (same principle applies for the `coding` pragma too).
186
+
187
+ [source,ruby]
188
+ ----
189
+ # frozen_string_literal: false
190
+ # frozen_string_literal: true
191
+ ----
192
+
193
+ In the above example, frozen string literal support _will be enabled_ instead of being disabled.
194
+
195
+ [source,ruby]
196
+ ----
197
+ # warn_indent: false
198
+ # warn_indent: true
199
+ ----
200
+
201
+ In the above example, indentation warnings _will be enabled_ instead of being disabled.
202
+
203
+ === Frozen String Literals
204
+
205
+ Support for frozen string literals was added in Ruby 2.3.0. The ability to freeze strings within a
206
+ source can be done by placing a frozen string pragma at the top of each source file. Example:
207
+
208
+ [source,ruby]
209
+ ----
210
+ # frozen_string_literal: true
211
+ ----
212
+
213
+ This is great for _selective_ enablement of frozen string literals but might be too much work for
214
+ some (even with the aid of this gem). As an alternative, frozen string literals can be enabled via
215
+ the following Ruby command line option:
216
+
217
+ ....
218
+ --enable=frozen-string-literal
219
+ ....
220
+
221
+ It is important to note that, once enabled, this freezes strings program-wide – It’s an all or
222
+ nothing option.
223
+
224
+ Regardless of whether you leverage the capabilities of this gem or the Ruby command line option
225
+ mentioned above, the following Ruby command line option is available to aid debugging and tracking
226
+ down frozen string literal issues:
227
+
228
+ ....
229
+ --debug=frozen-string-literal
230
+ ....
231
+
232
+ Ruby 2.3.0 also added the following methods to the `String` class:
233
+
234
+ * `String#+@`: Answers a duplicated, mutable, string if not already frozen. Example:
235
+ +
236
+ [source,ruby]
237
+ ----
238
+ immutable = "test".freeze
239
+ mutable = +immutable
240
+ mutable.capitalize! # => "Test"
241
+ ----
242
+ * `String#-@`: Answers a immutable string if not already frozen. Example:
243
+ +
244
+ [source,ruby]
245
+ ----
246
+ mutable = "test"
247
+ immutable = -mutable
248
+ immutable.capitalize! # => FrozenError
249
+ ----
250
+
251
+ You can also use the methods, shown above, for variable initialization. Example:
252
+
253
+ [source,ruby]
254
+ ----
255
+ immutable = -"test"
256
+ mutable = +"test"
257
+ ----
258
+
259
+ Despite Ruby allowing you to do this, it is _not recommended_ to use the above examples as it leads
260
+ to hard to read code. Instead use the following:
261
+
262
+ [source,ruby]
263
+ ----
264
+ immutable = "test".freeze
265
+ mutable = "test"
266
+ ----
267
+
268
+ While this requires extra typing, it expresses intent more clearly. There is a slight caveat to this
269
+ rule in which the use of `+String#-@+` was http://bit.ly/2DGAjgG[enhanced in Ruby 2.5.0] to
270
+ _deduplicate_ all instances of the same string thus reducing your memory footprint. This can be
271
+ valuable in situations where you are not using the frozen string comment and need to selectively
272
+ freeze strings.
273
+
274
+ == Tests
275
+
276
+ To test, run:
277
+
278
+ [source,bash]
279
+ ----
280
+ bundle exec rake
281
+ ----
282
+
283
+ == Versioning
284
+
285
+ Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
286
+
287
+ * Major (X.y.z) - Incremented for any backwards incompatible public API changes.
288
+ * Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
289
+ * Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
290
+
291
+ == Code of Conduct
292
+
293
+ Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
294
+ participating in this project you agree to abide by its terms.
295
+
296
+ == Contributions
297
+
298
+ Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
299
+
300
+ == License
301
+
302
+ Read link:LICENSE.adoc[LICENSE] for details.
303
+
304
+ == History
305
+
306
+ Read link:CHANGES.adoc[CHANGES] for details.
307
+
308
+ == Credits
309
+
310
+ Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann.html[Brooke Kuhlmann].
@@ -5,5 +5,5 @@ require "pragmater"
5
5
  require "pragmater/cli"
6
6
  require "pragmater/identity"
7
7
 
8
- Process.setproctitle Pragmater::Identity.version_label
8
+ Process.setproctitle Pragmater::Identity::VERSION_LABEL
9
9
  Pragmater::CLI.start
@@ -10,11 +10,11 @@ module Pragmater
10
10
  class CLI < Thor
11
11
  include Thor::Actions
12
12
 
13
- package_name Identity.version_label
13
+ package_name Identity::VERSION_LABEL
14
14
 
15
15
  # rubocop:disable Metrics/MethodLength
16
16
  def self.configuration
17
- Runcom::Config.new "#{Identity.name}/configuration.yml",
17
+ Runcom::Config.new "#{Identity::NAME}/configuration.yml",
18
18
  defaults: {
19
19
  add: {
20
20
  comments: "",
@@ -108,7 +108,7 @@ module Pragmater
108
108
  desc "-v, [--version]", "Show gem version."
109
109
  map %w[-v --version] => :version
110
110
  def version
111
- say Identity.version_label
111
+ say Identity::VERSION_LABEL
112
112
  end
113
113
 
114
114
  desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
@@ -3,20 +3,9 @@
3
3
  module Pragmater
4
4
  # Gem identity information.
5
5
  module Identity
6
- def self.name
7
- "pragmater"
8
- end
9
-
10
- def self.label
11
- "Pragmater"
12
- end
13
-
14
- def self.version
15
- "7.0.1"
16
- end
17
-
18
- def self.version_label
19
- "#{label} #{version}"
20
- end
6
+ NAME = "pragmater"
7
+ LABEL = "Pragmater"
8
+ VERSION = "7.1.0"
9
+ VERSION_LABEL = "#{LABEL} #{VERSION}"
21
10
  end
22
11
  end
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: 7.0.1
4
+ version: 7.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIC/jCCAeagAwIBAgIBAjANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
- a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0xOTAyMTcxNjAxMTFaFw0yMDAyMTcx
15
- NjAxMTFaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
13
+ MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
+ a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
15
+ NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
16
16
  IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
17
17
  xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
18
18
  brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
@@ -20,15 +20,15 @@ cert_chain:
20
20
  D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
21
21
  3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
22
22
  AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
23
- 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBANgfX7kPZkJvsbdWMvbe
24
- DUUYxRTqTUzCDpLd2p3sQvgLMKjTNSKt6CFq/kh+98b6RCgO6DqiVfxvOEq02dvf
25
- ebMN/ylQqan2FgiAs1rpP0/D4C0MlBjoDktsT+2IyLol1KmkDB20ExJ4Sf1GRNdA
26
- hpWOtcgqHtmrc7xzgB6BuyoYufrKKUlCO3ewTM4C375D2qO7hIdKuMOO3CdPMtSk
27
- OrWpbzCL+nbbXqeoqiHgZaUvcyyQrGj5sQRxMTzuMXzzQxtHnuTuKrcz16HMTX/O
28
- dKvURM+1PwDCzC5tvRwjhUJIizau6+MtkFCvJHmaAj1aZL3odcPejHj5Hxt/0CUW
29
- y84=
23
+ 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
24
+ XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
25
+ bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
26
+ Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
27
+ 7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
28
+ 2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
+ QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-01-02 00:00:00.000000000 Z
31
+ date: 2020-04-01 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: runcom
@@ -176,14 +176,14 @@ dependencies:
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '5.4'
179
+ version: '6.0'
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '5.4'
186
+ version: '6.0'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: rspec
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -204,14 +204,14 @@ dependencies:
204
204
  requirements:
205
205
  - - "~>"
206
206
  - !ruby/object:Gem::Version
207
- version: '0.78'
207
+ version: '0.79'
208
208
  type: :development
209
209
  prerelease: false
210
210
  version_requirements: !ruby/object:Gem::Requirement
211
211
  requirements:
212
212
  - - "~>"
213
213
  - !ruby/object:Gem::Version
214
- version: '0.78'
214
+ version: '0.79'
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: rubocop-performance
217
217
  requirement: !ruby/object:Gem::Requirement
@@ -260,14 +260,14 @@ dependencies:
260
260
  requirements:
261
261
  - - "~>"
262
262
  - !ruby/object:Gem::Version
263
- version: '0.17'
263
+ version: '0.18'
264
264
  type: :development
265
265
  prerelease: false
266
266
  version_requirements: !ruby/object:Gem::Requirement
267
267
  requirements:
268
268
  - - "~>"
269
269
  - !ruby/object:Gem::Version
270
- version: '0.17'
270
+ version: '0.18'
271
271
  description:
272
272
  email:
273
273
  - brooke@alchemists.io
@@ -275,11 +275,11 @@ executables:
275
275
  - pragmater
276
276
  extensions: []
277
277
  extra_rdoc_files:
278
- - README.md
279
- - LICENSE.md
278
+ - README.adoc
279
+ - LICENSE.adoc
280
280
  files:
281
- - LICENSE.md
282
- - README.md
281
+ - LICENSE.adoc
282
+ - README.adoc
283
283
  - bin/pragmater
284
284
  - lib/pragmater.rb
285
285
  - lib/pragmater/cli.rb
@@ -288,13 +288,14 @@ files:
288
288
  - lib/pragmater/identity.rb
289
289
  - lib/pragmater/runner.rb
290
290
  - lib/pragmater/writer.rb
291
- homepage: https://github.com/bkuhlmann/pragmater
291
+ homepage: https://www.alchemists.io/projects/pragmater
292
292
  licenses:
293
293
  - Apache-2.0
294
294
  metadata:
295
- source_code_uri: https://github.com/bkuhlmann/pragmater
296
- changelog_uri: https://github.com/bkuhlmann/pragmater/blob/master/CHANGES.md
297
295
  bug_tracker_uri: https://github.com/bkuhlmann/pragmater/issues
296
+ changelog_uri: https://www.alchemists.io/projects/pragmater/changes.html
297
+ documentation_uri: https://www.alchemists.io/projects/pragmater
298
+ source_code_uri: https://github.com/bkuhlmann/pragmater
298
299
  post_install_message:
299
300
  rdoc_options: []
300
301
  require_paths:
metadata.gz.sig CHANGED
Binary file
data/README.md DELETED
@@ -1,263 +0,0 @@
1
- <p align="center">
2
- <img src="pragmater.png" alt="Pragmater Icon"/>
3
- </p>
4
-
5
- # Pragmater
6
-
7
- [![Gem Version](https://badge.fury.io/rb/pragmater.svg)](http://badge.fury.io/rb/pragmater)
8
- [![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/f0971ab6985309ce4db4/maintainability)](https://codeclimate.com/github/bkuhlmann/pragmater/maintainability)
9
- [![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/f0971ab6985309ce4db4/test_coverage)](https://codeclimate.com/github/bkuhlmann/pragmater/test_coverage)
10
- [![Circle CI Status](https://circleci.com/gh/bkuhlmann/pragmater.svg?style=svg)](https://circleci.com/gh/bkuhlmann/pragmater)
11
-
12
- A command line interface for managing/formatting source file [directive
13
- pragmas](https://en.wikipedia.org/wiki/Directive_(programming)) (a.k.a. *magic comments*). Examples:
14
-
15
- #! /usr/bin/env ruby
16
- # frozen_string_literal: true
17
- # encoding: UTF-8
18
-
19
- With [Ruby 2.3.0](https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released), frozen strings
20
- are supported via a pragma. This gem provides an easy way to add pragmas to single or multiple Ruby
21
- source files in order to benefit from improved memory and concurrency performance.
22
-
23
- <!-- Tocer[start]: Auto-generated, don't remove. -->
24
-
25
- ## Table of Contents
26
-
27
- - [Features](#features)
28
- - [Screencasts](#screencasts)
29
- - [Requirements](#requirements)
30
- - [Setup](#setup)
31
- - [Usage](#usage)
32
- - [Command Line Interface (CLI)](#command-line-interface-cli)
33
- - [Customization](#customization)
34
- - [Available Pragmas](#available-pragmas)
35
- - [Syntax](#syntax)
36
- - [Precedence](#precedence)
37
- - [Frozen String Literals](#frozen-string-literals)
38
- - [Tests](#tests)
39
- - [Versioning](#versioning)
40
- - [Code of Conduct](#code-of-conduct)
41
- - [Contributions](#contributions)
42
- - [License](#license)
43
- - [History](#history)
44
- - [Credits](#credits)
45
-
46
- <!-- Tocer[finish]: Auto-generated, don't remove. -->
47
-
48
- ## Features
49
-
50
- - Supports adding a pragma or multiple pragmas to single or multiple source files.
51
- - Supports removing pragma(s) from single or multiple source files.
52
- - Supports file list filtering. Defaults to any file.
53
- - Ensures duplicate pragmas never exist.
54
- - Ensures pragmas are consistently formatted.
55
-
56
- ## Screencasts
57
-
58
- [![asciicast](https://asciinema.org/a/278662.svg)](https://asciinema.org/a/278662)
59
-
60
- ## Requirements
61
-
62
- 1. [Ruby 2.7.x](https://www.ruby-lang.org)
63
-
64
- ## Setup
65
-
66
- Type the following to install:
67
-
68
- gem install pragmater
69
-
70
- ## Usage
71
-
72
- ### Command Line Interface (CLI)
73
-
74
- From the command line, type: `pragmater help`
75
-
76
- pragmater -a, [--add=PATH] # Add comments to source file(s).
77
- pragmater -c, [--config] # Manage gem configuration.
78
- pragmater -h, [--help=COMMAND] # Show this message or get help for a command.
79
- pragmater -r, [--remove=PATH] # Remove comments from source file(s).
80
- pragmater -v, [--version] # Show gem version.
81
-
82
- Both the `--add` and `--remove` commands support options for specifying pragmas and/or included
83
- files (viewable by running `pragmater --help --add` or `pragmater --help --remove`):
84
-
85
- -c, [--comments=one two three] # Define desired comments
86
- -i, [--includes=one two three] # Include specific files and/or directories
87
-
88
- Example (same options could be used for the `--remove` command too):
89
-
90
- pragmater --add --comments "# frozen_string_literal: true" --includes "Gemfile" "Guardfile" "Rakefile" ".gemspec" "config.ru" "bin/**/*" "**/*.rake" "**/*.rb"
91
-
92
- The `--add` and `--remove` commands default to the current working directory so a path isn't
93
- necessary unless you want to run Pragmater on a directory structure *other than* your current
94
- working directory.
95
-
96
- ### Customization
97
-
98
- This gem can be configured via a global configuration:
99
-
100
- ~/.config/pragmater/configuration.yml
101
-
102
- It can also be configured via [XDG](https://github.com/bkuhlmann/xdg) environment variables.
103
-
104
- The default configuration is as follows:
105
-
106
- :add:
107
- :comments: []
108
- :includes: []
109
- :remove:
110
- :comments: []
111
- :includes: []
112
-
113
- Feel free to take this default configuration, modify, and save as your own custom
114
- `configuration.yml`.
115
-
116
- The `configuration.yml` file can be configured as follows:
117
-
118
- - `add`: Defines global/local comments and/or file include lists when adding pragmas. The
119
- `comments` and `includes` options can be either a single string or an array.
120
- - `remove`: Defines global/local comments and/or file include lists when removing pragmas.
121
- The `comments` and `includes` options can be either a single string or an array.
122
-
123
- ### Available Pragmas
124
-
125
- With Ruby 2.3 and higher, the following pragmas are available:
126
-
127
- - `# encoding:` Defaults to `UTF-8` but any supported encoding can be used. For a list of values,
128
- launch an IRB session and run `Encoding.name_list`.
129
- - `# coding:` The shorthand for `# encoding:`. Supports the same values as mentioned above.
130
- - `# frozen_string_literal:` Defaults to `false` but can take either `true` or `false` as a value.
131
- When enabled, Ruby will throw errors when strings are used in a mutable fashion.
132
- - `# warn_indent:` Defaults to `false` but can take either `true` or `false` as a value. When
133
- enabled, and running Ruby with the `-w` option, it'll throw warnings for code that isn't indented
134
- by two spaces.
135
-
136
- ### Syntax
137
-
138
- The pragma syntax allows for two kinds of styles. Example:
139
-
140
- # encoding: UTF-8
141
- # -*- encoding: UTF-8 -*-
142
-
143
- Only the former syntax is supported by this gem as the latter syntax is more verbose and requires
144
- additional typing.
145
-
146
- ### Precedence
147
-
148
- When different multiple pragmas are defined, they all take precedence:
149
-
150
- # encoding: binary
151
- # frozen_string_literal: true
152
-
153
- In the above example, both *binary* encoding and *frozen string literals* behavior will be applied.
154
-
155
- When defining multiple pragmas that are similar, behavior can differ based on the *kind* of pragma
156
- used. The following walks through each use case so you know what to expect:
157
-
158
- # encoding: binary
159
- # encoding: UTF-8
160
-
161
- In the above example, only the *binary* encoding will be applied while the *UTF-8* encoding will be
162
- ignored (same principle applies for the `coding` pragma too).
163
-
164
- # frozen_string_literal: false
165
- # frozen_string_literal: true
166
-
167
- In the above example, frozen string literal support *will be enabled* instead of being disabled.
168
-
169
- # warn_indent: false
170
- # warn_indent: true
171
-
172
- In the above example, indentation warnings *will be enabled* instead of being disabled.
173
-
174
- ### Frozen String Literals
175
-
176
- Support for frozen string literals was added in Ruby 2.3.0. The ability to freeze strings within a
177
- source can be done by placing a frozen string pragma at the top of each source file. Example:
178
-
179
- # frozen_string_literal: true
180
-
181
- This is great for *selective* enablement of frozen string literals but might be too much work for
182
- some (even with the aid of this gem). As an alternative, frozen string literals can be enabled via
183
- the following Ruby command line option:
184
-
185
- --enable=frozen-string-literal
186
-
187
- It is important to note that, once enabled, this freezes strings program-wide -- It's an all or
188
- nothing option.
189
-
190
- Regardless of whether you leverage the capabilities of this gem or the Ruby command line option
191
- mentioned above, the following Ruby command line option is available to aid debugging and tracking
192
- down frozen string literal issues:
193
-
194
- --debug=frozen-string-literal
195
-
196
- Ruby 2.3.0 also added the following methods to the `String` class:
197
-
198
- - `String#+@`: Answers a duplicated, mutable, string if not already frozen. Example:
199
-
200
- immutable = "test".freeze
201
- mutable = +immutable
202
- mutable.capitalize! # => "Test"
203
-
204
- - `String#-@`: Answers a immutable string if not already frozen. Example:
205
-
206
- mutable = "test"
207
- immutable = -mutable
208
- immutable.capitalize! # => FrozenError
209
-
210
- You can also use the methods, shown above, for variable initialization. Example:
211
-
212
- immutable = -"test"
213
- mutable = +"test"
214
-
215
- Despite Ruby allowing you to do this, it is *not recommended* to use the above examples as it leads
216
- to hard to read code. Instead use the following:
217
-
218
- immutable = "test".freeze
219
- mutable = "test"
220
-
221
- While this requires extra typing, it expresses intent more clearly. There is a slight caveat to this
222
- rule in which the use of `String#-@` was [enhanced in Ruby 2.5.0](http://bit.ly/2DGAjgG) to
223
- *deduplicate* all instances of the same string thus reducing your memory footprint. This can be
224
- valuable in situations where you are not using the frozen string comment and need to selectively
225
- freeze strings.
226
-
227
- ## Tests
228
-
229
- To test, run:
230
-
231
- bundle exec rake
232
-
233
- ## Versioning
234
-
235
- Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
236
-
237
- - Major (X.y.z) - Incremented for any backwards incompatible public API changes.
238
- - Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
239
- - Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
240
-
241
- ## Code of Conduct
242
-
243
- Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
244
- participating in this project you agree to abide by its terms.
245
-
246
- ## Contributions
247
-
248
- Read [CONTRIBUTING](CONTRIBUTING.md) for details.
249
-
250
- ## License
251
-
252
- Copyright 2015 [Alchemists](https://www.alchemists.io).
253
- Read [LICENSE](LICENSE.md) for details.
254
-
255
- ## History
256
-
257
- Read [CHANGES](CHANGES.md) for details.
258
- Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
259
-
260
- ## Credits
261
-
262
- Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
263
- [Alchemists](https://www.alchemists.io).