Class: Solidus::InstallGenerator::BundlerContext Private
- Inherits:
-
Object
- Object
- Solidus::InstallGenerator::BundlerContext
- Defined in:
- lib/generators/solidus/install/install_generator/bundler_context.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Bundler context during the install process.
This class gives access to information about the bundler context in which the install generator is run. I.e., which solidus components are present in the user’s Gemfile. It also allows modifying the Gemfile to add or remove gems.
Defined Under Namespace
Classes: InjectorWithPathSupport
Instance Attribute Summary collapse
- #dependencies ⇒ Object readonly private
- #injector ⇒ Object readonly private
Class Method Summary collapse
- .bundle_cleanly(&block) ⇒ Object private
Instance Method Summary collapse
- #break_down_components(components) ⇒ Object private
- #component_in_gemfile?(name) ⇒ Boolean private
-
#initialize ⇒ BundlerContext
constructor
private
A new instance of BundlerContext.
- #remove(*args, **kwargs, &block) ⇒ Object private
- #solidus_in_gemfile? ⇒ Boolean private
Constructor Details
#initialize ⇒ BundlerContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BundlerContext.
51 52 53 54 |
# File 'lib/generators/solidus/install/install_generator/bundler_context.rb', line 51 def initialize @dependencies = uncached_dependencies @injector = InjectorWithPathSupport end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/generators/solidus/install/install_generator/bundler_context.rb', line 45 def dependencies @dependencies end |
#injector ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/generators/solidus/install/install_generator/bundler_context.rb', line 45 def injector @injector end |
Class Method Details
.bundle_cleanly(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/generators/solidus/install/install_generator/bundler_context.rb', line 47 def self.bundle_cleanly(&block) Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&block) : Bundler.with_clean_env(&block) end |
Instance Method Details
#break_down_components(components) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 67 68 69 70 71 72 |
# File 'lib/generators/solidus/install/install_generator/bundler_context.rb', line 64 def break_down_components(components) raise " solidus meta gem needs to be present in the Gemfile to build the component dependency\n MSG\n\n @injector.inject(\n components.map { |component| dependency_for_component(component) }\n )\nend\n" unless solidus_in_gemfile? |
#component_in_gemfile?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
60 61 62 |
# File 'lib/generators/solidus/install/install_generator/bundler_context.rb', line 60 def component_in_gemfile?(name) !@dependencies["solidus_#{name}"].nil? end |
#remove(*args, **kwargs, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
74 75 76 |
# File 'lib/generators/solidus/install/install_generator/bundler_context.rb', line 74 def remove(*args, **kwargs, &block) @injector.remove(*args, **kwargs, &block) end |
#solidus_in_gemfile? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 |
# File 'lib/generators/solidus/install/install_generator/bundler_context.rb', line 56 def solidus_in_gemfile? !solidus_dependency.nil? end |