lib/cloudstack-cli/base.rb in cloudstack-cli-0.13.0 vs lib/cloudstack-cli/base.rb in cloudstack-cli-0.13.1

- old
+ new

@@ -1,13 +1,13 @@ require "thor" require "yaml" -module CloudstackCli +module CloudstackCli class Base < Thor include Thor::Actions include CloudstackCli::Helper - + attr_reader :config # catch control-c and exit trap("SIGINT") { puts " bye" @@ -17,11 +17,11 @@ # exit with return code 1 in case of a error def self.exit_on_failure? true end - no_commands do + no_commands do def client(opts = {}) @config ||= load_configuration @client ||= CloudstackClient::Connection.new( @config[:url], @config[:api_key], @@ -41,11 +41,11 @@ config = YAML::load(IO.read(config_file)) rescue say "Can't load configuration from file #{config_file}.", :red exit 1 end - + env ||= config[:default] if env unless config = config[env] say "Can't find environment #{env}.", :red exit 1 @@ -61,11 +61,11 @@ end def find_project(name = options[:project], allow_all = true) return nil unless name if allow_all && %w(ALL -1).include?(name) - return {'id' => '-1'} + return {'id' => '-1'} end unless project = client.get_project(name) say "Project '#{name}' not found", :red exit 1 end @@ -75,6 +75,6 @@ def filter_by(objects, key, value) objects.select {|r| r[key].downcase == value.downcase} end end end -end \ No newline at end of file +end