Class: BuildpackSupport::Component::Application
- Inherits:
-
Object
- Object
- BuildpackSupport::Component::Application
- Defined in:
- lib/buildpack_support/component/application.rb
Overview
An abstraction around the application as uploaded by the user. This abstraction is intended to hide any modifications made to the filesystem by other components. Think of this as an immutable representation of the application as it was uploaded.
A new instance of this type should be created once for the application.
Instance Attribute Summary collapse
-
#details ⇒ Hash
readonly
The parsed contents of the
VCAP_APPLICATIONenvironment variable. -
#environment ⇒ Hash
readonly
All environment variables except
VCAP_APPLICATIONandVCAP_SERVICES. -
#root ⇒ BuildpackSupport::FilteringPathname
readonly
The root of the application’s fileystem filtered so that it only shows files that have been uploaded by the user.
-
#services ⇒ Hash
readonly
The parsed contents of the
VCAP_SERVICESenvironment variable.
Instance Method Summary collapse
-
#initialize(root) ⇒ Application
constructor
Create a new instance of the application abstraction.
Constructor Details
#initialize(root) ⇒ Application
Create a new instance of the application abstraction
52 53 54 55 56 57 58 59 |
# File 'lib/buildpack_support/component/application.rb', line 52 def initialize(root) initial = children(root) @root = BuildpackSupport::FilteringPathname.new(root, ->(path) { initial.member? path }, false) @environment = ENV.to_hash @details = parse(@environment.delete('VCAP_APPLICATION')) @services = Services.new(parse(@environment.delete('VCAP_SERVICES'))) end |
Instance Attribute Details
#details ⇒ Hash (readonly)
Returns the parsed contents of the VCAP_APPLICATION environment variable.
33 34 35 |
# File 'lib/buildpack_support/component/application.rb', line 33 def details @details end |
#environment ⇒ Hash (readonly)
Returns all environment variables except VCAP_APPLICATION and VCAP_SERVICES. Those values are available separately in parsed form.
38 39 40 |
# File 'lib/buildpack_support/component/application.rb', line 38 def environment @environment end |
#root ⇒ BuildpackSupport::FilteringPathname (readonly)
Returns the root of the application’s fileystem filtered so that it only shows files that have been uploaded by the user.
43 44 45 |
# File 'lib/buildpack_support/component/application.rb', line 43 def root @root end |
#services ⇒ Hash (readonly)
Returns the parsed contents of the VCAP_SERVICES environment variable.
47 48 49 |
# File 'lib/buildpack_support/component/application.rb', line 47 def services @services end |