Allow user to specify npm CLI options

Esse commit está contido em:
Barthelemy Vessemont
2014-05-11 01:19:11 +02:00
commit 296a689e3a
4 arquivos alterados com 12 adições e 0 exclusões
+4
Ver Arquivo
@@ -67,6 +67,10 @@ include_recipe "nodejs::npm"
* use a `String` to specify json file
Packages can be installed globally (by default) or in a directory (by using `attribute :path`)
You can append more specific options to npm command with `attribute :options` array :
* use an array of options (w/ dash), they will be added to npm call.
* ex: `['--production','--force']` or `['--force-latest']`
This LWRP try to use npm bare as much as possible (no custom wrapper).
+3
Ver Arquivo
@@ -31,6 +31,9 @@ end
def npm_options
options = ''
options << ' -global' unless new_resource.path
new_resource.options.each do |option|
options << " #{option}"
end
options << " #{npm_package}"
end
+1
Ver Arquivo
@@ -27,6 +27,7 @@ attribute :version, :kind_of => String
attribute :path, :kind_of => String
attribute :url, :kind_of => String
attribute :json, :kind_of => [String, TrueClass]
attribute :options, :kind_of => Array, :default => []
attribute :user, :kind_of => String
attribute :group, :kind_of => String
+4
Ver Arquivo
@@ -26,3 +26,7 @@ nodejs_npm 'grunt' do
json true
user 'random'
end
nodejs_npm 'mocha' do
options ['--force', '--production']
end