Sha256: 2e8212749286b3367ac13f3c0492ead92c7a26d4394fdf42fb2a8d79411faaec

Contents?: true

Size: 820 Bytes

Versions: 20

Compression:

Stored size: 820 Bytes

Contents

require "set"

module Spring
  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 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
          load Dir.glob(Spring.application_root_path.join("{bin,script}/rails")).first
          exit
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
spring-2.0.2 lib/spring/client/rails.rb
spring-2.0.1 lib/spring/client/rails.rb
spring-2.0.0 lib/spring/client/rails.rb
spring-1.7.2 lib/spring/client/rails.rb
spring-1.7.1 lib/spring/client/rails.rb
spring-1.7.0 lib/spring/client/rails.rb
spring-1.6.4 lib/spring/client/rails.rb
spring-1.6.3 lib/spring/client/rails.rb
spring-1.6.2 lib/spring/client/rails.rb
spring-1.6.1 lib/spring/client/rails.rb
spring-1.6.0 lib/spring/client/rails.rb
spring-1.5.0 lib/spring/client/rails.rb
spring-1.4.4 lib/spring/client/rails.rb
spring-1.4.3 lib/spring/client/rails.rb
spring-1.4.2 lib/spring/client/rails.rb
spring-1.4.1 lib/spring/client/rails.rb
spring-1.4.0 lib/spring/client/rails.rb
spring-1.3.6 lib/spring/client/rails.rb
spring-1.3.5 lib/spring/client/rails.rb
spring-1.3.4 lib/spring/client/rails.rb