class RsMule::Cli

Public Instance Methods

get_right_api_client() click to toggle source
# File lib/rs-mule/cli.rb, line 25
      def get_right_api_client()
        client_auth_params = {}
        thor_shell = Thor::Shell::Color.new
        unless @options.keys.include?('rs_auth_file') | @options.keys.include?('rs_auth_hash')
          message = <<EOF
You must supply right_api_client authentication details as either a hash or
a yaml authentication file!
EOF
          thor_shell.say(thor_shell.set_color(message, :red))
          exit 1
        end
        if @options[:rs_auth_file]
          client_auth_params = YAML.load_file(@options[:rs_auth_file])
        end

        if @options[:rs_auth_hash]
          client_auth_params = options[:rs_auth_hash]
        end

        RightApi::Client.new(client_auth_params)
      end
run_executable(executable) click to toggle source
# File lib/rs-mule/cli.rb, line 57
def run_executable(executable)
  # Cover our bases with symbolized keys as well
  new_options = {}
  @options.each do |k,v|
    new_options[k.to_sym] = v
    new_options[k] = v
  end

  client = get_right_api_client

  mule = RsMule::RunExecutable.new(client)
  mule.run_executable(new_options[:tags], executable, new_options)
end