Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer #656

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
8 changes: 6 additions & 2 deletions data/default.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---

lookup_options:
php::fpm::pools:
merge: first

php::composer::channel_sources:
stable: 'https://getcomposer.org/download/latest-stable/composer.phar'
preview: 'https://getcomposer.org/download/latest-preview/composer.phar'
snapshot: 'https://getcomposer.org/composer.phar'
1: 'https://getcomposer.org/download/latest-1.x/composer.phar'
2: 'https://getcomposer.org/download/latest-2.x/composer.phar'
9 changes: 4 additions & 5 deletions manifests/composer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# === Parameters
#
# [*source*]
# Holds URL to the Composer source file
# [*channel_sources*]
# Define channel URLs to the Composer source file
#
# [*path*]
# Holds path to the Composer executable
Expand All @@ -27,7 +27,7 @@
# UNIX group of the root user
#
class php::composer (
String $source = $php::params::composer_source,
Hash $channel_sources = {},
Stdlib::Absolutepath $path = $php::params::composer_path,
Optional[String[1]] $proxy_type = undef,
Optional[String[1]] $proxy_server = undef,
Expand All @@ -40,7 +40,7 @@

archive { 'download composer':
path => $path,
source => $source,
source => $channel_sources.dig($channel),
proxy_type => $proxy_type,
proxy_server => $proxy_server,
}
Expand All @@ -53,7 +53,6 @@
if $auto_update {
class { 'php::composer::auto_update':
max_age => $max_age,
source => $source,
path => $path,
channel => $channel,
proxy_type => $proxy_type,
Expand Down
4 changes: 0 additions & 4 deletions manifests/composer/auto_update.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
# [*max_age*]
# Defines number of days after which Composer should be updated
#
# [*source*]
# Holds URL to the Composer source file
#
# [*path*]
# Holds path to the Composer executable
#
Expand All @@ -30,7 +27,6 @@
#
class php::composer::auto_update (
Integer[1] $max_age,
String[1] $source,
Stdlib::Absolutepath $path,
Php::ComposerChannel $channel = 'stable',
Optional[String[1]] $proxy_type = undef,
Expand Down
1 change: 0 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
$ensure = 'present'
$fpm_service_enable = true
$fpm_service_ensure = 'running'
$composer_source = 'https://getcomposer.org/composer.phar'
$composer_path = '/usr/local/bin/composer'
$composer_max_age = 30
$pear_ensure = 'present'
Expand Down
22 changes: 22 additions & 0 deletions spec/classes/php_composer_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'php::composer', type: :class do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
let(:pre_condition) { 'class {"php": composer => false}' }

describe 'works without params' do
it { is_expected.to compile.with_all_deps }
end

describe 'when called with no parameters' do
it { is_expected.to contain_file('/usr/local/bin/composer') }
end
end
end
end
Loading