Upgrade nodejs to the latest version from the repo
This is possible in newer versions of the nodejs cookbook, by setting the `node["nodejs"]["package_action"]["nodejs"]` attribute to `:upgrade`
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#
|
||||
|
||||
# Author:: Marius Ducea (marius@promethost.com)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: default
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Chef::Recipe.send(:include, NodeJs::Helper)
|
||||
Chef::DSL::Recipe.include NodeJs::Helper
|
||||
|
||||
# Shamelessly borrowed from http://docs.chef.io/dsl_recipe_method_platform.html
|
||||
# Surely there's a more canonical way to get arch?
|
||||
@@ -47,6 +47,7 @@ archive_name = 'nodejs-binary'
|
||||
binaries = ['bin/node']
|
||||
|
||||
binaries.push('bin/npm') if node['nodejs']['npm']['install_method'] == 'embedded'
|
||||
binaries.push('bin/npx') if node['nodejs']['npm']['install_method'] == 'embedded'
|
||||
|
||||
if node['nodejs']['binary']['url']
|
||||
nodejs_bin_url = node['nodejs']['binary']['url']
|
||||
@@ -61,5 +62,6 @@ ark archive_name do
|
||||
version node['nodejs']['version']
|
||||
checksum checksum
|
||||
has_binaries binaries
|
||||
append_env_path node['nodejs']['binary']['append_env_path']
|
||||
action :install
|
||||
end
|
||||
|
||||
@@ -29,5 +29,8 @@ unless node['nodejs']['packages']
|
||||
end
|
||||
|
||||
node['nodejs']['packages'].each do |node_pkg|
|
||||
package node_pkg
|
||||
package node_pkg do
|
||||
action node['nodejs']['package_action'][node_pkg] if node['nodejs']['package_action'][node_pkg]
|
||||
options node['nodejs']['package_options'][node_pkg] if node['nodejs']['package_options'][node_pkg]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -18,15 +18,18 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Chef::Recipe.send(:include, NodeJs::Helper)
|
||||
Chef::DSL::Recipe.include NodeJs::Helper
|
||||
|
||||
include_recipe 'build-essential'
|
||||
build_essential 'install build tools'
|
||||
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora', 'amazon'
|
||||
package %w(openssl-devel tar)
|
||||
# The ark resource uses and requires python2 for builds
|
||||
package %w(openssl-devel python2 tar)
|
||||
when 'debian'
|
||||
package 'libssl-dev'
|
||||
package %w(libssl-dev python)
|
||||
when 'suse'
|
||||
package %w(python)
|
||||
end
|
||||
|
||||
version = "v#{node['nodejs']['version']}/"
|
||||
@@ -42,4 +45,5 @@ ark archive_name do
|
||||
checksum node['nodejs']['source']['checksum']
|
||||
make_opts ["-j #{node['nodejs']['make_threads']}"]
|
||||
action :install_with_make
|
||||
environment(PYTHON: 'python2')
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Chef::Recipe.send(:include, NodeJs::Helper)
|
||||
Chef::DSL::Recipe.include NodeJs::Helper
|
||||
|
||||
include_recipe 'nodejs::nodejs_from_source'
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
node['nodejs']['npm_packages'].each do |pkg|
|
||||
pkg_action = pkg.key?('action') ? pkg['action'] : :install
|
||||
f = npm_package "nodejs_npm-#{pkg['name']}-#{pkg_action}" do
|
||||
action :nothing
|
||||
package pkg['name']
|
||||
if node['nodejs'].key?('npm_packages')
|
||||
node['nodejs']['npm_packages'].each do |pkg|
|
||||
pkg_action = pkg.key?('action') ? pkg['action'] : :install
|
||||
f = npm_package "nodejs_npm-#{pkg['name']}-#{pkg_action}" do
|
||||
action :nothing
|
||||
package pkg['name']
|
||||
end
|
||||
pkg.each do |key, value|
|
||||
f.send(key, value) unless key == 'name' || key == 'action'
|
||||
end
|
||||
f.action(pkg_action)
|
||||
end
|
||||
pkg.each do |key, value|
|
||||
f.send(key, value) unless key == 'name' || key == 'action'
|
||||
end
|
||||
f.action(pkg_action)
|
||||
end if node['nodejs'].key?('npm_packages')
|
||||
end
|
||||
|
||||
@@ -6,12 +6,11 @@ when 'debian'
|
||||
|
||||
apt_repository 'node.js' do
|
||||
uri node['nodejs']['repo']
|
||||
distribution node['lsb']['codename']
|
||||
components ['main']
|
||||
keyserver node['nodejs']['keyserver']
|
||||
key node['nodejs']['key']
|
||||
end
|
||||
when 'rhel', 'amazon'
|
||||
when 'rhel', 'fedora', 'amazon'
|
||||
yum_repository 'node.js' do
|
||||
description 'nodesource.com nodejs repository'
|
||||
baseurl node['nodejs']['repo']
|
||||
|
||||
Reference in New Issue
Block a user