1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
require "spring/errors"
require "spring/json"
require "spring/client/command"
require "spring/client/run"
require "spring/client/help"
require "spring/client/binstub"
require "spring/client/stop"
require "spring/client/status"
require "spring/client/rails"
require "spring/client/version"
require "spring/client/server"
module Spring
module Client
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,
}
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
def self.command_for(name)
COMMANDS[name] || Client::Run
end
end
end
# allow users to add hooks that do not run in the server
# or modify start/stop
if File.exist?("config/spring_client.rb")
require "./config/spring_client.rb"
end
|