Class: Ecogem::Env

Inherits:
Object
  • Object
show all
Defined in:
lib/ecogem/env.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, dir) ⇒ Env

Returns a new instance of Env.



12
13
14
15
# File 'lib/ecogem/env.rb', line 12

def initialize(base, dir)
  @base = base
  @dir = ::File.expand_path(dir)
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



10
11
12
# File 'lib/ecogem/env.rb', line 10

def dir
  @dir
end

Instance Method Details

#configObject



21
22
23
# File 'lib/ecogem/env.rb', line 21

def config
  @config ||= ::Ecogem::Config.new(@base && @base.config, config_path)
end

#git_source_uri_to_alias(uri) ⇒ Object



29
30
31
32
# File 'lib/ecogem/env.rb', line 29

def git_source_uri_to_alias(uri)
  source = git_sources[uri]
  (source && source.uri_alias) || uri
end

#git_sourcesObject



25
26
27
# File 'lib/ecogem/env.rb', line 25

def git_sources
  @git_sources ||= ::Hash[config.values.git_sources.map{|i| [i.uri, i]}]
end