class GemPaths::CLI

Public Instance Methods

list() click to toggle source
# File lib/gem_paths/cli.rb, line 9
def list
  defaults = {"format" => "make"}
  opt = defaults.merge(options)
  begin
    case opt['format']
    when 'yaml'
      puts GemPaths::List.to_yaml
    when 'json'
      puts GemPaths::List.to_json
    when 'make'
      puts GemPaths::List.to_make
    when 'sh'
      puts GemPaths::List.to_sh
    else
      shell.error set_color("Invalid value for --format option. Try 'gempaths help list' for more info.", Thor::Shell::Color::RED)
      exit(2)
    end
  rescue
    shell.error set_color("Unexpected error occurred. Please make sure you have a Gemfile.lock file in your project.", Thor::Shell::Color::RED)
    exit(3)
  end
end