Class: PoiseJavascript::Resources::NpmInstall::Provider
- Inherits:
-
Chef::Provider
- Object
- Chef::Provider
- PoiseJavascript::Resources::NpmInstall::Provider
- Includes:
- Poise, JavascriptCommandMixin
- Defined in:
- lib/poise_javascript/resources/npm_install.rb
Overview
The default provider for npm_install
.
Instance Method Summary collapse
-
#action_install
The
install
action for thenpm_install
resource.
Instance Method Details
#action_install
This method returns an undefined value.
The install
action for the npm_install
resource.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/poise_javascript/resources/npm_install.rb', line 78 def action_install cmd = [new_resource.npm_binary, 'install'] cmd << '--production' if new_resource.production # Set --unsafe-perm unless the property is nil. unless new_resource.unsafe_perm.nil? cmd << '--unsafe-perm' cmd << new_resource.unsafe_perm.to_s end # Add the directory for the node binary to $PATH for post-install stuffs. new_path = [::File.dirname(new_resource.javascript), ENV['PATH'].to_s].join(::File::PATH_SEPARATOR) output = javascript_shell_out!(cmd, cwd: new_resource.path, user: new_resource.user, group: new_resource.group, environment: {'PATH' => new_path}, timeout: new_resource.timeout).stdout unless output.strip.empty? # Any output means it did something. new_resource.updated_by_last_action(true) end end |