class Spring::Client::Rails

Constants

ALIASES
COMMANDS

Public Class Methods

description() click to toggle source
# File lib/spring/client/rails.rb, line 14
def self.description
  "Run a rails command. The following sub commands will use Spring: #{COMMANDS.to_a.join ', '}."
end

Public Instance Methods

call() click to toggle source
# File lib/spring/client/rails.rb, line 18
def call
  command_name = ALIASES[args[1]] || args[1]

  if COMMANDS.include?(command_name)
    Run.call(["rails_#{command_name}", *args.drop(2)])
  elsif command_name&.start_with?("db:") && !command_name.start_with?("db:system")
    Run.call(["rake", *args.drop(1)])
  else
    require "spring/configuration"
    ARGV.shift
    load Dir.glob(Spring.application_root_path.join("{bin,script}/rails")).first
    exit
  end
end