Initial Chef repository

This commit is contained in:
Greg Karékinian
2015-07-21 19:45:23 +02:00
parent 7e5401fc71
commit ee4079fa85
1151 changed files with 185163 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#
# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: default
#
# Copyright 2010-2012, 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'
include_recipe 'nodejs::npm'
include_recipe 'nodejs::npm_packages'

View File

@@ -0,0 +1,21 @@
#
# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: install
#
# Copyright 2010-2012, 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']}"

View File

@@ -0,0 +1,23 @@
#
# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: iojs
#
# Copyright 2010-2012, 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.
#
node.default['nodejs']['engine'] = 'iojs'
include_recipe 'nodejs::install'

View File

@@ -0,0 +1,23 @@
#
# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: nodejs
#
# Copyright 2010-2012, 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.
#
node.default['nodejs']['engine'] = 'node'
include_recipe 'nodejs::install'

View File

@@ -0,0 +1,58 @@
#
# Author:: Julian Wilde (jules@jules.com.au)
# Cookbook Name:: 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)
node.force_override['nodejs']['install_method'] = 'binary' # ~FC019
# Shamelessly borrowed from http://docs.opscode.com/dsl_recipe_method_platform.html
# Surely there's a more canonical way to get arch?
if node['kernel']['machine'] =~ /armv6l/
arch = 'arm-pi' # assume a raspberry pi
else
arch = node['kernel']['machine'] =~ /x86_64/ ? 'x64' : 'x86'
end
# package_stub is for example: "node-v0.8.20-linux-x64.tar.gz"
version = "v#{node['nodejs']['version']}/"
if node['nodejs']['engine'] == 'iojs'
filename = "iojs-v#{node['nodejs']['version']}-linux-#{arch}.tar.gz"
archive_name = 'iojs-binary'
binaries = ['bin/iojs', 'bin/node', 'bin/npm']
else
filename = "node-v#{node['nodejs']['version']}-linux-#{arch}.tar.gz"
archive_name = 'nodejs-binary'
binaries = ['bin/node', 'bin/npm']
end
if node['nodejs']['binary']['url']
nodejs_bin_url = node['nodejs']['binary']['url']
checksum = node['nodejs']['binary']['checksum']
else
nodejs_bin_url = ::URI.join(node['nodejs']['prefix_url'], 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

View File

@@ -0,0 +1,35 @@
#
# Author:: Nathan L Smith (nlloyds@gmail.com)
# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: package
#
# Copyright 2012, Cramer Development, Inc.
# Copyright 2013, 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.
#
node.force_override['nodejs']['install_method'] = 'package' # ~FC019
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

View File

@@ -0,0 +1,52 @@
#
# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: source
#
# Copyright 2010-2012, 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)
node.force_override['nodejs']['install_method'] = 'source' # ~FC019
include_recipe 'build-essential'
case node['platform_family']
when 'rhel', 'fedora'
package 'openssl-devel'
when 'debian'
package 'libssl-dev'
end
version = "v#{node['nodejs']['version']}/"
if node['nodejs']['engine'] == 'iojs'
filename = "iojs-v#{node['nodejs']['version']}.tar.gz"
archive_name = 'iojs-source'
else
filename = "node-v#{node['nodejs']['version']}.tar.gz"
archive_name = 'nodejs-source'
end
nodejs_src_url = node['nodejs']['source']['url'] || ::URI.join(node['nodejs']['prefix_url'], 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

View File

@@ -0,0 +1,28 @@
#
# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: npm
#
# Copyright 2010-2012, 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

View File

@@ -0,0 +1,34 @@
#
# Author:: Marius Ducea (marius@promethost.com)
# Cookbook Name:: nodejs
# Recipe:: npm
#
# Copyright 2010-2012, 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)
node.force_override['nodejs']['npm']['install_method'] = 'source' # ~FC019
include_recipe 'nodejs::install'
dist = npm_dist
ark 'npm' do
url dist['url']
checksum dist['checksum']
version dist['version']
action :install_with_make
end

View File

@@ -0,0 +1,10 @@
node['nodejs']['npm_packages'].each do |pkg|
f = nodejs_npm pkg['name'] do
action :nothing
end
pkg.each do |key, value|
f.send(key, value) unless key == 'name' || key == 'action'
end
action = pkg.key?('action') ? pkg['action'] : :install
f.action(action)
end if node['nodejs'].key?('npm_packages')

View File

@@ -0,0 +1,16 @@
case node['platform_family']
when 'debian'
include_recipe 'apt'
package 'apt-transport-https'
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'
include_recipe 'yum-epel'
end