Module: SimpleDeployer::Command
- Defined in:
- lib/simple_deployer/command.rb,
lib/simple_deployer/commands/base.rb,
lib/simple_deployer/commands/help.rb,
lib/simple_deployer/commands/info.rb,
lib/simple_deployer/commands/server.rb,
lib/simple_deployer/commands/project.rb,
lib/simple_deployer/commands/projects.rb
Defined Under Namespace
Classes: CommandsBase, Help, Info, Project, Projects, Server
Class Method Summary
collapse
Class Method Details
.parse(command) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/simple_deployer/command.rb', line 23
def parse(command)
begin
parts = command.split(".")
return eval("SimpleDeployer::Command::#{parts[0].capitalize}"), parts[1] ? parts[1].to_sym : :main
end
end
|
.run(command, args) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/simple_deployer/command.rb', line 6
def run(command, args)
config = Config.new()
config.read()
begin
service = SimpleDeployer::Service.new(config) klass, method = parse(command)
runner = klass.new(args, service)
runner.send(method)
rescue RestClient::RequestTimeout
p "API request timed out."
rescue NameError,NoMethodError =>ex
p "Invalid command please type 'sd' for help"
p ex.inspect
end
end
|