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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d99775b553ce5b4a507847bae14b5761cd738a7
4
- data.tar.gz: ec68270dc18fbf434cb4f8783da537e0f4caebba
3
+ metadata.gz: 17dd343cee2a158173899d07c6960b3d68e74e41
4
+ data.tar.gz: 2a23fa06053b7ed17593bf3cb25cc36cbfb6275f
5
5
  SHA512:
6
- metadata.gz: 6df376a55f8ca1a0db1cf13933327e14753930250e32846ab686612c35a85ba84659384aa421cbd0b242409012e1cb7e94eeef6b72a1d7c424f27fc308927f0c
7
- data.tar.gz: 83e8171428c66a907346b7a793e066fcb986e60ccf475e003ded486bbd2d38ea46b50422839c76659b9b5d6c63083b4e1c7e939c421fdc16d2c80805145da7e2
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"
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 output_file_specified?(index)
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
- delete_output_file_args!(index)
88
+ delete_flag_args!(index)
87
89
 
88
90
  if only_has_known_test_flags?(initial_arg_index)
89
- rebuild_args!(output_file_arg: out_arg, add_test_command: add_test_command)
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 delete_output_file_args!(index)
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!(output_file_arg:, add_test_command:)
123
+ def rebuild_args!(flag_arg:, add_test_command:)
104
124
  args.unshift('test') if add_test_command
105
- args.push(output_file_arg)
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 output_file_specified?(index)
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
@@ -1,3 +1,3 @@
1
1
  module Learn
2
- VERSION = '3.2.16'
2
+ VERSION = '3.2.17'
3
3
  end
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.16
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.24
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.24
68
+ version: 1.2.25
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: learn-config
71
71
  requirement: !ruby/object:Gem::Requirement