pragmater 7.1.0 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pragmater
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0
4
+ version: 8.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -28,247 +28,37 @@ cert_chain:
28
28
  2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
29
  QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-04-01 00:00:00.000000000 Z
31
+ date: 2020-12-14 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
- name: runcom
34
+ name: refinements
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '6.0'
39
+ version: '7.16'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '6.0'
46
+ version: '7.16'
47
47
  - !ruby/object:Gem::Dependency
48
- name: thor
48
+ name: runcom
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.20'
53
+ version: '6.4'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0.20'
61
- - !ruby/object:Gem::Dependency
62
- name: bundler-audit
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '0.6'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '0.6'
75
- - !ruby/object:Gem::Dependency
76
- name: climate_control
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '0.2'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '0.2'
89
- - !ruby/object:Gem::Dependency
90
- name: gemsmith
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '14.0'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '14.0'
103
- - !ruby/object:Gem::Dependency
104
- name: git-cop
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '4.0'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '4.0'
117
- - !ruby/object:Gem::Dependency
118
- name: guard-rspec
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '4.7'
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: '4.7'
131
- - !ruby/object:Gem::Dependency
132
- name: pry
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '0.12'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '0.12'
145
- - !ruby/object:Gem::Dependency
146
- name: pry-byebug
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '3.7'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '3.7'
159
- - !ruby/object:Gem::Dependency
160
- name: rake
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '13.0'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '13.0'
173
- - !ruby/object:Gem::Dependency
174
- name: reek
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '6.0'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '6.0'
187
- - !ruby/object:Gem::Dependency
188
- name: rspec
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '3.9'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - "~>"
199
- - !ruby/object:Gem::Version
200
- version: '3.9'
201
- - !ruby/object:Gem::Dependency
202
- name: rubocop
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - "~>"
206
- - !ruby/object:Gem::Version
207
- version: '0.79'
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - "~>"
213
- - !ruby/object:Gem::Version
214
- version: '0.79'
215
- - !ruby/object:Gem::Dependency
216
- name: rubocop-performance
217
- requirement: !ruby/object:Gem::Requirement
218
- requirements:
219
- - - "~>"
220
- - !ruby/object:Gem::Version
221
- version: '1.5'
222
- type: :development
223
- prerelease: false
224
- version_requirements: !ruby/object:Gem::Requirement
225
- requirements:
226
- - - "~>"
227
- - !ruby/object:Gem::Version
228
- version: '1.5'
229
- - !ruby/object:Gem::Dependency
230
- name: rubocop-rake
231
- requirement: !ruby/object:Gem::Requirement
232
- requirements:
233
- - - "~>"
234
- - !ruby/object:Gem::Version
235
- version: '0.5'
236
- type: :development
237
- prerelease: false
238
- version_requirements: !ruby/object:Gem::Requirement
239
- requirements:
240
- - - "~>"
241
- - !ruby/object:Gem::Version
242
- version: '0.5'
243
- - !ruby/object:Gem::Dependency
244
- name: rubocop-rspec
245
- requirement: !ruby/object:Gem::Requirement
246
- requirements:
247
- - - "~>"
248
- - !ruby/object:Gem::Version
249
- version: '1.37'
250
- type: :development
251
- prerelease: false
252
- version_requirements: !ruby/object:Gem::Requirement
253
- requirements:
254
- - - "~>"
255
- - !ruby/object:Gem::Version
256
- version: '1.37'
257
- - !ruby/object:Gem::Dependency
258
- name: simplecov
259
- requirement: !ruby/object:Gem::Requirement
260
- requirements:
261
- - - "~>"
262
- - !ruby/object:Gem::Version
263
- version: '0.18'
264
- type: :development
265
- prerelease: false
266
- version_requirements: !ruby/object:Gem::Requirement
267
- requirements:
268
- - - "~>"
269
- - !ruby/object:Gem::Version
270
- version: '0.18'
271
- description:
60
+ version: '6.4'
61
+ description:
272
62
  email:
273
63
  - brooke@alchemists.io
274
64
  executables:
@@ -282,12 +72,25 @@ files:
282
72
  - README.adoc
283
73
  - bin/pragmater
284
74
  - lib/pragmater.rb
285
- - lib/pragmater/cli.rb
286
- - lib/pragmater/commenter.rb
287
- - lib/pragmater/formatter.rb
75
+ - lib/pragmater/cli/helper.rb
76
+ - lib/pragmater/cli/options/assembler.rb
77
+ - lib/pragmater/cli/options/configuration.rb
78
+ - lib/pragmater/cli/options/core.rb
79
+ - lib/pragmater/cli/options/defaults.yml
80
+ - lib/pragmater/cli/options/insert_remove.rb
81
+ - lib/pragmater/cli/options/merger.rb
82
+ - lib/pragmater/cli/shell.rb
83
+ - lib/pragmater/context.rb
84
+ - lib/pragmater/formatters/general.rb
85
+ - lib/pragmater/formatters/main.rb
86
+ - lib/pragmater/formatters/shebang.rb
288
87
  - lib/pragmater/identity.rb
88
+ - lib/pragmater/parsers/comments.rb
89
+ - lib/pragmater/parsers/file.rb
90
+ - lib/pragmater/processors/handler.rb
91
+ - lib/pragmater/processors/inserter.rb
92
+ - lib/pragmater/processors/remover.rb
289
93
  - lib/pragmater/runner.rb
290
- - lib/pragmater/writer.rb
291
94
  homepage: https://www.alchemists.io/projects/pragmater
