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.

Since:

  • 4.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_state_bundleObject

Since:

  • 4.0.0



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_rubyObject

Since:

  • 4.0.0



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_bundlePoiseRuby::Resources::BundleInstall::Resource?

Parent bundle install context.

Returns:

  • (PoiseRuby::Resources::BundleInstall::Resource, nil)


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_rubyPoiseRuby::Resources::RubyRuntime::Resource?

Override the #parent_ruby from RubyCommandMixin to grok the application level parent as a default value.

Returns:

  • (PoiseRuby::Resources::RubyRuntime::Resource, nil)


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_rubyHash<String, String>

A merged hash of environment variables for both the application state and parent ruby.

Returns:

  • (Hash<String, String>)

Since:

  • 4.0.0



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.

Parameters:

  • resource (Chef::Resource)

    Resource to inherit from.

Since:

  • 4.0.0



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