Sha256: 504c64c0a6edd887cfbdcd8b0f21f77377b12d2d0cd938cdc13a965a2fa4ed42

Contents?: true

Size: 892 Bytes

Versions: 5

Compression:

Stored size: 892 Bytes

Contents

require "set"

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

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

      def self.description
        "Run a rails command. The following sub commands will use spring: #{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/configuration"
          ARGV.shift
          Object.const_set(:APP_PATH, Spring.application_root_path.join("config/application").to_s)
          require Spring.application_root_path.join("config/boot")
          require "rails/commands"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spring-1.0.0 lib/spring/client/rails.rb
spring-0.9.2 lib/spring/client/rails.rb
spring-0.9.1 lib/spring/client/rails.rb
spring-0.9.0 lib/spring/client/rails.rb
spring-0.0.11 lib/spring/client/rails.rb