Class: Bundler::Environment
- Inherits:
-
Object
- Object
- Bundler::Environment
- Defined in:
- lib/bundler08/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
-
#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/bundler08/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/bundler08/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/bundler08/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/bundler08/environment.rb', line 9 def system_gems @system_gems end |
Instance Method Details
#add_priority_source(source) ⇒ Object
45 46 47 |
# File 'lib/bundler08/environment.rb', line 45 def add_priority_source(source) @priority_sources << source end |
#add_source(source) ⇒ Object
41 42 43 |
# File 'lib/bundler08/environment.rb', line 41 def add_source(source) @sources << source end |
#clear_sources ⇒ Object
49 50 51 52 |
# File 'lib/bundler08/environment.rb', line 49 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/bundler08/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 |
#require_env(env = nil) ⇒ Object
31 32 33 |
# File 'lib/bundler08/environment.rb', line 31 def require_env(env = nil) dependencies.each { |d| d.require_env(env) } end |
#sources ⇒ Object
35 36 37 38 39 |
# File 'lib/bundler08/environment.rb', line 35 def sources sources = @priority_sources + [SystemGemSource.new(@bundle)] + @sources + @default_sources sources.reject! {|s| !s.local? } if Bundler.local? sources end |