Sha256: daf0e5d4ff99ac85f3bfd8b6df2e1a6eb0353f8b45da1507dc0938dcd9d1f772

Contents?: true

Size: 1.05 KB

Versions: 15

Compression:

Stored size: 1.05 KB

Contents

require 'relish'
require 'relish/helpers'
require 'relish/error_messages'
require 'relish/resource_methods'
require 'relish/commands/base'
require 'relish/commands/collab'
require 'relish/commands/config'
require 'relish/commands/help'
require 'relish/commands/projects'
require 'relish/commands/push'
require 'relish/commands/versions'

RestClient.proxy = ENV['http_proxy']

module Relish
  module Command
    
    class << self
      include Relish::Helpers
      
      def run(command, args)
        command_class, method = get_command_and_method(command, args)      
        command_class.new(args).send(method)
      end
    
      def get_command_and_method(command, args)
        command_class, method = command.split(':')
        return get_command(command_class.capitalize), get_method(method)
      rescue NameError
        error :unknown_command
      end
      
    private
    
      def get_command(command)
        Relish::Command.const_get(command)
      end
      
      def get_method(method)
        method || :default
      end
      
    end
    
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
relish-0.7.1 lib/relish/command.rb
relish-0.7 lib/relish/command.rb
relish-0.6 lib/relish/command.rb
relish-0.5.3 lib/relish/command.rb
relish-0.5.2 lib/relish/command.rb
relish-0.5.1 lib/relish/command.rb
relish-0.5.0 lib/relish/command.rb
relish-0.4.0 lib/relish/command.rb
relish-0.3.0 lib/relish/command.rb
relish-0.3.0.pre lib/relish/command.rb
relish-0.2.3 lib/relish/command.rb
relish-0.2.2 lib/relish/command.rb
relish-0.2.1 lib/relish/command.rb
relish-0.2.0 lib/relish/command.rb
relish-0.1.6 lib/relish/command.rb