Sha256: 849e0c90239b276d8f7e9881eea0e811984d15304ed326b6988ed557c6eddab2

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

require "set"

module SpringStandalone
  module Client
    class Rails < Command
      COMMANDS = Set.new %w(console runner generate destroy test)

      ALIASES = {
        "c" => "console",
        "r" => "runner",
        "g" => "generate",
        "d" => "destroy",
        "t" => "test"
      }

      def self.description
        "Run a rails command. The following sub commands will use SpringStandalone: #{COMMANDS.to_a.join ', '}."
      end

      def call
        command_name = ALIASES[args[1]] || args[1]

        if COMMANDS.include?(command_name)
          Run.call(["rails_#{command_name}", *args.drop(2)])
        else
          require "spring_standalone/configuration"
          ARGV.shift
          load Dir.glob(SpringStandalone.application_root_path.join("{bin,script}/rails")).first
          exit
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spring_standalone-0.1.13 lib/spring_standalone/client/rails.rb