Vendor the external cookbooks

Knife-Zero doesn't include Berkshelf support, so vendoring everything in
the repo is convenient again
This commit is contained in:
Greg Karékinian
2019-10-13 19:17:42 +02:00
parent f4bfe31ac1
commit a32f34b408
1245 changed files with 100630 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
#
# Copyright 2015-2017, Noah Kantrowitz
#
# 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.
#
require 'chef/provider'
require 'poise'
module PoiseJavascript
module JavascriptProviders
class Base < Chef::Provider
include Poise(inversion: :javascript_runtime)
# Set default inversion options.
#
# @api private
def self.default_inversion_options(node, new_resource)
super.merge({
version: new_resource.version,
})
end
# The `install` action for the `javascript_runtime` resource.
#
# @return [void]
def action_install
notifying_block do
install_javascript
end
end
# The `uninstall` action for the `javascript_runtime` resource.
#
# @abstract
# @return [void]
def action_uninstall
notifying_block do
uninstall_javascript
end
end
# The path to the `javascript` binary. This is an output property.
#
# @abstract
# @return [String]
def javascript_binary
raise NotImplementedError
end
# The environment variables for this Javascript. This is an output property.
#
# @return [Hash<String, String>]
def javascript_environment
{}
end
# The path to the `npm` binary. This is an output property.
#
# @abstract
# @return [String]
def npm_binary
::File.expand_path(::File.join('..', 'npm'), javascript_binary)
end
private
# Install the Javascript runtime. Must be implemented by subclass.
#
# @abstract
# @return [void]
def install_javascript
raise NotImplementedError
end
# Uninstall the Javascript runtime. Must be implemented by subclass.
#
# @abstract
# @return [void]
def uninstall_javascript
raise NotImplementedError
end
end
end
end

View File

@@ -0,0 +1,77 @@
#
# Copyright 2015-2017, Noah Kantrowitz
#
# 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.
#
require 'poise_javascript/javascript_providers/base'
module PoiseJavascript
module JavascriptProviders
# Inversion provider for the `javascript_runtime` resource to use a fake Javascript,
# for use in unit tests.
#
# @since 1.0.0
# @provides dummy
class Dummy < Base
provides(:dummy)
def self.default_inversion_options(node, resource)
super.merge({
# Manual overrides for dummy data.
javascript_binary: ::File.join('', 'node'),
javascript_environment: nil,
npm_binary: nil,
})
end
# The `install` action for the `javascript_runtime` resource.
#
# @return [void]
def action_install
# This space left intentionally blank.
end
# The `uninstall` action for the `javascript_runtime` resource.
#
# @return [void]
def action_uninstall
# This space left intentionally blank.
end
# Path to the non-existent Javascript.
#
# @return [String]
def javascript_binary
options['javascript_binary']
end
# Environment for the non-existent Javascript.
#
# @return [String]
def javascript_environment
options['javascript_environment'] || super
end
# Path to the non-existent npm.
#
# @return [String]
def npm_binary
options['npm_binary'] || super
end
end
end
end

View File

@@ -0,0 +1,64 @@
#
# Copyright 2015-2017, Noah Kantrowitz
#
# 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.
#
require 'chef/resource'
require 'poise_languages/static'
require 'poise_javascript/error'
require 'poise_javascript/javascript_providers/base'
module PoiseJavascript
module JavascriptProviders
class IOJS < Base
provides(:iojs)
include PoiseLanguages::Static(
versions: %w{3.3.1 3.2.0 3.1.0 3.0.0 2.5.0 2.4.0 2.3.4 2.2.1 2.1.0 2.0.2 1.8.4 1.7.1 1.6.4 1.5.1 1.4.3 1.3.0 1.2.0 1.1.0 1.0.4},
machines: %w{linux-i686 linux-x86_64 darwin-x86_64},
url: 'https://iojs.org/dist/v%{version}/iojs-v%{version}-%{kernel}-%{machine}.tar.gz',
)
def self.provides_auto?(node, resource)
# Also work if we have a version starting with 1. 2. or 3. since that has
# to be io.js and no other mechanism supports that.
super || (resource.version.to_s =~ /^[123](\.|$)/ && static_machines.include?(static_machine_label(node)))
end
MACHINE_LABELS = {'i386' => 'x86', 'i686' => 'x86', 'x86_64' => 'x64'}
def static_url_variables
machine = node['kernel']['machine']
super.merge(machine: MACHINE_LABELS[machine] || machine)
end
def javascript_binary
::File.join(static_folder, 'bin', 'iojs')
end
private
def install_javascript
install_static
end
def uninstall_javascript
uninstall_static
end
end
end
end

View File

