Class: BuildpackSupport::Component::BaseComponent
- Inherits:
-
Object
- Object
- BuildpackSupport::Component::BaseComponent
- Includes:
- Downloads
- Defined in:
- lib/buildpack_support/component/base_component.rb
Overview
A convenience base class for all components in the buildpack. This base class ensures that the contents of the context
are assigned to instance variables matching their keys. It also ensures that all contract methods are implemented.
Direct Known Subclasses
Instance Method Summary collapse
-
#compile ⇒ Void
Modifies the application’s file system.
-
#detect ⇒ Array<String>, ...
If the component should be used when staging an application.
-
#initialize(context) ⇒ BaseComponent
constructor
Creates an instance.
-
#release ⇒ void, String
Modifies the application’s runtime configuration.
Methods included from Downloads
#download, #download_tar, #download_zip
Methods included from WithTiming
Methods included from Shell
Constructor Details
#initialize(context) ⇒ BaseComponent
Creates an instance. The contents of context
are assigned to the instance variables matching their keys.
38 39 40 41 42 43 |
# File 'lib/buildpack_support/component/base_component.rb', line 38 def initialize(context) @application = context[:application] @component_name = self.class.to_s.space_case @configuration = context[:configuration] @droplet = context[:droplet] end |
Instance Method Details
#compile ⇒ Void
Modifies the application’s file system. The component is expected to transform the application’s file system in whatever way is necessary (e.g. downloading files or creating symbolic links) to support the function of the component. Status output written to STDOUT
is expected as part of this invocation.
59 60 61 |
# File 'lib/buildpack_support/component/base_component.rb', line 59 def compile fail "Method 'compile' must be defined" end |
#detect ⇒ Array<String>, ...
If the component should be used when staging an application
50 51 52 |
# File 'lib/buildpack_support/component/base_component.rb', line 50 def detect fail "Method 'detect' must be defined" end |
#release ⇒ void, String
Modifies the application’s runtime configuration. The component is expected to transform members of the context
(e.g. @java_home, @java_opts, etc.) in whatever way is necessary to support the function of the component.
Container components are also expected to create the command required to run the application. These components are expected to read the context
values and take them into account when creating the command.
71 72 73 |
# File 'lib/buildpack_support/component/base_component.rb', line 71 def release fail "Method 'release' must be defined" end |