class Spring::CommandWrapper
def binstub
def binstub Spring.application_root_path.join(binstub_name) end
def binstub_name
def binstub_name "bin/#{name}" end
def call
def call if command.respond_to?(:call) command.call else $0 = exec load exec end end
def description
def description if command.respond_to?(:description) command.description else "Runs the #{name} command" end end
def env(args)
def env(args) if command.respond_to?(:env) command.env(args) end end
def exec
def exec if binstub.exist? binstub.to_s else Gem.bin_path(gem_name, exec_name) end end
def exec_name
def exec_name if command.respond_to?(:exec_name) command.exec_name else name end end
def gem_name
def gem_name if command.respond_to?(:gem_name) command.gem_name else exec_name end end
def initialize(name, command = nil)
def initialize(name, command = nil) @name = name @command = command @setup = false end
def setup
def setup if !setup? && command.respond_to?(:setup) command.setup @setup = true return true else @setup = true return false end end
def setup?
def setup? @setup end