learn-co 3.2.16 → 3.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/learn-co.gemspec +1 -1
- data/lib/learn/options_sanitizer.rb +43 -10
- data/lib/learn/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17dd343cee2a158173899d07c6960b3d68e74e41
|
4
|
+
data.tar.gz: 2a23fa06053b7ed17593bf3cb25cc36cbfb6275f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00554ee4084a6dc6563793d0bd9a841886756f4ae1ca4a3dda40e9e97de4ed78b087101b781537aba7605ce6a1ca24dbe1df83cc2b953ac3fc9951de246d6864
|
7
|
+
data.tar.gz: 8cc85aaa9f59efdc1fcd93194c08f15776e5cb43dc28a521067f93b2a9e8a353cc7d3035d2de74112e37645fe9d38d7728e1542a0d3c8e5a11e7f3e82748379b
|
data/learn-co.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
22
|
spec.add_development_dependency "pry"
|
23
23
|
|
24
|
-
spec.add_runtime_dependency "learn-test", ">= 1.2.
|
24
|
+
spec.add_runtime_dependency "learn-test", ">= 1.2.25"
|
25
25
|
spec.add_runtime_dependency "learn-config", ">= 1.0.75"
|
26
26
|
spec.add_runtime_dependency "learn-open", ">= 1.1.56"
|
27
27
|
spec.add_runtime_dependency "learn-submit", ">= 1.1.7"
|
@@ -33,7 +33,8 @@ module Learn
|
|
33
33
|
'--browser',
|
34
34
|
'-s',
|
35
35
|
'--skip',
|
36
|
-
'--keep'
|
36
|
+
'--keep',
|
37
|
+
'--fail-fast'
|
37
38
|
]
|
38
39
|
|
39
40
|
def initialize(args)
|
@@ -68,8 +69,9 @@ module Learn
|
|
68
69
|
def handle_missing_or_unknown_args
|
69
70
|
if first_arg_not_a_flag_or_file?
|
70
71
|
exit_with_unknown_command
|
71
|
-
elsif has_output_flag?
|
72
|
-
check_for_output_file
|
72
|
+
elsif has_output_flag? || has_format_flag?
|
73
|
+
check_for_output_file if has_output_flag?
|
74
|
+
check_for_format_type if has_format_flag?
|
73
75
|
elsif only_has_flag_arguments?
|
74
76
|
add_test_command
|
75
77
|
else
|
@@ -80,13 +82,13 @@ module Learn
|
|
80
82
|
def check_for_output_file(add_test_command: true)
|
81
83
|
index = args.index('-o') || args.index('--out')
|
82
84
|
|
83
|
-
if
|
85
|
+
if flag_argument_specified?(index)
|
84
86
|
initial_arg_index = add_test_command ? 0 : 1
|
85
87
|
out_arg = "#{args[index]} #{args[index+1]}"
|
86
|
-
|
88
|
+
delete_flag_args!(index)
|
87
89
|
|
88
90
|
if only_has_known_test_flags?(initial_arg_index)
|
89
|
-
rebuild_args!(
|
91
|
+
rebuild_args!(flag_arg: out_arg, add_test_command: add_test_command)
|
90
92
|
else
|
91
93
|
exit_with_unknown_flags
|
92
94
|
end
|
@@ -95,14 +97,32 @@ module Learn
|
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|
98
|
-
def
|
100
|
+
def check_for_format_type(add_test_command: true)
|
101
|
+
index = args.index('-f') || args.index('--format')
|
102
|
+
|
103
|
+
if flag_argument_specified?(index)
|
104
|
+
initial_arg_index = add_test_command ? 0 : 1
|
105
|
+
format_arg = "#{args[index]} #{args[index+1]}"
|
106
|
+
delete_flag_args!(index)
|
107
|
+
|
108
|
+
if only_has_known_test_flags?(initial_arg_index)
|
109
|
+
rebuild_args!(flag_arg: format_arg, add_test_command: add_test_command)
|
110
|
+
else
|
111
|
+
exit_with_unknown_flags
|
112
|
+
end
|
113
|
+
else
|
114
|
+
exit_with_missing_format_type
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def delete_flag_args!(index)
|
99
119
|
args.delete_at(index+1)
|
100
120
|
args.delete_at(index)
|
101
121
|
end
|
102
122
|
|
103
|
-
def rebuild_args!(
|
123
|
+
def rebuild_args!(flag_arg:, add_test_command:)
|
104
124
|
args.unshift('test') if add_test_command
|
105
|
-
args.push(
|
125
|
+
args.push(flag_arg)
|
106
126
|
end
|
107
127
|
|
108
128
|
def add_test_command
|
@@ -130,6 +150,10 @@ module Learn
|
|
130
150
|
args.any? {|arg| ['-o', '--out'].include?(arg)}
|
131
151
|
end
|
132
152
|
|
153
|
+
def has_format_flag?
|
154
|
+
args.any? {|arg| ['-f', '--format'].include?(arg)}
|
155
|
+
end
|
156
|
+
|
133
157
|
def only_has_known_test_flags?(start_index)
|
134
158
|
if arg_is_a_file?(args[start_index])
|
135
159
|
start_index += 1
|
@@ -138,7 +162,7 @@ module Learn
|
|
138
162
|
args[start_index..-1].all? {|arg| KNOWN_TEST_FLAGS.include?(arg)}
|
139
163
|
end
|
140
164
|
|
141
|
-
def
|
165
|
+
def flag_argument_specified?(index)
|
142
166
|
args[index+1] && !args[index+1].start_with?('-')
|
143
167
|
end
|
144
168
|
|
@@ -158,6 +182,10 @@ module Learn
|
|
158
182
|
args[0] == 'test' && args.any? {|arg| ['-o', '--out'].include?(arg)}
|
159
183
|
end
|
160
184
|
|
185
|
+
def has_test_command_and_format_flag?
|
186
|
+
args[0] == 'test' && args.any? {|arg| ['-f', '--format'].include?(arg)}
|
187
|
+
end
|
188
|
+
|
161
189
|
# Exit methods
|
162
190
|
def exit_with_invalid_flag
|
163
191
|
puts "Invalid flag: #{args[1]}"
|
@@ -184,5 +212,10 @@ module Learn
|
|
184
212
|
puts "Must specify an output file when using the -o, --out flag."
|
185
213
|
exit
|
186
214
|
end
|
215
|
+
|
216
|
+
def exit_with_missing_format_type
|
217
|
+
puts "Must specify a format type when using the -f, --format flag."
|
218
|
+
exit
|
219
|
+
end
|
187
220
|
end
|
188
221
|
end
|
data/lib/learn/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-co
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.2.
|
61
|
+
version: 1.2.25
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.2.
|
68
|
+
version: 1.2.25
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: learn-config
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|