planter-cli 3.0.1 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/.rubocop.yml +1 -2
- data/CHANGELOG.md +24 -0
- data/README.md +85 -4
- data/bin/plant +1 -1
- data/docker/Dockerfile +2 -4
- data/docker/Dockerfile-2.6 +4 -5
- data/docker/Dockerfile-2.7 +4 -5
- data/docker/Dockerfile-3.0 +4 -4
- data/docker/Dockerfile-3.3 +12 -0
- data/docker/bash_profile +2 -1
- data/docker/sources.list +11 -0
- data/lib/planter/array.rb +56 -1
- data/lib/planter/filelist.rb +5 -4
- data/lib/planter/hash.rb +24 -0
- data/lib/planter/plant.rb +6 -4
- data/lib/planter/prompt.rb +56 -16
- data/lib/planter/string.rb +143 -5
- data/lib/planter/tag.rb +39 -2
- data/lib/planter/version.rb +1 -1
- data/lib/planter.rb +30 -17
- data/lib/tty-spinner/.editorconfig +9 -0
- data/lib/tty-spinner/.github/FUNDING.yml +1 -0
- data/lib/tty-spinner/.github/ISSUE_TEMPLATE/BUG_REPORT.md +31 -0
- data/lib/tty-spinner/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +23 -0
- data/lib/tty-spinner/.github/ISSUE_TEMPLATE/config.yml +5 -0
- data/lib/tty-spinner/.github/PULL_REQUEST_TEMPLATE.md +19 -0
- data/lib/tty-spinner/.github/workflows/ci.yml +59 -0
- data/lib/tty-spinner/.gitignore +14 -0
- data/lib/tty-spinner/.rspec +2 -0
- data/lib/tty-spinner/.rubocop.yml +78 -0
- data/lib/tty-spinner/CHANGELOG.md +151 -0
- data/lib/tty-spinner/CODE_OF_CONDUCT.md +132 -0
- data/lib/tty-spinner/Gemfile +17 -0
- data/lib/tty-spinner/LICENSE.txt +22 -0
- data/lib/tty-spinner/README.md +581 -0
- data/lib/tty-spinner/Rakefile +10 -0
- data/lib/tty-spinner/appveyor.yml +33 -0
- data/lib/tty-spinner/bin/console +14 -0
- data/lib/tty-spinner/bin/setup +8 -0
- data/lib/tty-spinner/demo.gif +0 -0
- data/lib/tty-spinner/examples/auto_spin.rb +10 -0
- data/lib/tty-spinner/examples/basic.rb +10 -0
- data/lib/tty-spinner/examples/clear.rb +11 -0
- data/lib/tty-spinner/examples/color.rb +14 -0
- data/lib/tty-spinner/examples/error.rb +11 -0
- data/lib/tty-spinner/examples/formats.rb +13 -0
- data/lib/tty-spinner/examples/hide_cursor.rb +14 -0
- data/lib/tty-spinner/examples/log.rb +13 -0
- data/lib/tty-spinner/examples/multi/basic.rb +15 -0
- data/lib/tty-spinner/examples/multi/basic_top_level.rb +15 -0
- data/lib/tty-spinner/examples/multi/custom_style.rb +28 -0
- data/lib/tty-spinner/examples/multi/files.rb +16 -0
- data/lib/tty-spinner/examples/multi/jobs.rb +11 -0
- data/lib/tty-spinner/examples/multi/multi.rb +19 -0
- data/lib/tty-spinner/examples/multi/multi_top_level.rb +20 -0
- data/lib/tty-spinner/examples/multi/pause.rb +28 -0
- data/lib/tty-spinner/examples/multi/threaded.rb +30 -0
- data/lib/tty-spinner/examples/pause.rb +24 -0
- data/lib/tty-spinner/examples/run.rb +20 -0
- data/lib/tty-spinner/examples/success.rb +11 -0
- data/lib/tty-spinner/examples/threaded.rb +13 -0
- data/lib/tty-spinner/examples/update.rb +13 -0
- data/lib/tty-spinner/lib/tty/spinner/formats.rb +274 -0
- data/lib/tty-spinner/lib/tty/spinner/multi.rb +352 -0
- data/lib/tty-spinner/lib/tty/spinner/version.rb +7 -0
- data/lib/tty-spinner/lib/tty/spinner.rb +604 -0
- data/lib/tty-spinner/lib/tty-spinner.rb +2 -0
- data/lib/tty-spinner/spec/spec_helper.rb +52 -0
- data/lib/tty-spinner/spec/unit/auto_spin_spec.rb +25 -0
- data/lib/tty-spinner/spec/unit/clear_spec.rb +16 -0
- data/lib/tty-spinner/spec/unit/error_spec.rb +53 -0
- data/lib/tty-spinner/spec/unit/events_spec.rb +35 -0
- data/lib/tty-spinner/spec/unit/formats_spec.rb +9 -0
- data/lib/tty-spinner/spec/unit/frames_spec.rb +31 -0
- data/lib/tty-spinner/spec/unit/hide_cursor_spec.rb +51 -0
- data/lib/tty-spinner/spec/unit/job_spec.rb +12 -0
- data/lib/tty-spinner/spec/unit/join_spec.rb +10 -0
- data/lib/tty-spinner/spec/unit/log_spec.rb +60 -0
- data/lib/tty-spinner/spec/unit/multi/auto_spin_spec.rb +32 -0
- data/lib/tty-spinner/spec/unit/multi/error_spec.rb +107 -0
- data/lib/tty-spinner/spec/unit/multi/line_inset_spec.rb +57 -0
- data/lib/tty-spinner/spec/unit/multi/on_spec.rb +11 -0
- data/lib/tty-spinner/spec/unit/multi/register_spec.rb +46 -0
- data/lib/tty-spinner/spec/unit/multi/spin_spec.rb +101 -0
- data/lib/tty-spinner/spec/unit/multi/stop_spec.rb +95 -0
- data/lib/tty-spinner/spec/unit/multi/success_spec.rb +108 -0
- data/lib/tty-spinner/spec/unit/new_spec.rb +25 -0
- data/lib/tty-spinner/spec/unit/pause_spec.rb +43 -0
- data/lib/tty-spinner/spec/unit/reset_spec.rb +19 -0
- data/lib/tty-spinner/spec/unit/run_spec.rb +30 -0
- data/lib/tty-spinner/spec/unit/spin_spec.rb +117 -0
- data/lib/tty-spinner/spec/unit/stop_spec.rb +88 -0
- data/lib/tty-spinner/spec/unit/success_spec.rb +53 -0
- data/lib/tty-spinner/spec/unit/tty_spec.rb +8 -0
- data/lib/tty-spinner/spec/unit/update_spec.rb +85 -0
- data/lib/tty-spinner/tasks/console.rake +11 -0
- data/lib/tty-spinner/tasks/coverage.rake +11 -0
- data/lib/tty-spinner/tasks/spec.rake +29 -0
- data/lib/tty-spinner/tty-spinner.gemspec +36 -0
- data/scripts/runtests.sh +1 -1
- data/spec/cli_spec.rb +27 -0
- data/spec/planter/string_spec.rb +31 -4
- data/spec/spec_helper.rb +26 -0
- data/spec/templates/test/_planter.yml +3 -6
- data/src/_README.md +85 -4
- metadata +86 -2
data/lib/planter/string.rb
CHANGED
@@ -12,7 +12,42 @@ module Planter
|
|
12
12
|
## @return [Symbol] string as variable key
|
13
13
|
##
|
14
14
|
def to_var
|
15
|
-
snake_case.to_sym
|
15
|
+
strip_quotes.snake_case.to_sym
|
16
|
+
end
|
17
|
+
|
18
|
+
## Strip quotes from a string
|
19
|
+
##
|
20
|
+
## @return [String] string with quotes stripped
|
21
|
+
##
|
22
|
+
def strip_quotes
|
23
|
+
sub(/^(["'])(.*)\1$/, '\2')
|
24
|
+
end
|
25
|
+
|
26
|
+
## Destructive version of #strip_quotes
|
27
|
+
def strip_quotes!
|
28
|
+
replace strip_quotes
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Convert {a,b,c} to (?:a|b|c)
|
33
|
+
#
|
34
|
+
# @return [String] Converted string
|
35
|
+
#
|
36
|
+
def glob_to_rx
|
37
|
+
gsub(/\\?\{(.*?)\\?\}/) do
|
38
|
+
m = Regexp.last_match
|
39
|
+
"(?:#{m[1].split(/,/).map { |c| Regexp.escape(c) }.join('|')})"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Convert a string to a regular expression by escaping special
|
45
|
+
# characters and converting wildcards (*,?) to regex wildcards
|
46
|
+
#
|
47
|
+
# @return [String] String with wildcards converted (not Regexp)
|
48
|
+
#
|
49
|
+
def to_rx
|
50
|
+
gsub(/([.()])/, '\\\\\1').gsub(/\?/, '.').gsub(/\*/, '.*?').glob_to_rx
|
16
51
|
end
|
17
52
|
|
18
53
|
##
|
@@ -162,6 +197,96 @@ module Planter
|
|
162
197
|
replace apply_defaults(variables)
|
163
198
|
end
|
164
199
|
|
200
|
+
## Apply logic to a string
|
201
|
+
##
|
202
|
+
## @param variables [Hash] Hash of variables to apply
|
203
|
+
##
|
204
|
+
def apply_logic(variables = nil)
|
205
|
+
variables = variables.nil? ? Planter.variables : variables
|
206
|
+
|
207
|
+
gsub(/%%if .*?%%.*?%%end(if)?%%/mi) do |construct|
|
208
|
+
res = false
|
209
|
+
# Get the condition and the content
|
210
|
+
output = construct.match(/%%else%%(.*?)%%end/m) ? Regexp.last_match(1) : ''
|
211
|
+
|
212
|
+
conditions = construct.to_enum(:scan,
|
213
|
+
/%%(?<statement>(?:els(?:e )?)?if) (?<condition>.*?)%%(?<content>.*?)(?=%%)/mi).map do
|
214
|
+
Regexp.last_match
|
215
|
+
end
|
216
|
+
conditions.each do |condition|
|
217
|
+
variable, operator, value = condition['condition'].split(/ +/, 3)
|
218
|
+
value.strip_quotes!
|
219
|
+
variable = variable.to_var
|
220
|
+
negate = false
|
221
|
+
if operator =~ /^!/
|
222
|
+
operator = operator[1..-1]
|
223
|
+
negate = true
|
224
|
+
end
|
225
|
+
operator = case operator
|
226
|
+
when /^={1,2}/
|
227
|
+
:equal
|
228
|
+
when /^=~/
|
229
|
+
:matches_regex
|
230
|
+
when /\*=/
|
231
|
+
:contains
|
232
|
+
when /\^=/
|
233
|
+
:starts_with
|
234
|
+
when /\$=/
|
235
|
+
:ends_with
|
236
|
+
when />/
|
237
|
+
:greater_than
|
238
|
+
when /</
|
239
|
+
:less_than
|
240
|
+
when />=/
|
241
|
+
:greater_than_or_equal
|
242
|
+
when /<=/
|
243
|
+
:less_than_or_equal
|
244
|
+
else
|
245
|
+
:equal
|
246
|
+
end
|
247
|
+
|
248
|
+
comp = variables[variable.to_var].to_s
|
249
|
+
|
250
|
+
res = case operator
|
251
|
+
when :equal
|
252
|
+
comp =~ /^#{value}$/i
|
253
|
+
when :matches_regex
|
254
|
+
comp =~ Regexp.new(value.gsub(%r{^/|/$}, ''))
|
255
|
+
when :contains
|
256
|
+
comp =~ /#{value}/i
|
257
|
+
when :starts_with
|
258
|
+
comp =~ /^#{value}/i
|
259
|
+
when :ends_with
|
260
|
+
comp =~ /#{value}$/i
|
261
|
+
when :greater_than
|
262
|
+
comp > value.to_f
|
263
|
+
when :less_than
|
264
|
+
comp < value.to_f
|
265
|
+
when :greater_than_or_equal
|
266
|
+
comp >= value.to_f
|
267
|
+
when :less_than_or_equal
|
268
|
+
comp <= value.to_f
|
269
|
+
else
|
270
|
+
false
|
271
|
+
end
|
272
|
+
res = !res if negate
|
273
|
+
|
274
|
+
next unless res
|
275
|
+
|
276
|
+
Planter.notify("Condition matched: #{comp} #{negate ? 'not ' : ''}#{operator} #{value}", :debug)
|
277
|
+
output = condition['content']
|
278
|
+
break
|
279
|
+
end
|
280
|
+
|
281
|
+
output
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
## Destructive version of #apply_logic
|
286
|
+
def apply_logic!(variables)
|
287
|
+
replace apply_logic(variables)
|
288
|
+
end
|
289
|
+
|
165
290
|
##
|
166
291
|
## Apply key/value substitutions to a string. Variables are represented as
|
167
292
|
## %%key%%, and the hash passed to the function is { key: value }
|
@@ -177,6 +302,8 @@ module Planter
|
|
177
302
|
|
178
303
|
content = content.apply_defaults(variables)
|
179
304
|
|
305
|
+
content = content.apply_logic(variables)
|
306
|
+
|
180
307
|
variables.each do |k, v|
|
181
308
|
if last_only
|
182
309
|
pattern = "%%#{k.to_var}"
|
@@ -415,15 +542,18 @@ module Planter
|
|
415
542
|
# number or float
|
416
543
|
when /^[nf]/
|
417
544
|
:float
|
418
|
-
#
|
419
|
-
when /^
|
545
|
+
# paragraph
|
546
|
+
when /^p/
|
420
547
|
:multiline
|
421
548
|
# class
|
422
|
-
when /^
|
549
|
+
when /^cl/
|
423
550
|
:class
|
424
551
|
# module
|
425
|
-
when /^
|
552
|
+
when /^mod/
|
426
553
|
:module
|
554
|
+
# multiple choice
|
555
|
+
when /^(ch|mu)/
|
556
|
+
:choice
|
427
557
|
# string
|
428
558
|
else
|
429
559
|
:string
|
@@ -471,6 +601,14 @@ module Planter
|
|
471
601
|
replace clean_encode
|
472
602
|
end
|
473
603
|
|
604
|
+
## Clean up a string by removing leading numbers and parentheticalse
|
605
|
+
##
|
606
|
+
## @return [String] cleaned string
|
607
|
+
##
|
608
|
+
def clean_value
|
609
|
+
sub(/^\(?\d+\.\)? +/, '').sub(/\((.*?)\)/, '\1')
|
610
|
+
end
|
611
|
+
|
474
612
|
##
|
475
613
|
## Highlight characters in parenthesis, with special color for default if
|
476
614
|
## provided. Output is color templated string, unprocessed.
|
data/lib/planter/tag.rb
CHANGED
@@ -4,6 +4,8 @@ module Planter
|
|
4
4
|
module Tag
|
5
5
|
class << self
|
6
6
|
def set(target, tags)
|
7
|
+
return false unless TTY::Which.exist?('xattr')
|
8
|
+
|
7
9
|
tags = [tags] unless tags.is_a?(Array)
|
8
10
|
|
9
11
|
set_tags(target, tags)
|
@@ -15,15 +17,28 @@ module Planter
|
|
15
17
|
# @param dir [String] The directory to tag.
|
16
18
|
# @param tags [Array<String>] The tags to add.
|
17
19
|
def add(target, tags)
|
20
|
+
return false unless TTY::Which.exist?('xattr')
|
21
|
+
|
18
22
|
tags = [tags] unless tags.is_a?(Array)
|
19
23
|
existing_tags = get(target)
|
20
24
|
tags.concat(existing_tags).uniq!
|
21
25
|
|
22
26
|
set_tags(target, tags)
|
23
|
-
|
27
|
+
|
28
|
+
res = $? == 0
|
29
|
+
|
30
|
+
if res
|
31
|
+
Planter.notify("[Added tags] to #{target}", :debug, above_spinner: true)
|
32
|
+
else
|
33
|
+
Planter.notify("Failed to add tags to #{target}", :error)
|
34
|
+
end
|
35
|
+
|
36
|
+
res
|
24
37
|
end
|
25
38
|
|
26
39
|
def get(target)
|
40
|
+
return false unless TTY::Which.exist?('xattr')
|
41
|
+
|
27
42
|
res = `xattr -p com.apple.metadata:_kMDItemUserTags "#{target}" 2>/dev/null`.clean_encode
|
28
43
|
return [] if res =~ /no such xattr/ || res.empty?
|
29
44
|
|
@@ -35,19 +50,41 @@ module Planter
|
|
35
50
|
end
|
36
51
|
|
37
52
|
def copy(source, target)
|
53
|
+
return false unless TTY::Which.exist?('xattr')
|
54
|
+
|
38
55
|
tags = `xattr -px com.apple.metadata:_kMDItemUserTags "#{source}" 2>/dev/null`
|
39
56
|
`xattr -wx com.apple.metadata:_kMDItemUserTags "#{tags}" "#{target}"`
|
40
|
-
$? == 0
|
57
|
+
res = $? == 0
|
58
|
+
|
59
|
+
if res
|
60
|
+
Planter.notify("[Copied tags] from #{source} to #{target}", :debug, above_spinner: true)
|
61
|
+
else
|
62
|
+
Planter.notify("Failed to copy tags from #{source} to #{target}", :error)
|
63
|
+
end
|
64
|
+
|
65
|
+
res
|
41
66
|
end
|
42
67
|
|
43
68
|
private
|
44
69
|
|
45
70
|
def set_tags(target, tags)
|
71
|
+
return false unless TTY::Which.exist?('xattr')
|
72
|
+
|
46
73
|
tags.map! { |tag| "<string>#{tag}</string>" }
|
47
74
|
`xattr -w com.apple.metadata:_kMDItemUserTags '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
48
75
|
<plist version="1.0">
|
49
76
|
<array>#{tags.join}</array>
|
50
77
|
</plist>' "#{target}"`
|
78
|
+
|
79
|
+
res = $? == 0
|
80
|
+
|
81
|
+
if res
|
82
|
+
Planter.notify("[Set tags] on #{target}", :debug, above_spinner: true)
|
83
|
+
else
|
84
|
+
Planter.notify("Failed to set tags on #{target}", :error)
|
85
|
+
end
|
86
|
+
|
87
|
+
res
|
51
88
|
end
|
52
89
|
end
|
53
90
|
end
|
data/lib/planter/version.rb
CHANGED
data/lib/planter.rb
CHANGED
@@ -11,9 +11,10 @@ require 'plist'
|
|
11
11
|
require 'chronic'
|
12
12
|
require 'tty-reader'
|
13
13
|
require 'tty-screen'
|
14
|
-
require 'tty-spinner'
|
14
|
+
# require 'tty-spinner'
|
15
15
|
require 'tty-which'
|
16
16
|
|
17
|
+
require_relative 'tty-spinner/lib/tty-spinner'
|
17
18
|
require_relative 'planter/version'
|
18
19
|
require_relative 'planter/hash'
|
19
20
|
require_relative 'planter/array'
|
@@ -72,20 +73,28 @@ module Planter
|
|
72
73
|
## @param string [String] The message string
|
73
74
|
## @param notification_type [Symbol] The notification type (:debug, :error, :warn, :info)
|
74
75
|
## @param exit_code [Integer] If provided, exit with code after delivering message
|
76
|
+
## @param newline [Boolean] If true, add a newline to the message
|
77
|
+
## @param above_spinner [Boolean] If true, print above the spinner
|
75
78
|
##
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
79
|
+
## @return [Boolean] true if message was printed
|
80
|
+
def notify(string, notification_type = :info, newline: true, above_spinner: false, exit_code: nil)
|
81
|
+
color = case notification_type
|
82
|
+
when :debug
|
83
|
+
return false unless @debug
|
84
|
+
|
85
|
+
'{dw}'
|
86
|
+
when :error
|
87
|
+
'{br}'
|
88
|
+
|
89
|
+
when :warn
|
90
|
+
'{by}'
|
91
|
+
else
|
92
|
+
'{bw}'
|
93
|
+
end
|
94
|
+
out = "#{color}#{string}{x}"
|
95
|
+
out = out.gsub(/\[(.*?)\]/, "{by}\\1{x}#{color}")
|
96
|
+
out = "\n#{out}" if newline
|
97
|
+
above_spinner ? spinner.log(out.x) : warn(out.x)
|
89
98
|
|
90
99
|
Process.exit exit_code unless exit_code.nil?
|
91
100
|
|
@@ -197,13 +206,17 @@ module Planter
|
|
197
206
|
key: 'var_key',
|
198
207
|
prompt: 'CLI Prompt',
|
199
208
|
type: '[string, float, integer, number, date]',
|
200
|
-
value: '(optional,
|
209
|
+
value: '(optional, force value, can include variables. Empty to prompt. For date type: today, now, etc.)',
|
201
210
|
default: '(optional default value, leave empty or remove key for no default)',
|
202
211
|
min: '(optional, for number type set a minimum value)',
|
203
212
|
max: '(optional, for number type set a maximum value)'
|
204
213
|
],
|
205
214
|
git_init: false,
|
206
|
-
files: {
|
215
|
+
files: {
|
216
|
+
'*.tmp' => 'ignore',
|
217
|
+
'*.bak' => 'ignore',
|
218
|
+
'.DS_Store' => 'ignore'
|
219
|
+
}
|
207
220
|
}
|
208
221
|
FileUtils.mkdir_p(base_dir)
|
209
222
|
File.open(config, 'w') { |f| f.puts(YAML.dump(default_config.stringify_keys)) }
|
@@ -238,7 +251,7 @@ module Planter
|
|
238
251
|
def process_patterns
|
239
252
|
patterns = {}
|
240
253
|
@config[:files].each do |file, oper|
|
241
|
-
pattern = Regexp.new(".*?/#{file.to_s.sub(%r{^/}, '').
|
254
|
+
pattern = Regexp.new(".*?/#{file.to_s.sub(%r{^/}, '').to_rx}$")
|
242
255
|
operator = oper.normalize_operator
|
243
256
|
patterns[pattern] = operator
|
244
257
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
github: piotrmurach
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Report something not working correctly or as expected
|
4
|
+
title: ''
|
5
|
+
labels: bug
|
6
|
+
assignees: ''
|
7
|
+
---
|
8
|
+
|
9
|
+
### Describe the problem
|
10
|
+
|
11
|
+
A brief description of the issue.
|
12
|
+
|
13
|
+
### Steps to reproduce the problem
|
14
|
+
|
15
|
+
```
|
16
|
+
Your code here to reproduce the issue
|
17
|
+
```
|
18
|
+
|
19
|
+
### Actual behaviour
|
20
|
+
|
21
|
+
What happened? This could be a description, log output, error raised etc.
|
22
|
+
|
23
|
+
### Expected behaviour
|
24
|
+
|
25
|
+
What did you expect to happen?
|
26
|
+
|
27
|
+
### Describe your environment
|
28
|
+
|
29
|
+
* OS version:
|
30
|
+
* Ruby version:
|
31
|
+
* TTY::Spinner version:
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest new functionality
|
4
|
+
title: ''
|
5
|
+
labels: enhancement
|
6
|
+
assignees: ''
|
7
|
+
---
|
8
|
+
|
9
|
+
### Describe the problem
|
10
|
+
|
11
|
+
A brief description of the problem you're trying to solve.
|
12
|
+
|
13
|
+
### How would the new feature work?
|
14
|
+
|
15
|
+
A short explanation of the new feature.
|
16
|
+
|
17
|
+
```
|
18
|
+
Example code that shows possible usage
|
19
|
+
```
|
20
|
+
|
21
|
+
### Drawbacks
|
22
|
+
|
23
|
+
Can you see any potential drawbacks?
|
@@ -0,0 +1,19 @@
|
|
1
|
+
### Describe the change
|
2
|
+
What does this Pull Request do?
|
3
|
+
|
4
|
+
### Why are we doing this?
|
5
|
+
Any related context as to why is this is a desirable change.
|
6
|
+
|
7
|
+
### Benefits
|
8
|
+
How will the library improve?
|
9
|
+
|
10
|
+
### Drawbacks
|
11
|
+
Possible drawbacks applying this change.
|
12
|
+
|
13
|
+
### Requirements
|
14
|
+
<!--- Put an X between brackets on each line if you have done the item: -->
|
15
|
+
- [ ] Tests written & passing locally?
|
16
|
+
- [ ] Code style checked?
|
17
|
+
- [ ] Rebased with `master` branch?
|
18
|
+
- [ ] Documentation updated?
|
19
|
+
- [ ] Changelog updated?
|
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
name: CI
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
paths-ignore:
|
8
|
+
- "bin/**"
|
9
|
+
- "examples/**"
|
10
|
+
- "*.md"
|
11
|
+
pull_request:
|
12
|
+
branches:
|
13
|
+
- master
|
14
|
+
paths-ignore:
|
15
|
+
- "bin/**"
|
16
|
+
- "examples/**"
|
17
|
+
- "*.md"
|
18
|
+
jobs:
|
19
|
+
tests:
|
20
|
+
name: Ruby ${{ matrix.ruby }}
|
21
|
+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
|
22
|
+
strategy:
|
23
|
+
fail-fast: false
|
24
|
+
matrix:
|
25
|
+
ruby:
|
26
|
+
- "2.0"
|
27
|
+
- "2.1"
|
28
|
+
- "2.3"
|
29
|
+
- "2.4"
|
30
|
+
- "2.5"
|
31
|
+
- "2.6"
|
32
|
+
- "3.0"
|
33
|
+
- "3.1"
|
34
|
+
- "3.2"
|
35
|
+
- "3.3"
|
36
|
+
- ruby-head
|
37
|
+
- jruby-9.2
|
38
|
+
- jruby-9.3
|
39
|
+
- jruby-9.4
|
40
|
+
- jruby-head
|
41
|
+
- truffleruby-head
|
42
|
+
include:
|
43
|
+
- ruby: "2.2"
|
44
|
+
os: ubuntu-20.04
|
45
|
+
- ruby: "2.7"
|
46
|
+
coverage: true
|
47
|
+
env:
|
48
|
+
COVERAGE: ${{ matrix.coverage }}
|
49
|
+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
50
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
|
51
|
+
steps:
|
52
|
+
- uses: actions/checkout@v4
|
53
|
+
- name: Set up Ruby
|
54
|
+
uses: ruby/setup-ruby@v1
|
55
|
+
with:
|
56
|
+
ruby-version: ${{ matrix.ruby }}
|
57
|
+
bundler-cache: true
|
58
|
+
- name: Run tests
|
59
|
+
run: bundle exec rake ci
|
@@ -0,0 +1,78 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
|
4
|
+
Layout/FirstArrayElementIndentation:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Layout/FirstHashElementIndentation:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Layout/LineLength:
|
11
|
+
Max: 82
|
12
|
+
|
13
|
+
Layout/SpaceInsideHashLiteralBraces:
|
14
|
+
EnforcedStyle: no_space
|
15
|
+
|
16
|
+
Lint/AssignmentInCondition:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/AbcSize:
|
20
|
+
Max: 30
|
21
|
+
|
22
|
+
Metrics/BlockLength:
|
23
|
+
CountComments: true
|
24
|
+
Max: 25
|
25
|
+
IgnoredMethods: []
|
26
|
+
Exclude:
|
27
|
+
- "spec/**/*"
|
28
|
+
|
29
|
+
Metrics/ClassLength:
|
30
|
+
Max: 1500
|
31
|
+
|
32
|
+
Metrics/CyclomaticComplexity:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Metrics/MethodLength:
|
36
|
+
Max: 20
|
37
|
+
|
38
|
+
Naming/FileName:
|
39
|
+
Exclude:
|
40
|
+
- "lib/tty-spinner.rb"
|
41
|
+
|
42
|
+
Naming/BinaryOperatorParameterName:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Style/AsciiComments:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/BlockDelimiters:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Style/CommentedKeyword:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/FrozenStringLiteralComment:
|
55
|
+
Exclude:
|
56
|
+
- "spec/**/*"
|
57
|
+
|
58
|
+
Style/LambdaCall:
|
59
|
+
SupportedStyles:
|
60
|
+
- call
|
61
|
+
- braces
|
62
|
+
|
63
|
+
Style/Semicolon:
|
64
|
+
Exclude:
|
65
|
+
- "spec/**/*"
|
66
|
+
|
67
|
+
Style/StringLiterals:
|
68
|
+
EnforcedStyle: double_quotes
|
69
|
+
|
70
|
+
Style/StringLiteralsInInterpolation:
|
71
|
+
EnforcedStyle: double_quotes
|
72
|
+
|
73
|
+
Style/SymbolProc:
|
74
|
+
Exclude:
|
75
|
+
- "spec/**/*"
|
76
|
+
|
77
|
+
Style/TrivialAccessors:
|
78
|
+
Enabled: false
|