Sha256: 9e8fe1e36d9cb5a4c3f7e6fef7608f205c211cb023322cae0e24408fea2e1193

Contents?: true

Size: 633 Bytes

Versions: 3

Compression:

Stored size: 633 Bytes

Contents

require "set"

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

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

      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
          exec "bundle", "exec", *args
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spring-0.0.10 lib/spring/client/rails.rb
spring-0.0.9 lib/spring/client/rails.rb
spring-0.0.8 lib/spring/client/rails.rb