Sha256: ecdd0b764408d50a14df7b5b4603299e7657e6c9b2131dc3070455fcaaf96448

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 Bytes

Contents

module SpringStandalone
  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(/^(APP|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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spring_standalone-0.1.13 lib/spring_standalone/commands/rake.rb