Module: Rguidepost
- Extended by:
- Rguidepost
- Included in:
- Rguidepost
- Defined in:
- lib/rguidepost.rb,
lib/rguidepost/command.rb,
lib/rguidepost/version.rb
Defined Under Namespace
Classes: Command
Constant Summary collapse
- VERSION =
"0.2.0"
Instance Method Summary collapse
Instance Method Details
#execute_repository_command ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rguidepost.rb', line 20 def execute_repository_command commands = read_commands command = TTY::Prompt.new.select("repository commands:") do || commands.keys.each do |key| .choice key, Command.new(commands, key) end end success = command.execute exit 1 unless success rescue TTY::Reader::InputInterrupt => e puts "" puts "aborted." exit 1 rescue => e puts e. puts "aborted." exit 1 end |
#read_commands ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/rguidepost.rb', line 10 def read_commands yaml = YAML.load_file('rguidepost.yml') raise "rguidepost.yml is not hash." unless yaml.is_a? Hash commands = yaml["commands"] raise %q{rguidepost.yml doesn't have 'commands' key. } if commands.nil? commands end |