Class: Bundler::Environment
- Inherits:
-
Object
- Object
- Bundler::Environment
- Defined in:
- lib/bowline/bundler/environment.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#rubygems ⇒ Object
(also: #rubygems?)
Returns the value of attribute rubygems.
-
#system_gems ⇒ Object
(also: #system_gems?)
Returns the value of attribute system_gems.
Instance Method Summary collapse
- #add_priority_source(source) ⇒ Object
- #add_source(source) ⇒ Object
- #clear_sources ⇒ Object
- #environment_rb(specs, options) ⇒ Object
- #gem_dependencies ⇒ Object
-
#initialize(bundle) ⇒ Environment
constructor
A new instance of Environment.
- #require_env(env = nil) ⇒ Object
- #sources ⇒ Object
Constructor Details
#initialize(bundle) ⇒ Environment
Returns a new instance of Environment.
11 12 13 14 15 16 17 18 19 |
# File 'lib/bowline/bundler/environment.rb', line 11 def initialize(bundle) @bundle = bundle # TODO: remove this @default_sources = default_sources @sources = [] @priority_sources = [] @dependencies = [] @rubygems = true @system_gems = true end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
8 9 10 |
# File 'lib/bowline/bundler/environment.rb', line 8 def dependencies @dependencies end |
#rubygems ⇒ Object Also known as: rubygems?
Returns the value of attribute rubygems.
9 10 11 |
# File 'lib/bowline/bundler/environment.rb', line 9 def rubygems @rubygems end |
#system_gems ⇒ Object Also known as: system_gems?
Returns the value of attribute system_gems.
9 10 11 |
# File 'lib/bowline/bundler/environment.rb', line 9 def system_gems @system_gems end |
Instance Method Details
#add_priority_source(source) ⇒ Object
43 44 45 |
# File 'lib/bowline/bundler/environment.rb', line 43 def add_priority_source(source) @priority_sources << source end |
#add_source(source) ⇒ Object
39 40 41 |
# File 'lib/bowline/bundler/environment.rb', line 39 def add_source(source) @sources << source end |
#clear_sources ⇒ Object
47 48 49 50 |
# File 'lib/bowline/bundler/environment.rb', line 47 def clear_sources @sources.clear @default_sources.clear end |
#environment_rb(specs, options) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/bowline/bundler/environment.rb', line 21 def environment_rb(specs, ) load_paths = load_paths_for_specs(specs, ) bindir = @bundle.bindir.relative_path_from(@bundle.gem_path).to_s filename = @bundle.gemfile.relative_path_from(@bundle.gem_path).to_s template = File.read(File.join(File.dirname(__FILE__), "templates", "environment.erb")) erb = ERB.new(template, nil, '-') erb.result(binding) end |
#gem_dependencies ⇒ Object
52 53 54 |
# File 'lib/bowline/bundler/environment.rb', line 52 def gem_dependencies @gem_dependencies ||= dependencies.map { |d| d.to_gem_dependency } end |
#require_env(env = nil) ⇒ Object
31 32 33 |
# File 'lib/bowline/bundler/environment.rb', line 31 def require_env(env = nil) dependencies.each { |d| d.require_env(env) } end |
#sources ⇒ Object
35 36 37 |
# File 'lib/bowline/bundler/environment.rb', line 35 def sources @priority_sources + [SystemGemSource.new(@bundle)] + @sources + @default_sources end |