pragmater 6.3.1 → 6.3.2

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: ff5f7fc682388910458e8d573febe3bb60888264b0fcf83157b7ba6fe4e06c2d
4
- data.tar.gz: 8b96e65b1565b4f62ff908795da0e8dcb073cb19cd92618d46c4d816e8e4a7be
3
+ metadata.gz: 3bbff78c69e65f1816000b849c2afc9221fe76abdc792c6fcfccb9b8ced75c36
4
+ data.tar.gz: 60dcd02d1968a0e09f36927057529872f5df5399514fd401c29fc95c3e348c60
5
5
  SHA512:
6
- metadata.gz: 4fb6f16a51f42901537a4224c093c1ececdc9373f0b0d29bb43dbe9f91837a5af7d8c175193e4490eea93e5cb1f1b4bebad89e24e9bafc9892d2c0730125e395
7
- data.tar.gz: 92cae9efd58fda6aeaa25e9f8c9ff293dca1c2d9810df3178cdbe8a53aa0a2e7c65fb206b9ce0d4efc24d9e023d9dc154b223d2947796040cedc2be9b1008f07
6
+ metadata.gz: 3fa916a2da9adacc71ee99edd4d8b4c8d1d5dbccecfa9c535a999699553e775f7e5e7153a82e25b90287b4e5b81b5731fdc28490974594d0b742cc1ff50d6aee
7
+ data.tar.gz: 1abfda2b22b89d5c4af0954d11aa48fa750a18c625089a125bdd42f6753a612b0f70a8ec5a357cdd8fa3732bae749f8f7a7712e4a3324a1f9a4c914c7e9b6188
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -9,17 +9,16 @@
9
9
  [![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/f0971ab6985309ce4db4/test_coverage)](https://codeclimate.com/github/bkuhlmann/pragmater/test_coverage)
10
10
  [![Circle CI Status](https://circleci.com/gh/bkuhlmann/pragmater.svg?style=svg)](https://circleci.com/gh/bkuhlmann/pragmater)
11
11
 
12
- A command line interface for managing/formatting source file
13
- [directive pragma](https://en.wikipedia.org/wiki/Directive_(programming)) comments
14
- (a.k.a. *magic comments*). Examples:
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:
15
14
 
16
15
  #! /usr/bin/env ruby
17
16
  # frozen_string_literal: true
18
17
  # encoding: UTF-8
19
18
 
20
19
  With [Ruby 2.3.0](https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released), frozen strings
21
- are supported via a pragma comment. This gem provides an easy way to add pragma comments to single
22
- or multiple Ruby source files in order to benefit from improved memory and concurrency performance.
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.
23
22
 
24
23
  <!-- Tocer[start]: Auto-generated, don't remove. -->
25
24
 
@@ -32,8 +31,10 @@ or multiple Ruby source files in order to benefit from improved memory and concu
32
31
  - [Usage](#usage)
33
32
  - [Command Line Interface (CLI)](#command-line-interface-cli)
34
33
  - [Customization](#customization)
34
+ - [Available Pragmas](#available-pragmas)
35
+ - [Syntax](#syntax)
36
+ - [Precedence](#precedence)
35
37
  - [Frozen String Literals](#frozen-string-literals)
36
- - [Available Comments](#available-comments)
37
38
  - [Tests](#tests)
38
39
  - [Versioning](#versioning)
39
40
  - [Code of Conduct](#code-of-conduct)
@@ -46,11 +47,11 @@ or multiple Ruby source files in order to benefit from improved memory and concu
46
47
 
47
48
  ## Features
48
49
 
49
- - Supports adding a pragma comment or multiple pragma comments to single or multiple source files.
50
- - Supports removing a pragma comment(s) from single or multiple source files.
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.
51
52
  - Supports file list filtering. Defaults to any file.
52
- - Ensures duplicate pragma comments never exist.
53
- - Ensures pragma comments are consistently formatted.
53
+ - Ensures duplicate pragmas never exist.
54
+ - Ensures pragmas are consistently formatted.
54
55
 
55
56
  ## Screencasts
56
57
 
@@ -72,17 +73,17 @@ Type the following to install:
72
73
 
73
74
  From the command line, type: `pragmater help`
74
75
 
75
- pragmater -a, [--add=PATH] # Add pragma comments to source file(s).
76
+ pragmater -a, [--add=PATH] # Add comments to source file(s).
76
77
  pragmater -c, [--config] # Manage gem configuration.
77
78
  pragmater -h, [--help=COMMAND] # Show this message or get help for a command.
78
- pragmater -r, [--remove=PATH] # Remove pragma comments from source file(s).
79
+ pragmater -r, [--remove=PATH] # Remove comments from source file(s).
79
80
  pragmater -v, [--version] # Show gem version.
80
81
 
81
- Both the `--add` and `--remove` commands support options for specifying pragma comments and/or
82
- included files (viewable by running `pragmater --help --add` or `pragmater --help --remove`):
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`):
83
84
 
84
- -c, [--comments=one two three] # Pragma comments
85
- -i, [--includes=one two three] # File include list
85
+ -c, [--comments=one two three] # Define desired comments
86
+ -i, [--includes=one two three] # Include specific files and/or directories
86
87
 
87
88
  Example (same options could be used for the `--remove` command too):
88
89
 
@@ -114,10 +115,61 @@ Feel free to take this default configuration, modify, and save as your own custo
114
115
 
115
116
  The `configuration.yml` file can be configured as follows:
116
117
 
117
- - `add`: Defines global/local comments and/or file include lists when adding pragma comments. The
118
- `comments` and `includes` options can be either a single string or an array of values.
119
- - `remove`: Defines global/local comments and/or file include lists when removing pragma comments.
120
- The `comments` and `includes` options can be either a single string or an array of values.
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.
121
173
 
122
174
  ### Frozen String Literals
123
175
 
@@ -167,24 +219,11 @@ to hard to read code. Instead use the following:
167
219
  mutable = "test"
168
220
 
169
221
  While this requires extra typing, it expresses intent more clearly. There is a slight caveat to this
170
- rule in that the use of `String#-@` was [enhanced in Ruby 2.5.0](http://bit.ly/2DGAjgG) to
222
+ rule in which the use of `String#-@` was [enhanced in Ruby 2.5.0](http://bit.ly/2DGAjgG) to
171
223
  *deduplicate* all instances of the same string thus reducing your memory footprint. This can be
172
224
  valuable in situations where you are not using the frozen string comment and need to selectively
173
225
  freeze strings.
174
226
 
175
- ### Available Comments
176
-
177
- With Ruby 2.3 and higher, the following comments are available:
178
-
179
- - `# encoding:` Defaults to `UTF-8` but any supported encoding can be used. For a list of values,
180
- launch an IRB session and run `Encoding.name_list`.
181
- - `# coding:` The shorthand for `# encoding:`. Supports the same values as mentioned above.
182
- - `# frozen_string_literal:` Defaults to `false` but can take either `true` or `false` as a value.
183
- When enabled, Ruby will throw errors when strings are used in a mutable fashion.
184
- - `# warn_indent:` Defaults to `false` but can take either `true` or `false` as a value. When
185
- enabled, and running Ruby with the `-w` option, it'll throw warnings for code that isn't indented
186
- by two spaces.
187
-
188
227
  ## Tests
189
228
 
190
229
  To test, run:
data/lib/pragmater/cli.rb CHANGED
@@ -35,16 +35,16 @@ module Pragmater
35
35
  abort error.message
36
36
  end
37
37
 
38
- desc "-a, [--add=PATH]", "Add pragma comments to source file(s)."
38
+ desc "-a, [--add=PATH]", "Add comments to source file(s)."
39
39
  map %w[-a --add] => :add
40
40
  method_option :comments,
41
41
  aliases: "-c",
42
- desc: "Pragma comments",
42
+ desc: "Define desired comments",
43
43
  type: :array,
44
44
  default: configuration.to_h.dig(:add, :comments)
45
45
  method_option :includes,
46
46
  aliases: "-i",
47
- desc: "File include list",
47
+ desc: "Include specific files and/or directories",
48
48
  type: :array,
49
49
  default: configuration.to_h.dig(:add, :includes)
50
50
  def add path = "."
@@ -59,16 +59,16 @@ module Pragmater
59
59
  runner.run(action: :add) { |file| say_status :info, "Processed: #{file}.", :green }
60
60
  end
61
61
 
62
- desc "-r, [--remove=PATH]", "Remove pragma comments from source file(s)."
62
+ desc "-r, [--remove=PATH]", "Remove comments from source file(s)."
63
63
  map %w[-r --remove] => :remove
64
64
  method_option :comments,
65
65
  aliases: "-c",
66
- desc: "Pragma comments",
66
+ desc: "Define desired comments",
67
67
  type: :array,
68
68
  default: configuration.to_h.dig(:remove, :comments)
69
69
  method_option :includes,
70
70
  aliases: "-i",
71
- desc: "File include list",
71
+ desc: "Include specific files and/or directories",
72
72
  type: :array,
73
73
  default: configuration.to_h.dig(:remove, :includes)
74
74
  def remove path = "."
@@ -12,7 +12,7 @@ module Pragmater
12
12
  end
13
13
 
14
14
  def self.version
15
- "6.3.1"
15
+ "6.3.2"
16
16
  end
17
17
 
18
18
  def self.version_label
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: 6.3.1
4
+ version: 6.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  dKvURM+1PwDCzC5tvRwjhUJIizau6+MtkFCvJHmaAj1aZL3odcPejHj5Hxt/0CUW
29
29
  y84=
30
30
  -----END CERTIFICATE-----
31
- date: 2019-07-01 00:00:00.000000000 Z
31
+ date: 2019-09-01 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: runcom
@@ -246,14 +246,14 @@ dependencies:
246
246
  requirements:
247
247
  - - "~>"
248
248
  - !ruby/object:Gem::Version
249
- version: '0.69'
249
+ version: '0.73'
250
250
  type: :development
251
251
  prerelease: false
252
252
  version_requirements: !ruby/object:Gem::Requirement
253
253
  requirements:
254
254
  - - "~>"
255
255
  - !ruby/object:Gem::Version
256
- version: '0.69'
256
+ version: '0.73'
257
257
  - !ruby/object:Gem::Dependency
258
258
  name: rubocop-performance
259
259
  requirement: !ruby/object:Gem::Requirement
@@ -352,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
352
  - !ruby/object:Gem::Version
353
353
  version: '0'
354
354
  requirements: []
355
- rubygems_version: 3.0.4
355
+ rubygems_version: 3.0.6
356
356
  signing_key:
357
357
  specification_version: 4
358
358
  summary: A command line interface for managing/formatting source file pragma comments.
metadata.gz.sig CHANGED
Binary file