Class: Torba::Cli
- Inherits:
-
Thor
- Object
- Thor
- Torba::Cli
- Defined in:
- lib/torba/cli.rb
Overview
Instance Method Summary collapse
Instance Method Details
#open(name) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/torba/cli.rb', line 29 def open(name) editor = [ENV["TORBA_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find { |e| !e.nil? && !e.empty? } unless editor Torba.ui.error("To open a package, set $EDITOR or $TORBA_EDITOR") exit(false) end Torba.pretty_errors do Torba.pack command = Shellwords.split(editor) << find_package(name).load_path system(*command) || Torba.ui.error("Could not run '#{command.join(" ")}'") end end |
#pack ⇒ Object
8 9 10 11 |
# File 'lib/torba/cli.rb', line 8 def pack Torba.pretty_errors { Torba.pack } Torba.ui.confirm "Torba has been packed!" end |