learn-co 1.0.4 → 2.1.0
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/Gemfile +2 -2
- data/LICENSE.txt +0 -1
- data/README.md +4 -5
- data/Rakefile +0 -1
- data/bin/learn +11 -69
- data/learn-co.gemspec +10 -11
- data/lib/learn.rb +4 -21
- data/lib/learn/cli.rb +78 -0
- data/lib/learn/lab/parser.rb +25 -0
- data/lib/learn/options_sanitizer.rb +164 -0
- data/lib/learn/version.rb +1 -1
- metadata +30 -97
- data/.rspec +0 -2
- data/lib/learn/file_finder.rb +0 -12
- data/lib/learn/github_interactor.rb +0 -23
- data/lib/learn/jasmine/boot.js +0 -184
- data/lib/learn/jasmine/console.js +0 -161
- data/lib/learn/jasmine/formatters/jasmine2-junit.js +0 -199
- data/lib/learn/jasmine/helpers/ConsoleHelper.js +0 -12
- data/lib/learn/jasmine/helpers/ConsoleHelperNoColor.js +0 -12
- data/lib/learn/jasmine/initializer.rb +0 -27
- data/lib/learn/jasmine/jasmine-html.js +0 -360
- data/lib/learn/jasmine/jasmine-jquery.js +0 -813
- data/lib/learn/jasmine/jasmine.css +0 -56
- data/lib/learn/jasmine/jasmine.js +0 -2403
- data/lib/learn/jasmine/jasmine_favicon.png +0 -0
- data/lib/learn/jasmine/jquery-1.8.0.min.js +0 -2
- data/lib/learn/jasmine/jquery-ui-1.8.23.custom.min.js +0 -125
- data/lib/learn/jasmine/phantom_checker.rb +0 -55
- data/lib/learn/jasmine/runner.rb +0 -129
- data/lib/learn/jasmine/runners/SpecRunner.html +0 -35
- data/lib/learn/jasmine/runners/run-jasmine.js +0 -228
- data/lib/learn/jasmine/templates/SpecRunnerTemplate.html.erb +0 -35
- data/lib/learn/jasmine/templates/SpecRunnerTemplateNoColor.html.erb +0 -35
- data/lib/learn/jasmine/templates/requires.yml.example +0 -7
- data/lib/learn/jasmine/vendor/require.js +0 -2077
- data/lib/learn/netrc_interactor.rb +0 -18
- data/lib/learn/python_unittest/nose_installer.rb +0 -35
- data/lib/learn/python_unittest/requirements_checker.rb +0 -57
- data/lib/learn/python_unittest/runner.rb +0 -89
- data/lib/learn/repo_parser.rb +0 -22
- data/lib/learn/rspec/runner.rb +0 -113
- data/lib/learn/spec_type_parser.rb +0 -26
- data/lib/learn/user_id_parser.rb +0 -9
- data/lib/learn/username_parser.rb +0 -19
- data/spec/features/jasmine_jquery_fixtures_spec.rb +0 -10
- data/spec/features/rspec_unit_spec.rb +0 -10
- data/spec/fixtures/jasmine-jquery-fixtures/index.html +0 -10
- data/spec/fixtures/jasmine-jquery-fixtures/requires.yml +0 -4
- data/spec/fixtures/jasmine-jquery-fixtures/spec/jasmine-jquery-fixtures-spec.js +0 -11
- data/spec/fixtures/rspec-unit-spec/.rspec +0 -2
- data/spec/fixtures/rspec-unit-spec/lib/dog.rb +0 -2
- data/spec/fixtures/rspec-unit-spec/spec/dog_spec.rb +0 -7
- data/spec/fixtures/rspec-unit-spec/spec/spec_helper.rb +0 -93
- data/spec/repo_parser_spec.rb +0 -25
- data/spec/spec_helper.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a64ace8ff6539b15f4dbeb1bdfc5dc7f17eb76e
|
4
|
+
data.tar.gz: ec0653a2d7c6fda5e05b8ac1280b0df391f6bc5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3ee1598f566ba6907ca05689db27a194faa6225f790ed3a9ffc836e79681403e7b75e785202ea41e69a32799052aa8732bfd7d5e7388cb8a6362d13e2d47019
|
7
|
+
data.tar.gz: 35c6ea59f7140dfd6b10aab704572ce9c26feb616d28710b3f20f1bab4d45cec8197481fb4275d74c48bf57ec37b7ce744e3e47176eda1bd3b9b90d6fb341065
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -20,4 +20,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# learn-co
|
2
2
|
|
3
|
-
|
3
|
+
The command line interface to Learn.co.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -22,17 +22,16 @@ And then execute:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
From within a
|
25
|
+
From within a Learn.co lesson directory, run:
|
26
26
|
|
27
27
|
```
|
28
|
-
$ learn
|
28
|
+
$ learn [command]
|
29
29
|
```
|
30
30
|
|
31
31
|
## Contributing
|
32
32
|
|
33
|
-
1. Fork it ( https://github.com/flatiron-labs/learn-
|
33
|
+
1. Fork it ( https://github.com/flatiron-labs/learn-co/fork )
|
34
34
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
35
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
36
|
4. Push to the branch (`git push origin my-new-feature`)
|
37
37
|
5. Create a new Pull Request
|
38
|
-
|
data/Rakefile
CHANGED
data/bin/learn
CHANGED
@@ -1,78 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'optparse'
|
4
3
|
require 'learn'
|
5
4
|
|
6
|
-
|
5
|
+
NON_PRE_CONFIG_COMMANDS = [
|
6
|
+
'reset', 'whoami', 'directory', 'help', 'version', '--version', '-v'
|
7
|
+
]
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
username = Learn::UsernameParser.get_username
|
12
|
-
user_id = Learn::UserIdParser.get_user_id
|
9
|
+
if ['-v', '--version'].include?(ARGV.first)
|
10
|
+
puts Learn::VERSION
|
11
|
+
exit
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
if spec_type == "jasmine"
|
18
|
-
SERVICE_ENDPOINT = '/e/flatiron_jasmine/build/ironboard'
|
19
|
-
|
20
|
-
options = {}
|
21
|
-
OptionParser.new do |opts|
|
22
|
-
opts.banner = "Usage: learn [options]"
|
23
|
-
|
24
|
-
opts.on("-n", "--[no-]color", "Turn off color output") do |c|
|
25
|
-
options[:color] = c
|
26
|
-
end
|
27
|
-
|
28
|
-
opts.on("-l", "--local", "Don't push results to Flatiron LMS") do |l|
|
29
|
-
options[:local] = l
|
30
|
-
end
|
31
|
-
|
32
|
-
opts.on("-b", "--browser", "Run tests in browser") do |b|
|
33
|
-
options[:browser] = b
|
34
|
-
end
|
35
|
-
|
36
|
-
opts.on("-o", "--out FILE") do |o|
|
37
|
-
options[:out] = o
|
38
|
-
end
|
14
|
+
Learn::OptionsSanitizer.new(ARGV).sanitize!
|
39
15
|
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
opts.on("-t", "--test") do |t|
|
45
|
-
options[:test] = t
|
46
|
-
end
|
47
|
-
end.parse!
|
48
|
-
|
49
|
-
if ARGV.any? { |arg| arg == "init" }
|
50
|
-
Learn::Jasmine::Initializer.run
|
51
|
-
else
|
52
|
-
if !options[:skip]
|
53
|
-
Learn::Jasmine::PhantomChecker.check_installation
|
54
|
-
username = Learn::UsernameParser.get_username
|
55
|
-
user_id = Learn::UserIdParser.get_user_id
|
56
|
-
else
|
57
|
-
username = "jasmine-flatiron"
|
58
|
-
user_id = "none"
|
59
|
-
end
|
60
|
-
|
61
|
-
Learn::Jasmine::Runner.run(username, user_id, repo, options)
|
62
|
-
end
|
63
|
-
elsif spec_type == "rspec"
|
64
|
-
SERVICE_ENDPOINT = '/e/flatiron_rspec/build/ironboard'
|
65
|
-
|
66
|
-
runner = Learn::RSpec::Runner.new(username, user_id, repo, ARGV)
|
67
|
-
runner.run
|
68
|
-
elsif spec_type == 'python_unittest'
|
69
|
-
SERVICE_ENDPOINT = '/e/flatiron_unittest/build/ironboard'
|
70
|
-
|
71
|
-
Learn::PythonUnittest::RequirementsChecker.check_installation
|
72
|
-
Learn::PythonUnittest::NoseInstaller.install
|
73
|
-
|
74
|
-
runner = Learn::PythonUnittest::Runner.new(username, user_id, repo, ARGV)
|
75
|
-
runner.run
|
76
|
-
else
|
77
|
-
puts "This directory doesn't appear to have any specs in it."
|
16
|
+
if !(NON_PRE_CONFIG_COMMANDS.include?(ARGV[0]))
|
17
|
+
system('learn-config')
|
78
18
|
end
|
19
|
+
|
20
|
+
Learn::CLI.start(ARGV)
|
data/learn-co.gemspec
CHANGED
@@ -7,9 +7,9 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "learn-co"
|
8
8
|
spec.version = Learn::VERSION
|
9
9
|
spec.authors = ["Flatiron School"]
|
10
|
-
spec.email = ["
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.homepage = "
|
10
|
+
spec.email = ["learn@flatironschool.com"]
|
11
|
+
spec.summary = %q{The command line interface to Learn.co.}
|
12
|
+
spec.homepage = "https://learn.co"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
15
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -19,12 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.7"
|
21
21
|
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
-
spec.
|
23
|
-
spec.add_runtime_dependency "netrc"
|
24
|
-
spec.add_runtime_dependency "git", "~> 1.2"
|
25
|
-
spec.add_runtime_dependency "oj", "~> 2.9"
|
26
|
-
spec.add_runtime_dependency "faraday", "~> 0.9"
|
27
|
-
spec.add_runtime_dependency "crack"
|
28
|
-
spec.add_runtime_dependency "jasmine"
|
29
|
-
end
|
22
|
+
spec.add_development_dependency "pry"
|
30
23
|
|
24
|
+
spec.add_runtime_dependency "learn-test", ">= 1.2.2"
|
25
|
+
spec.add_runtime_dependency "learn-config", ">= 1.0.5"
|
26
|
+
spec.add_runtime_dependency "learn-open", ">= 1.1.2"
|
27
|
+
spec.add_runtime_dependency "learn-submit", ">= 1.0.9"
|
28
|
+
spec.add_runtime_dependency "thor"
|
29
|
+
end
|
data/lib/learn.rb
CHANGED
@@ -1,26 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require 'faraday'
|
3
|
-
require 'oj'
|
1
|
+
require 'thor'
|
4
2
|
|
5
3
|
require 'learn/version'
|
6
|
-
require 'learn/
|
7
|
-
require 'learn/
|
8
|
-
require 'learn/
|
9
|
-
require 'learn/username_parser'
|
10
|
-
require 'learn/repo_parser'
|
11
|
-
require 'learn/file_finder'
|
12
|
-
require 'learn/spec_type_parser'
|
13
|
-
|
14
|
-
require 'learn/rspec/runner'
|
15
|
-
|
16
|
-
require 'learn/jasmine/phantom_checker'
|
17
|
-
require 'learn/jasmine/initializer'
|
18
|
-
require 'learn/jasmine/runner'
|
19
|
-
|
20
|
-
require 'learn/python_unittest/requirements_checker'
|
21
|
-
require 'learn/python_unittest/nose_installer'
|
22
|
-
require 'learn/python_unittest/runner'
|
4
|
+
require 'learn/cli'
|
5
|
+
require 'learn/options_sanitizer'
|
6
|
+
require 'learn/lab/parser'
|
23
7
|
|
24
8
|
module Learn
|
25
9
|
end
|
26
|
-
|
data/lib/learn/cli.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
module Learn
|
2
|
+
class CLI < Thor
|
3
|
+
desc '[test] [options]', "Run a lesson's test suite"
|
4
|
+
long_desc <<-LONGDESC
|
5
|
+
`learn [test] [options]` will run your lesson's test suite.
|
6
|
+
|
7
|
+
You can supply the following options when running Jasmine tests:
|
8
|
+
|
9
|
+
--no-color # Turn off color output
|
10
|
+
\x5 -l, --local # Don't push results to Learn
|
11
|
+
\x5 -b, --browser # Run tests in browser
|
12
|
+
\x5 -o, --out FILE # Specify an output file
|
13
|
+
\x5 -s, --skip # Don't run dependency checks
|
14
|
+
|
15
|
+
When running an RSpec test suite, all normal RSpec options can be
|
16
|
+
passed in.
|
17
|
+
LONGDESC
|
18
|
+
def test(*opts)
|
19
|
+
system("learn-test #{opts.join(' ')}")
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'version, -v, --version', 'Display the current version of the Learn gem'
|
23
|
+
def version
|
24
|
+
puts Learn::VERSION
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'submit ["message"]', 'Submit your completed lesson'
|
28
|
+
long_desc <<-LONGDESC
|
29
|
+
`learn submit ["message"]` will submit your lesson to Learn.
|
30
|
+
|
31
|
+
It will add your changes, commit them, push to GitHub, and issue a pull request.
|
32
|
+
LONGDESC
|
33
|
+
def submit(*opts)
|
34
|
+
system("learn-submit #{opts.join(' ')}")
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "open [lesson-name] [--editor=editor-binary]", "Open your current lesson [or the given lesson] [with your editor]"
|
38
|
+
long_desc <<-LONGDESC
|
39
|
+
`learn open [lesson-name] [--editor=editor-binary]` will open a Learn lesson locally.
|
40
|
+
|
41
|
+
If given no lesson name, it will open your current lesson. By default, it will open
|
42
|
+
using the editor specified in ~/.learn-config.
|
43
|
+
|
44
|
+
If the lesson is an iOS lab, it will open in Xcode. If it is a README, it will open the lesson
|
45
|
+
in your browser.
|
46
|
+
LONGDESC
|
47
|
+
option :editor, required: false, type: :string, aliases: ['e']
|
48
|
+
def open(*lab_name)
|
49
|
+
lab_name = Learn::Lab::Parser.new(lab_name.join(' ')).parse!
|
50
|
+
editor = options[:editor]
|
51
|
+
|
52
|
+
system("learn-open #{lab_name} --editor=#{editor}")
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "next [--editor=editor-binary]", "Open your next lesson [with your editor]"
|
56
|
+
option :editor, required: false, type: :string, aliases: ['e']
|
57
|
+
def next
|
58
|
+
editor = options[:editor]
|
59
|
+
|
60
|
+
system("learn-open --next --editor=#{editor}")
|
61
|
+
end
|
62
|
+
|
63
|
+
desc 'whoami', 'Display your Learn gem configuration information'
|
64
|
+
def whoami
|
65
|
+
system('learn-config --whoami')
|
66
|
+
end
|
67
|
+
|
68
|
+
desc 'reset', 'Reset your Learn gem configuration'
|
69
|
+
def reset
|
70
|
+
system('learn-config --reset')
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'directory', 'Set your local Learn directory. Defaults to ~/Development/code'
|
74
|
+
def directory
|
75
|
+
system('learn-config --set-directory')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Learn
|
2
|
+
module Lab
|
3
|
+
class Parser
|
4
|
+
attr_reader :name
|
5
|
+
|
6
|
+
def initialize(name)
|
7
|
+
@name = name
|
8
|
+
end
|
9
|
+
|
10
|
+
def parse!
|
11
|
+
if name.chars.include?(' ')
|
12
|
+
slugify_name!
|
13
|
+
else
|
14
|
+
name.downcase.strip
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def slugify_name!
|
21
|
+
name.downcase.gsub(' ', '-').strip
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
module Learn
|
2
|
+
class OptionsSanitizer
|
3
|
+
attr_reader :args
|
4
|
+
|
5
|
+
SANITIZE_LIST = {
|
6
|
+
'-e' => '--editor'
|
7
|
+
}
|
8
|
+
|
9
|
+
KNOWN_COMMANDS = [
|
10
|
+
'test',
|
11
|
+
'help',
|
12
|
+
'version',
|
13
|
+
'-v',
|
14
|
+
'--version',
|
15
|
+
'submit',
|
16
|
+
'open',
|
17
|
+
'reset',
|
18
|
+
'whoami',
|
19
|
+
'directory',
|
20
|
+
'next'
|
21
|
+
]
|
22
|
+
|
23
|
+
KNOWN_TEST_FLAGS = [
|
24
|
+
'--no-color',
|
25
|
+
'-b',
|
26
|
+
'--browser',
|
27
|
+
'-s',
|
28
|
+
'--skip'
|
29
|
+
]
|
30
|
+
|
31
|
+
def initialize(args)
|
32
|
+
@args = args
|
33
|
+
end
|
34
|
+
|
35
|
+
def sanitize!
|
36
|
+
sanitize_editor_arg!
|
37
|
+
sanitize_test_args!
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# Sanitization methods
|
43
|
+
def sanitize_editor_arg!
|
44
|
+
args.map! do |arg|
|
45
|
+
SANITIZE_LIST[arg] ? SANITIZE_LIST[arg] : arg
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def sanitize_test_args!
|
50
|
+
if missing_or_unknown_args?
|
51
|
+
handle_missing_or_unknown_args
|
52
|
+
elsif has_test_command_and_invalid_flag?
|
53
|
+
exit_with_invalid_flag
|
54
|
+
elsif has_test_command_and_output_flag?
|
55
|
+
check_for_output_file(add_test_command: false)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Arg manipulation methods
|
60
|
+
def handle_missing_or_unknown_args
|
61
|
+
if first_arg_not_a_flag?
|
62
|
+
exit_with_unknown_command
|
63
|
+
elsif has_output_flag?
|
64
|
+
check_for_output_file
|
65
|
+
elsif only_has_flag_arguments?
|
66
|
+
add_test_command
|
67
|
+
else
|
68
|
+
exit_with_cannot_understand
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def check_for_output_file(add_test_command: true)
|
73
|
+
index = args.index('-o') || args.index('--out')
|
74
|
+
|
75
|
+
if output_file_specified?(index)
|
76
|
+
initial_arg_index = add_test_command ? 0 : 1
|
77
|
+
out_arg = "#{args[index]} #{args[index+1]}"
|
78
|
+
delete_output_file_args!(index)
|
79
|
+
|
80
|
+
if only_has_known_test_flags?(initial_arg_index)
|
81
|
+
rebuild_args!(output_file_arg: out_arg, add_test_command: add_test_command)
|
82
|
+
else
|
83
|
+
exit_with_unknown_flags
|
84
|
+
end
|
85
|
+
else
|
86
|
+
exit_with_missing_output_file
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def delete_output_file_args!(index)
|
91
|
+
args.delete_at(index+1)
|
92
|
+
args.delete_at(index)
|
93
|
+
end
|
94
|
+
|
95
|
+
def rebuild_args!(output_file_arg:, add_test_command:)
|
96
|
+
args.unshift('test') if add_test_command
|
97
|
+
args.push(output_file_arg)
|
98
|
+
end
|
99
|
+
|
100
|
+
def add_test_command
|
101
|
+
args.unshift('test')
|
102
|
+
end
|
103
|
+
|
104
|
+
# Arg check methods
|
105
|
+
def missing_or_unknown_args?
|
106
|
+
args.empty? || !KNOWN_COMMANDS.include?(args[0])
|
107
|
+
end
|
108
|
+
|
109
|
+
def first_arg_not_a_flag?
|
110
|
+
args[0] && !args[0].start_with?('-')
|
111
|
+
end
|
112
|
+
|
113
|
+
def has_output_flag?
|
114
|
+
args.any? {|arg| ['-o', '--out'].include?(arg)}
|
115
|
+
end
|
116
|
+
|
117
|
+
def only_has_known_test_flags?(start_index)
|
118
|
+
args[start_index..-1].all? {|arg| KNOWN_TEST_FLAGS.include?(arg)}
|
119
|
+
end
|
120
|
+
|
121
|
+
def output_file_specified?(index)
|
122
|
+
args[index+1] && !args[index+1].start_with?('-')
|
123
|
+
end
|
124
|
+
|
125
|
+
def only_has_flag_arguments?
|
126
|
+
args.all? {|arg| arg.start_with?('-')}
|
127
|
+
end
|
128
|
+
|
129
|
+
def has_test_command_and_invalid_flag?
|
130
|
+
args[0] == 'test' && args[1] && !args[1].start_with?('-')
|
131
|
+
end
|
132
|
+
|
133
|
+
def has_test_command_and_output_flag?
|
134
|
+
args[0] == 'test' && args.any? {|arg| ['-o', '--out'].include?(arg)}
|
135
|
+
end
|
136
|
+
|
137
|
+
# Exit methods
|
138
|
+
def exit_with_invalid_flag
|
139
|
+
puts "Invalid flag: #{args[1]}"
|
140
|
+
exit
|
141
|
+
end
|
142
|
+
|
143
|
+
def exit_with_unknown_command
|
144
|
+
puts "Unknown command: #{args[0]}. Type `learn help` to see what you can do."
|
145
|
+
exit
|
146
|
+
end
|
147
|
+
|
148
|
+
def exit_with_cannot_understand
|
149
|
+
puts "Sorry, I can't understand what you're trying to do. Type `learn help` for help."
|
150
|
+
exit
|
151
|
+
end
|
152
|
+
|
153
|
+
def exit_with_unknown_flags
|
154
|
+
unknown_flags = args.select {|arg| !KNOWN_TEST_FLAGS.include?(arg)}
|
155
|
+
puts "Unknown #{unknown_flags.count > 1 ? 'flags' : 'flag'}: #{unknown_flags.join(', ')}"
|
156
|
+
exit
|
157
|
+
end
|
158
|
+
|
159
|
+
def exit_with_missing_output_file
|
160
|
+
puts "Must specify an output file when using the -o, --out flag."
|
161
|
+
exit
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|