292
95
  licenses:
293
96
  - Apache-2.0
@@ -296,7 +99,7 @@ metadata:
296
99
  changelog_uri: https://www.alchemists.io/projects/pragmater/changes.html
297
100
  documentation_uri: https://www.alchemists.io/projects/pragmater
298
101
  source_code_uri: https://github.com/bkuhlmann/pragmater
299
- post_install_message:
102
+ post_install_message:
300
103
  rdoc_options: []
301
104
  require_paths:
302
105
  - lib
@@ -311,8 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
114
  - !ruby/object:Gem::Version
312
115
  version: '0'
313
116
  requirements: []
314
- rubygems_version: 3.1.2
315
- signing_key:
117
+ rubygems_version: 3.2.0
118
+ signing_key:
316
119
  specification_version: 4
317
120
  summary: A command line interface for managing/formatting source file pragma comments.
318
121
  test_files: []
metadata.gz.sig CHANGED
Binary file
@@ -1,124 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pathname"
4
- require "thor"
5
- require "thor/actions"
6
- require "runcom"
7
-
8
- module Pragmater
9
- # The Command Line Interface (CLI) for the gem.
10
- class CLI < Thor
11
- include Thor::Actions
12
-
13
- package_name Identity::VERSION_LABEL
14
-
15
- # rubocop:disable Metrics/MethodLength
16
- def self.configuration
17
- Runcom::Config.new "#{Identity::NAME}/configuration.yml",
18
- defaults: {
19
- add: {
20
- comments: "",
21
- includes: []
22
- },
23
- remove: {
24
- comments: "",
25
- includes: []
26
- }
27
- }
28
- end
29
- # rubocop:enable Metrics/MethodLength
30
-
31
- def initialize args = [], options = {}, config = {}
32
- super args, options, config
33
- @configuration = self.class.configuration
34
- rescue Runcom::Errors::Base => error
35
- abort error.message
36
- end
37
-
38
- desc "-a, [--add=PATH]", "Add comments to source file(s)."
39
- map %w[-a --add] => :add
40
- method_option :comments,
41
- aliases: "-c",
42
- desc: "Define desired comments",
43
- type: :array,
44
- default: configuration.to_h.dig(:add, :comments)
45
- method_option :includes,
46
- aliases: "-i",
47
- desc: "Include specific files and/or directories",
48
- type: :array,
49
- default: configuration.to_h.dig(:add, :includes)
50
- def add path = "."
51
- settings = configuration.merge(
52
- add: {comments: options.comments, includes: options.includes}
53
- ).to_h
54
-
55
- runner = Runner.new path,
56
- comments: settings.dig(:add, :comments),
57
- includes: settings.dig(:add, :includes)
58
-
59
- runner.run(action: :add) { |file| say_status :info, "Processed: #{file}.", :green }
60
- end
61
-
62
- desc "-r, [--remove=PATH]", "Remove comments from source file(s)."
63
- map %w[-r --remove] => :remove
64
- method_option :comments,
65
- aliases: "-c",
66
- desc: "Define desired comments",
67
- type: :array,
68
- default: configuration.to_h.dig(:remove, :comments)
69
- method_option :includes,
70
- aliases: "-i",
71
- desc: "Include specific files and/or directories",
72
- type: :array,
73
- default: configuration.to_h.dig(:remove, :includes)
74
- def remove path = "."
75
- settings = configuration.merge(
76
- remove: {comments: options.comments, includes: options.includes}
77
- ).to_h
78
-
79
- runner = Runner.new path,
80
- comments: settings.dig(:remove, :comments),
81
- includes: settings.dig(:remove, :includes)
82
-
83
- runner.run(action: :remove) { |file| say_status :info, "Processed: #{file}.", :green }
84
- end
85
-
86
- desc "-c, [--config]", "Manage gem configuration."
87
- map %w[-c --config] => :config
88
- method_option :edit,
89
- aliases: "-e",
90
- desc: "Edit gem configuration.",
91
- type: :boolean,
92
- default: false
93
- method_option :info,
94
- aliases: "-i",
95
- desc: "Print gem configuration.",
96
- type: :boolean,
97
- default: false
98
- def config
99
- path = configuration.current
100
-
101
- if options.edit? then `#{ENV["EDITOR"]} #{path}`
102
- elsif options.info?
103
- path ? say(path) : say("Configuration doesn't exist.")
104
- else help :config
105
- end
106
- end
107
-
108
- desc "-v, [--version]", "Show gem version."
109
- map %w[-v --version] => :version
110
- def version
111
- say Identity::VERSION_LABEL
112
- end
113
-
114
- desc "-h, [--help=COMMAND]", "Show this message or get help for a command."
115
- map %w[-h --help] => :help
116
- def help task = nil
117
- say and super
118
- end
119
-
120
- private
121
-
122
- attr_reader :configuration
123
- end
124
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Pragmater
4
- # Handles pragma comments.
5
- class Commenter
6
- def initialize older, newer, formatter: Formatter
7
- @formatter = formatter
8
- @older = format older
9
- @newer = format newer
10
- end
11
-
12
- def add
13
- older | newer
14
- end
15
-
16
- def remove
17
- older - (older & newer)
18
- end
19
-
20
- private
21
-
22
- attr_reader :older, :newer, :formatter
23
-
24
- def filter comments
25
- Array(comments).select { |comment| comment =~ formatter.valid_formats }
26
- end
27
-
28
- def format comments
29
- filter(comments).map { |comment| formatter.new(comment).format }
30
- end
31
- end
32
- end