module PoiseApplicationJavascript::ServiceMixin::Provider

A helper mixin for Javascript service providers.

Public Instance Methods

service_options(resource) click to toggle source

Set up the service for running Javascript stuff.

Calls superclass method
# File lib/poise_application_javascript/service_mixin.rb, line 43
def service_options(resource)
  super
  # Closure scoping for #javascript_command below.
  self_ = self
  # Create a new singleton method that fills in `node` for you.
  resource.define_singleton_method(:javascript_command) do |val|
    resource.command("#{self_.new_resource.javascript} #{PoiseLanguages::Utils.absolute_command(val, path: self_.new_resource.app_state_environment_javascript['PATH'])}")
  end
  # Include env vars as needed.
  resource.environment.update(new_resource.parent_javascript.javascript_environment) if new_resource.parent_javascript
end