vagrant and chef install everything
This commit is contained in:
23
ops/cookbooks/vendor/nodejs/recipes/default.rb
vendored
Normal file
23
ops/cookbooks/vendor/nodejs/recipes/default.rb
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# Author:: Marius Ducea (marius@promethost.com)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright:: 2010-2017, Promet Solutions
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'nodejs::install' if node['nodejs']['manage_node']
|
||||
include_recipe 'nodejs::npm' if node['nodejs']['manage_node']
|
||||
include_recipe 'nodejs::npm_packages' if node['nodejs']['manage_node']
|
21
ops/cookbooks/vendor/nodejs/recipes/install.rb
vendored
Normal file
21
ops/cookbooks/vendor/nodejs/recipes/install.rb
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# Author:: Marius Ducea (marius@promethost.com)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: install
|
||||
#
|
||||
# Copyright:: 2010-2017, Promet Solutions
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe "nodejs::nodejs_from_#{node['nodejs']['install_method']}"
|
1
ops/cookbooks/vendor/nodejs/recipes/iojs.rb
vendored
Normal file
1
ops/cookbooks/vendor/nodejs/recipes/iojs.rb
vendored
Normal file
@ -0,0 +1 @@
|
||||
Chef::Log.fatal('The nodejs::iojs recipe has been deprecated. If you need iojs installation pin to cookbook version 3.0.1.')
|
21
ops/cookbooks/vendor/nodejs/recipes/nodejs.rb
vendored
Normal file
21
ops/cookbooks/vendor/nodejs/recipes/nodejs.rb
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
#
|
||||
# Author:: Marius Ducea (marius@promethost.com)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: nodejs
|
||||
#
|
||||
# Copyright:: 2010-2017, Promet Solutions
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Chef::Log.fatal('The nodejs::nodejs recipe is no longer used. Use nodejs::install to install nodejs instead.')
|
65
ops/cookbooks/vendor/nodejs/recipes/nodejs_from_binary.rb
vendored
Normal file
65
ops/cookbooks/vendor/nodejs/recipes/nodejs_from_binary.rb
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
#
|
||||
# Author:: Julian Wilde (jules@jules.com.au)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: install_from_binary
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Chef::Recipe.send(: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?
|
||||
arch = if node['kernel']['machine'] =~ /armv6l/
|
||||
# FIXME: This should really check the version of node we're looking for
|
||||
# as it seems that they haven't build an `arm-pi` version in a while...
|
||||
# if it's old, return this, otherwise just return `node['kernel']['machine']`
|
||||
'arm-pi' # assume a raspberry pi
|
||||
elsif node['kernel']['machine'] =~ /aarch64/
|
||||
'arm64'
|
||||
elsif node['kernel']['machine'] =~ /x86_64/
|
||||
'x64'
|
||||
elsif node['kernel']['machine'] =~ /\d86/
|
||||
'x86'
|
||||
else
|
||||
node['kernel']['machine']
|
||||
end
|
||||
|
||||
# needed to uncompress the binary
|
||||
package 'tar' if platform_family?('rhel', 'fedora', 'amazon', 'suse')
|
||||
|
||||
# package_stub is for example: "node-v6.9.1-linux-x64.tar.gz"
|
||||
version = "v#{node['nodejs']['version']}/"
|
||||
prefix = node['nodejs']['prefix_url']['node']
|
||||
|
||||
filename = "node-v#{node['nodejs']['version']}-linux-#{arch}.tar.gz"
|
||||
archive_name = 'nodejs-binary'
|
||||
binaries = ['bin/node']
|
||||
|
||||
binaries.push('bin/npm') if node['nodejs']['npm']['install_method'] == 'embedded'
|
||||
|
||||
if node['nodejs']['binary']['url']
|
||||
nodejs_bin_url = node['nodejs']['binary']['url']
|
||||
checksum = node['nodejs']['binary']['checksum']
|
||||
else
|
||||
nodejs_bin_url = ::URI.join(prefix, version, filename).to_s
|
||||
checksum = node['nodejs']['binary']['checksum']["linux_#{arch}"]
|
||||
end
|
||||
|
||||
ark archive_name do
|
||||
url nodejs_bin_url
|
||||
version node['nodejs']['version']
|
||||
checksum checksum
|
||||
has_binaries binaries
|
||||
action :install
|
||||
end
|
33
ops/cookbooks/vendor/nodejs/recipes/nodejs_from_package.rb
vendored
Normal file
33
ops/cookbooks/vendor/nodejs/recipes/nodejs_from_package.rb
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
#
|
||||
# Author:: Nathan L Smith (nlloyds@gmail.com)
|
||||
# Author:: Marius Ducea (marius@promethost.com)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: package
|
||||
#
|
||||
# Copyright:: 2012-2017, Cramer Development, Inc.
|
||||
# Copyright:: 2013-2017, Opscale
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'nodejs::repo' if node['nodejs']['install_repo']
|
||||
|
||||
unless node['nodejs']['packages']
|
||||
Chef::Log.error 'No package for nodejs'
|
||||
Chef::Log.warn 'Please use the source or binary method to install node'
|
||||
return
|
||||
end
|
||||
|
||||
node['nodejs']['packages'].each do |node_pkg|
|
||||
package node_pkg
|
||||
end
|
45
ops/cookbooks/vendor/nodejs/recipes/nodejs_from_source.rb
vendored
Normal file
45
ops/cookbooks/vendor/nodejs/recipes/nodejs_from_source.rb
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
#
|
||||
# Author:: Marius Ducea (marius@promethost.com)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: source
|
||||
#
|
||||
# Copyright:: 2010-2017, Promet Solutions
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Chef::Recipe.send(:include, NodeJs::Helper)
|
||||
|
||||
build_essential 'install build tools'
|
||||
|
||||
case node['platform_family']
|
||||
when 'rhel', 'fedora', 'amazon'
|
||||
package %w(openssl-devel tar)
|
||||
when 'debian'
|
||||
package 'libssl-dev'
|
||||
end
|
||||
|
||||
version = "v#{node['nodejs']['version']}/"
|
||||
prefix = node['nodejs']['prefix_url']['node']
|
||||
filename = "node-v#{node['nodejs']['version']}.tar.gz"
|
||||
archive_name = 'nodejs-source'
|
||||
|
||||
nodejs_src_url = node['nodejs']['source']['url'] || ::URI.join(prefix, version, filename).to_s
|
||||
|
||||
ark archive_name do
|
||||
url nodejs_src_url
|
||||
version node['nodejs']['version']
|
||||
checksum node['nodejs']['source']['checksum']
|
||||
make_opts ["-j #{node['nodejs']['make_threads']}"]
|
||||
action :install_with_make
|
||||
end
|
28
ops/cookbooks/vendor/nodejs/recipes/npm.rb
vendored
Normal file
28
ops/cookbooks/vendor/nodejs/recipes/npm.rb
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#
|
||||
# Author:: Marius Ducea (marius@promethost.com)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: npm
|
||||
#
|
||||
# Copyright:: 2010-2017, Promet Solutions
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
case node['nodejs']['npm']['install_method']
|
||||
when 'embedded'
|
||||
include_recipe 'nodejs::install'
|
||||
when 'source'
|
||||
include_recipe 'nodejs::npm_from_source'
|
||||
else
|
||||
Chef::Log.error('No install method found for npm')
|
||||
end
|
32
ops/cookbooks/vendor/nodejs/recipes/npm_from_source.rb
vendored
Normal file
32
ops/cookbooks/vendor/nodejs/recipes/npm_from_source.rb
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
#
|
||||
# Author:: Marius Ducea (marius@promethost.com)
|
||||
# Cookbook:: nodejs
|
||||
# Recipe:: npm
|
||||
#
|
||||
# Copyright:: 2010-2017, Promet Solutions
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Chef::Recipe.send(:include, NodeJs::Helper)
|
||||
|
||||
include_recipe 'nodejs::nodejs_from_source'
|
||||
|
||||
dist = npm_dist
|
||||
|
||||
ark 'npm' do
|
||||
url dist['url']
|
||||
checksum dist['checksum']
|
||||
version dist['version']
|
||||
action :install_with_make
|
||||
end
|
11
ops/cookbooks/vendor/nodejs/recipes/npm_packages.rb
vendored
Normal file
11
ops/cookbooks/vendor/nodejs/recipes/npm_packages.rb
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
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 if node['nodejs'].key?('npm_packages')
|
20
ops/cookbooks/vendor/nodejs/recipes/repo.rb
vendored
Normal file
20
ops/cookbooks/vendor/nodejs/recipes/repo.rb
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
case node['platform_family']
|
||||
when 'debian'
|
||||
package 'nodejs-apt-transport-https' do
|
||||
package_name 'apt-transport-https'
|
||||
end
|
||||
|
||||
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'
|
||||
yum_repository 'node.js' do
|
||||
description 'nodesource.com nodejs repository'
|
||||
baseurl node['nodejs']['repo']
|
||||
gpgkey node['nodejs']['key']
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user