Class: Learn::CLI
- Inherits:
-
Thor
- Object
- Thor
- Learn::CLI
- Defined in:
- lib/learn/cli.rb
Instance Method Summary collapse
- #directory ⇒ Object
- #doctor ⇒ Object
- #hello ⇒ Object
- #lint(dir = nil, quiet = nil) ⇒ Object
- #new(*lab_name) ⇒ Object
- #next ⇒ Object
- #open(*lab_name) ⇒ Object
- #reset ⇒ Object
- #save ⇒ Object
- #status ⇒ Object
- #submit(*opts) ⇒ Object
- #test(*opts) ⇒ Object
- #version ⇒ Object
- #whoami ⇒ Object
Instance Method Details
#directory ⇒ Object
84 85 86 |
# File 'lib/learn/cli.rb', line 84 def directory system('learn-config --set-directory') end |
#doctor ⇒ Object
89 90 91 |
# File 'lib/learn/cli.rb', line 89 def doctor system('learn-doctor') end |
#hello ⇒ Object
119 120 121 |
# File 'lib/learn/cli.rb', line 119 def hello system('learn-hello') end |
#lint(dir = nil, quiet = nil) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/learn/cli.rb', line 124 def lint(dir=nil, quiet=nil) if dir && !quiet system("learn-lint #{dir}") elsif dir && quiet system("learn-lint #{dir} #{quiet}") elsif !dir && quiet system("learn-lint #{quiet}") else current_dir = Dir.pwd system("learn-lint #{current_dir}") end end |
#new(*lab_name) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/learn/cli.rb', line 96 def new(*lab_name) has_internet = Learn::InternetConnection.internet_connection? template = [:template] list = [:list] if list system("learn-generate --list #{has_internet ? '--internet' : ''}") else if template && template != 'template' system("learn-generate #{template} #{lab_name.join} #{has_internet ? '--internet' : ''}") else puts "You must specify a template with -t or --template" exit end end end |
#next ⇒ Object
67 68 69 70 71 |
# File 'lib/learn/cli.rb', line 67 def next editor = [:editor] system("learn-open --next --editor=#{editor}") end |
#open(*lab_name) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/learn/cli.rb', line 58 def open(*lab_name) lab_name = Learn::Lab::Parser.new(lab_name.join(' ')).parse! editor = [:editor] system("learn-open #{lab_name} --editor=#{editor}") end |
#reset ⇒ Object
79 80 81 |
# File 'lib/learn/cli.rb', line 79 def reset system('learn-config --reset') end |
#save ⇒ Object
138 139 140 141 142 |
# File 'lib/learn/cli.rb', line 138 def save if !system('learn-submit --save-only') exit 1 end end |
#status ⇒ Object
114 115 116 |
# File 'lib/learn/cli.rb', line 114 def status system('learn-status') end |
#submit(*opts) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/learn/cli.rb', line 37 def submit(*opts) = if ['team'] Learn::TeamMembers::Parser.new(ARGV).execute else ['message'] end system("learn-submit #{commit_message}") end |
#test(*opts) ⇒ Object
18 19 20 |
# File 'lib/learn/cli.rb', line 18 def test(*opts) system("learn-test #{opts.join(' ')}") end |
#version ⇒ Object
23 24 25 |
# File 'lib/learn/cli.rb', line 23 def version puts Learn::VERSION end |
#whoami ⇒ Object
74 75 76 |
# File 'lib/learn/cli.rb', line 74 def whoami system('learn-config --whoami') end |