Class: Spring::Commands::Rake

Inherits:
Object
  • Object
show all
Defined in:
lib/spring/commands/rake.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.environment_matchersObject

Returns the value of attribute environment_matchers.



5
6
7
# File 'lib/spring/commands/rake.rb', line 5

def environment_matchers
  @environment_matchers
end

Instance Method Details

#env(args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/spring/commands/rake.rb', line 13

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