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

Feature 20 #77

Open
wants to merge 11 commits into
base: feature-20
Choose a base branch
from
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ notifications:
branches:
only:
- master
- feature-20
- /^release.*$/
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v2.0.0
======
Supports clear-cache, install, update, run-scripts and dump-autoload.
Require and global require are now supported.

v1.2.1
======
f44b7e5 Now also supports Amazon Linux (RedHat)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ composer::exec { 'silex-update':
lock => false, # Only updates the lock file hash to suppress warning about the lock file being out of date.
global => false, # The global command allows you to run other commands like install, require or update as if you were running them from the COMPOSER_HOME directory.
working_dir => undef, # If specified, use the given directory as working directory.
format => undef, # Format of the output: text or json (default: "text"). Only applies to `cache-clear`.
format => undef, # Format of the output: text or json (default: "text"). Only applies to `clear-cache`.
onlyif => undef, # If true.
unless => undef, # If true.
}
Expand Down
10 changes: 5 additions & 5 deletions manifests/exec.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@
'update',
'require',
'run-scripts',
'cache-clear'
'clear-cache'
]

if member($exec_cmds, $cmd) == false {
fail(
"Only types 'install', 'update', 'cache-clear', 'run-scripts' and 'require' are allowed, ${cmd} given"
"Only types 'install', 'update', 'clear-cache', 'run-scripts' and 'require' are allowed, ${cmd} given"
)
}

if $prefer_source and $prefer_dist {
fail('Only one of \$prefer_source or \$prefer_dist can be true.')
}

# Validate format for cache-clear command
# Validate format for clear-cache command
if $format {
if $cmd != 'cache-clear' {
fail('Format only applies when \$cmd is set to `cache-clear`.')
if $cmd != 'clear-cache' {
fail('Format only applies when \$cmd is set to `clear-cache`.')
}
elsif $format != 'text' and $format != 'json' {
fail('Invalid format specified. Use \'text\' or \'json\'.')
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tPl0ch-composer",
"version": "1.3.5",
"version": "2.0.0",
"author": "tPl0ch - Thomas Ploch <profiploch@gmail.com>",
"summary": "This module provides the 'Composer' PHP dependency manager.",
"license": "MIT",
Expand Down
23 changes: 23 additions & 0 deletions spec/defines/composer_exec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,29 @@
})
}
end

context 'using clear-cache command' do
it { should contain_class('git') }
it { should contain_class('stdlib') }
it { should contain_class('composer') }

let(:title) { 'yourpr0ject' }
let(:params) { {
:cmd => 'clear-cache',
:cwd => '/just/in/time',
:logoutput => true,
:unless => '/just/in/time/bin/entry --version | grep 2\.0\.6',
} }

it {
should contain_exec('composer_clear_cache').without_user.without_timeout.with({
:command => %r{php /usr/local/bin/composer clear-cache --no-plugins --no-scripts --no-interaction},
:cwd => '/just/in/time',
:logoutput => true,
:unless => '/just/in/time/bin/entry --version | grep 2\.0\.6',
})
}
end
end
end

Expand Down
3 changes: 1 addition & 2 deletions templates/clear-cache.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<%= @command -%>
<% unless @dev %> --no-dev<% end -%>
<% if @format %> --format=<%= @format%><%end -%>
<%- end -%>
<% if @format %> --format=<%= @format%><%end -%>