Class: SpreeEnvironment

Inherits:
Object show all
Defined in:
lib/commands/extension.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ SpreeEnvironment

Returns a new instance of SpreeEnvironment.



18
19
20
# File 'lib/commands/extension.rb', line 18

def initialize(dir)
  @root = dir
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



16
17
18
# File 'lib/commands/extension.rb', line 16

def root
  @root
end

Class Method Details

.defaultObject



30
31
32
# File 'lib/commands/extension.rb', line 30

def self.default
  @default ||= find
end

.default=(spree_env) ⇒ Object



34
35
36
# File 'lib/commands/extension.rb', line 34

def self.default=(spree_env)
  @default = spree_env
end

.find(dir = nil) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/commands/extension.rb', line 22

def self.find(dir=nil)
  dir ||= pwd
  while dir.length > 1
    return new(dir) if File.exist?(File.join(dir, 'config', 'environment.rb'))
    dir = File.dirname(dir)
  end
end