Skip to content

Commit

Permalink
Merge pull request #82 from detjensrobert/dependency-cleanup
Browse files Browse the repository at this point in the history
Dependency Cleanup
  • Loading branch information
djoos authored Mar 8, 2022
2 parents ea4d25f + 1c6331e commit b64f8fd
Show file tree
Hide file tree
Showing 16 changed files with 223 additions and 119 deletions.
4 changes: 4 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
source 'https://supermarket.chef.io'

metadata

group :integration do
cookbook 'php'
end
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

This file is used to list changes made in each version (>= 2.4.0) of the composer cookbook.

## Unreleased

- Remove unneeded dependencies on `apt` / `windows` cookbooks for resources now in core Chef
- Adds testing on Alma / Rocky Linux 8

### Breaking

- Remove dependency on `php` cookbook
- ⚠ This cookbook will no longer install PHP for you!
- Use e.g. the `php` cookbook directly to install PHP before including these recipes

## 2.8.0 (2021-12-15)

- Chef 17 compatibility: enable `unified_mode` for custom resources
Expand Down
204 changes: 108 additions & 96 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Contributions to this cookbook will only be accepted if all tests pass successfu

Install the latest stable version of [ChefDK](https://downloads.chef.io/chef-dk/). You'll need [Vagrant](http://www.vagrantup.com/downloads.html) and [VirtualBox](https://www.virtualbox.org/wiki/Downloads) for running integration tests.

## Running tests
## Running tests

### Style checks

Expand All @@ -16,10 +16,10 @@ Install the latest stable version of [ChefDK](https://downloads.chef.io/chef-dk/

`chef exec rake unit`

## Integration tests
## Integration tests

`chef exec rake integration`

## All checks/tests
## All checks/tests

`chef exec rake`
5 changes: 1 addition & 4 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
# Cookbook:: composer
# Attributes:: default
#
# Copyright:: 2016-2021, David Joos
# Copyright:: 2016-2022, David Joos
#

include_attribute 'php'

if platform?('windows')
default['composer']['url'] = 'https://getcomposer.org/Composer-Setup.exe'
default['composer']['install_dir'] = 'C:\\ProgramData\\ComposerSetup'
Expand All @@ -26,5 +24,4 @@

default['composer']['global_configs'] = {}
default['composer']['home_dir'] = nil
default['composer']['php_recipe'] = 'php::default'
default['composer']['self_update_channel'] = nil
72 changes: 72 additions & 0 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
driver:
name: dokken
privileged: true
chef_version: <%= ENV['CHEF_VERSION'] || 'current' %>
chef_license: accept-no-persist
cap_add:
- SYS_PTRACE
- SYS_ADMIN

transport:
name: dokken

provisioner:
name: dokken

platforms:
- name: almalinux-8
driver:
image: dokken/almalinux-8
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pid_one_command: /usr/lib/systemd/systemd

- name: centos-7
driver:
image: dokken/centos-7
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pid_one_command: /usr/lib/systemd/systemd

- name: centos-stream-8
driver:
image: dokken/centos-stream-8
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pid_one_command: /usr/lib/systemd/systemd

- name: debian-10
driver:
image: dokken/debian-10
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pid_one_command: /bin/systemd

- name: debian-11
driver:
image: dokken/debian-11
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pid_one_command: /bin/systemd

- name: rockylinux-8
driver:
image: dokken/rockylinux-8
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pid_one_command: /usr/lib/systemd/systemd

- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pid_one_command: /bin/systemd

- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
pid_one_command: /bin/systemd
8 changes: 6 additions & 2 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ driver:
name: vagrant

provisioner:
name: chef_zero
name: chef_infra
product_name: chef
chef_license: accept-no-persist
enforce_idempotency: true
Expand All @@ -14,15 +14,19 @@ verifier:
name: inspec

platforms:
- name: almalinux-8
- name: centos_stream-8
- name: centos-7
- name: centos-8
- name: debian-10
- name: debian-11
- name: rockylinux-8
- name: ubuntu-18.04
- name: ubuntu-20.04

suites:
- name: default
run_list:
- recipe[php::default]
- recipe[composer::default]
attributes:
composer:
Expand Down
6 changes: 1 addition & 5 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
version '2.8.0'
chef_version '>= 15.3'

%w(debian ubuntu redhat centos fedora scientific amazon windows).each do |os|
%w(debian ubuntu redhat centos centos_stream fedora scientific amazon windows).each do |os|
supports os
end

source_url 'https://github.com/djoos-cookbooks/composer'
issues_url 'https://github.com/djoos-cookbooks/composer/issues'

depends 'apt'
depends 'php'
depends 'windows'
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Cookbook:: composer
# Recipe:: default
#
# Copyright:: 2016-2021, David Joos
# Copyright:: 2016-2022, David Joos
#

include_recipe 'composer::install'
Expand Down
2 changes: 1 addition & 1 deletion recipes/global_configs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Cookbook:: composer
# Recipe:: global_configs
#
# Copyright:: 2016-2021, David Joos
# Copyright:: 2016-2022, David Joos
#

configs = node['composer']['global_configs']
Expand Down
11 changes: 7 additions & 4 deletions recipes/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
# Cookbook:: composer
# Recipe:: install
#
# Copyright:: 2016-2021, David Joos
# Copyright:: 2016-2022, David Joos
#

include_recipe node['composer']['php_recipe']
log 'php check' do
level :fatal
message 'PHP is not installed. Please install PHP before including this recipe (e.g. with the `php` cookbook)'
not_if 'php --version'
end

if platform?('windows')
windows_package 'Composer - PHP Dependency Manager' do
Expand All @@ -30,7 +34,6 @@
remote_file file do
source node['composer']['url']
mode node['composer']['mask']
action :create
not_if { ::File.exist?(file) }
action :create_if_missing
end
end
2 changes: 1 addition & 1 deletion recipes/self_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Cookbook:: composer
# Recipe:: self_update
#
# Copyright:: 2016-2021, David Joos
# Copyright:: 2016-2022, David Joos
#

include_recipe 'composer::install'
Expand Down
2 changes: 1 addition & 1 deletion resources/install_global.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Cookbook:: composer
# Resource:: install_global
#
# Copyright:: 2012-2021, Escape Studios
# Copyright:: 2012-2022, Escape Studios
#

unified_mode true
Expand Down
2 changes: 1 addition & 1 deletion resources/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Cookbook:: composer
# Resource:: project
#
# Copyright:: 2016-2021, David Joos
# Copyright:: 2016-2022, David Joos
#

unified_mode true
Expand Down
1 change: 1 addition & 0 deletions spec/unit/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
platform 'ubuntu'

before do
stub_command('php --version')
stub_command("php -m | grep 'Phar'").and_return(true)
end

Expand Down
4 changes: 4 additions & 0 deletions test/integration/default/inspec/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
it { should exist }
its('mode') { should cmp '0755' }
end

describe command('composer --version') do
its('stdout') { should match /Composer version/ }
end

0 comments on commit b64f8fd

Please sign in to comment.