Sha256: d40a648e4b7ffc1cd0c517192d784f5023a3f68403e5bd2a5fb3cc21ce028df6

Contents?: true

Size: 798 Bytes

Versions: 51

Compression:

Stored size: 798 Bytes

Contents

module Spring
  module Commands
    class Rake
      class << self
        attr_accessor :environment_matchers
      end

      self.environment_matchers = {
        :default     => "test",
        /^test($|:)/ => "test"
      }

      def env(args)
        # This is an adaption of the matching that Rake itself does.
        # See: https://github.com/jimweirich/rake/blob/3754a7639b3f42c2347857a0878beb3523542aee/lib/rake/application.rb#L691-L692
        if env = args.grep(/^(RAILS|RACK)_ENV=(.*)$/m).last
          return env.split("=").last
        end

        self.class.environment_matchers.each do |matcher, environment|
          return environment if matcher === (args.first || :default)
        end

        nil
      end
    end

    Spring.register_command "rake", Rake.new
  end
end

Version data entries

51 entries across 51 versions & 4 rubygems

Version Path
spring-4.2.1 lib/spring/commands/rake.rb
spring-4.2.0 lib/spring/commands/rake.rb
spring-4.1.3 lib/spring/commands/rake.rb
spring-4.1.2 lib/spring/commands/rake.rb
spring-4.1.1 lib/spring/commands/rake.rb
spring-4.1.0 lib/spring/commands/rake.rb
spring-4.0.0 lib/spring/commands/rake.rb
spring-3.1.1 lib/spring/commands/rake.rb
spring-3.1.0 lib/spring/commands/rake.rb
spring-3.0.0 lib/spring/commands/rake.rb
nrispring-2.1.3 lib/spring/commands/rake.rb
nrispring-2.1.2 lib/spring/commands/rake.rb
nrispring-2.1.1 lib/spring/commands/rake.rb
spring-2.1.1 lib/spring/commands/rake.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/commands/rake.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/commands/rake.rb
spring-2.1.0 lib/spring/commands/rake.rb
spring-2.0.2 lib/spring/commands/rake.rb
spring-2.0.1 lib/spring/commands/rake.rb
spring-2.0.0 lib/spring/commands/rake.rb