@@ -0,0 +1,65 @@
#
# Copyright 2015-2017, Noah Kantrowitz
#
# 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.
#
require 'chef/resource'
require 'poise_languages/static'
require 'poise_javascript/error'
require 'poise_javascript/javascript_providers/base'
module PoiseJavascript
module JavascriptProviders
class NodeJS < Base
provides(:nodejs)
include PoiseLanguages::Static(
# LTS version is first so that it is what you get for version ''.
versions: %w{8.11.1 10.0.0 9.11.1 9.10.1 9.9.0 9.8.0 9.7.1 9.6.1 9.5.0 9.4.0 9.3.0 9.2.1 9.1.0 9.0.0 8.10.0 8.9.4 8.8.1 8.7.0 8.6.0 8.5.0 8.4.0 8.3.0 8.2.1 8.1.4 8.0.0 7.10.1 7.9.0 7.8.0 7.7.4 7.6.0 7.5.0 7.4.0 7.3.0 7.2.1 7.1.0 7.0.0 6.14.2 6.13.1 6.12.3 6.11.5 6.10.3 6.9.5 6.8.1 6.7.0 6.6.0 6.5.0 6.4.0 6.3.1 6.2.2 6.1.0 6.0.0 5.12.0 5.11.1 5.10.1 5.9.1 5.8.0 5.7.1 5.6.0 5.5.0 5.4.1 5.3.0 5.2.0 5.1.1 5.0.0 4.9.1 4.8.7 4.7.3 4.6.2 4.5.0 4.4.7 4.3.2 4.2.6 4.1.2 4.0.0 0.12.18 0.11.16 0.10.48 0.9.12 0.8.28 0.7.12 0.6.21 0.5.10 0.4.12 0.3.8 0.2.6 0.1.104},
machines: %w{linux-i686 linux-x86_64 linux-armv6l linux-armv7l linux-arm64 darwin-x86_64},
url: 'https://nodejs.org/dist/v%{version}/node-v%{version}-%{kernel}-%{machine}.tar.gz',
)
def self.provides_auto?(node, resource)
# Also work if we have a blank or numeric-y version. This should make
# it the default provider on supported platforms.
super || (resource.version.to_s =~ /^(\d|$)/ && static_machines.include?(static_machine_label(node)))
end
MACHINE_LABELS = {'i386' => 'x86', 'i686' => 'x86', 'x86_64' => 'x64'}
def static_url_variables
machine = node['kernel']['machine']
super.merge(machine: MACHINE_LABELS[machine] || machine)
end
def javascript_binary
::File.join(static_folder, 'bin', 'node')
end
private
def install_javascript
install_static
end
def uninstall_javascript
uninstall_static
end
end
end
end

View File

@@ -0,0 +1,53 @@
#
# Copyright 2015-2017, Noah Kantrowitz
#
# 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.
#
require 'chef/resource'
require 'poise_languages'
require 'poise_javascript/error'
require 'poise_javascript/javascript_providers/base'
module PoiseJavascript
module JavascriptProviders
class Scl < Base
include PoiseLanguages::Scl::Mixin
provides(:scl)
scl_package('4.4.2', 'rh-nodejs4', 'rh-nodejs4-nodejs-devel', '>= 7.0')
scl_package('0.10.35', 'nodejs010', 'nodejs010-nodejs-devel')
def javascript_binary
::File.join(scl_folder, 'root', 'usr', 'bin', 'node')
end
def javascript_environment
scl_environment
end
private
def install_javascript
install_scl_package
end
def uninstall_javascript
uninstall_scl_package
end
end
end
end

View File

@@ -0,0 +1,71 @@
#
# Copyright 2015-2017, Noah Kantrowitz
#
# 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.
#
require 'chef/resource'
require 'poise_languages'
require 'poise_javascript/error'
require 'poise_javascript/javascript_providers/base'
module PoiseJavascript
module JavascriptProviders
class System < Base
include PoiseLanguages::System::Mixin
provides(:system)
packages('nodejs', {
debian: {default: %w{nodejs}},
ubuntu: {default: %w{nodejs}},
# Empty arrays because no package in the base OS.
redhat: {default: %w{}},
centos: {default: %w{}},
fedora: {default: %w{nodejs}},
amazon: {default: %w{}},
})
def self.provides_auto?(node, resource)
# Don't auto on platforms I know have no system package by default. Kind
# of pointless since the nodejs provider will hit on these platforms
# anyway so this shouldn't ever happen.
super && !node.platform_family?('rhel') && !node.platform?('amazon')
end
def javascript_binary
# Debian and Ubuntu after 12.04 changed the binary name ಠ_ಠ.
binary_name = node.value_for_platform(debian: {default: 'nodejs'}, ubuntu: {'12.04' => 'node', default: 'nodejs'}, default: 'node')
::File.join('', 'usr', 'bin', binary_name)
end
private
def install_javascript
install_system_packages
package %w{npm nodejs-legacy} if node.platform_family?('debian')
end
def uninstall_javascript
uninstall_system_packages
package(%w{npm nodejs-legacy}) { action :purge } if node.platform_family?('debian')
end
def system_package_candidates(version)
# Boring :-(.
%w{nodejs nodejs-legacy node}
end
end
end
end