Module: Spring::Client

Defined in:
lib/spring/client.rb,
lib/spring/client/run.rb,
lib/spring/client/help.rb,
lib/spring/client/stop.rb,
lib/spring/client/rails.rb,
lib/spring/client/server.rb,
lib/spring/client/status.rb,
lib/spring/client/binstub.rb,
lib/spring/client/command.rb,
lib/spring/client/version.rb

Defined Under Namespace

Classes: Binstub, Command, Help, Rails, Run, Server, Status, Stop, Version

Constant Summary collapse

COMMANDS =
{
  "help"      => Client::Help,
  "-h"        => Client::Help,
  "--help"    => Client::Help,
  "binstub"   => Client::Binstub,
  "stop"      => Client::Stop,
  "status"    => Client::Status,
  "rails"     => Client::Rails,
  "-v"        => Client::Version,
  "--version" => Client::Version,
  "server"    => Client::Server,
}

Class Method Summary collapse

Class Method Details

.command_for(name) ⇒ Object



38
39
40
# File 'lib/spring/client.rb', line 38

def self.command_for(name)
  COMMANDS[name] || Client::Run
end

.run(args) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/spring/client.rb', line 29

def self.run(args)
  command_for(args.first).call(args)
rescue CommandNotFound
  Client::Help.call(args)
rescue ClientError => e
  $stderr.puts e.message
  exit 1
end