Module: PoiseApplicationRuby::AppMixin::Resource
- Includes:
- PoiseApplication::AppMixin::Resource, PoiseRuby::RubyCommandMixin::Resource
- Included in:
- ServiceMixin::Resource
- Defined in:
- lib/poise_application_ruby/app_mixin.rb
Overview
A helper mixin for Ruby application resources.
Instance Attribute Summary collapse
- #app_state_bundle ⇒ Object
- #app_state_ruby ⇒ Object
-
#parent_bundle ⇒ PoiseRuby::Resources::BundleInstall::Resource?
Parent bundle install context.
-
#parent_ruby ⇒ PoiseRuby::Resources::RubyRuntime::Resource?
Override the #parent_ruby from RubyCommandMixin to grok the application level parent as a default value.
Instance Method Summary collapse
-
#app_state_environment_ruby ⇒ Hash<String, String>
A merged hash of environment variables for both the application state and parent ruby.
-
#ruby_from_parent(resource)
Update ruby_from_parent to transfer #parent_bundle too.
Instance Attribute Details
#app_state_bundle ⇒ Object
59 60 61 62 63 64 |
# File 'lib/poise_application_ruby/app_mixin.rb', line 59 def app_state_bundle(bundle=Poise::NOT_PASSED) unless bundle == Poise::NOT_PASSED app_state[:bundle] = bundle end app_state[:bundle] end |
#app_state_ruby ⇒ Object
49 50 51 52 53 54 |
# File 'lib/poise_application_ruby/app_mixin.rb', line 49 def app_state_ruby(ruby=Poise::NOT_PASSED) unless ruby == Poise::NOT_PASSED app_state[:ruby] = ruby end app_state[:ruby] end |
#parent_bundle ⇒ PoiseRuby::Resources::BundleInstall::Resource?
Parent bundle install context.
44 |
# File 'lib/poise_application_ruby/app_mixin.rb', line 44 parent_attribute(:bundle, type: :ruby_runtime, optional: true, auto: false, default: lazy { app_state_bundle.equal?(self) ? nil : app_state_bundle }) |
#parent_ruby ⇒ PoiseRuby::Resources::RubyRuntime::Resource?
Override the #parent_ruby from RubyCommandMixin to grok the application level parent as a default value.
39 |
# File 'lib/poise_application_ruby/app_mixin.rb', line 39 parent_attribute(:ruby, type: :ruby_runtime, optional: true, default: lazy { app_state_ruby.equal?(self) ? nil : app_state_ruby }) |
Instance Method Details
#app_state_environment_ruby ⇒ Hash<String, String>
A merged hash of environment variables for both the application state and parent ruby.
70 71 72 73 74 75 |
# File 'lib/poise_application_ruby/app_mixin.rb', line 70 def app_state_environment_ruby env = app_state_environment env = env.merge(parent_ruby.ruby_environment) if parent_ruby env['BUNDLE_GEMFILE'] = parent_bundle.gemfile_path if parent_bundle env end |
#ruby_from_parent(resource)
This method returns an undefined value.
Update ruby_from_parent to transfer #parent_bundle too.
81 82 83 84 |
# File 'lib/poise_application_ruby/app_mixin.rb', line 81 def ruby_from_parent(resource) super parent_bundle(resource.parent_bundle) if resource.parent_bundle end |