Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
fixtures:
symlinks:
archive: "#{source_dir}"
10 changes: 0 additions & 10 deletions .gemfile

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/metadata.json
/.project
/.gemfile.lock
/.bundle/config
/pkg/*
/Gemfile.lock
1 change: 0 additions & 1 deletion .puppet-lint.rc

This file was deleted.

28 changes: 15 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
language: ruby
script: "rake spec lint"
rvm:
- 1.9.2
- 1.9.3
- 2.0.0
env:
- PUPPET_VERSION="~> 2.7.0"
- PUPPET_VERSION="~> 3.2.0"
- PUPPET_VERSION="~> 3.4.0"
bundler_args: --without development
script: "bundle exec rake validate lint spec SPEC_OPTS='--format documentation' && bundle exec rake smoke"
matrix:
exclude:
- rvm: 2.0.0
env: PUPPET_VERSION="~> 2.7.0"
gemfile: .gemfile
fast_finish: true
include:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 2.7"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 3.7"
notifications:
email: false

27 changes: 27 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"

group :development, :test do
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', '0.3.2', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'pry', :require => false
gem 'simplecov', :require => false
end

if facterversion = ENV['FACTER_GEM_VERSION']
gem 'facter', facterversion, :require => false
else
gem 'facter', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end

# vim:ft=ruby
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'gini-archive'
version '0.2.0'
version '0.2.2'
author 'Jochen Schalanda'
license 'Apache 2.0'
project_page 'https://github.com/gini/puppet-archive'
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Supported Platforms
The module has been tested on the following operating systems. Testing and patches for other platforms are welcome.

* Debian Linux 7.0 (Wheezy)
* Ubuntu 13.04
* RHEL 6.x
* Oracle Linux 6.x


Support
Expand Down Expand Up @@ -61,3 +64,4 @@ Contributors
* Zijad Purkovic (zajk)
* Martin Konrad (mark0n)
* Brendan Murtagh (bmurt)
* Krzysztof Suszyński (cardil)
15 changes: 12 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
require 'rake'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'

PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.fail_on_warnings
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_class_parameter_defaults')
PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

task :default => [:spec, :lint]
task :smoke do
Rake::Task[:spec_prep].invoke
sh "puppet apply tests/init.pp --noop --modulepath spec/fixtures/modules"
Rake::Task[:spec_clean].invoke
end
9 changes: 8 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
$dependency_class = Class['archive::prerequisites'],
$exec_path = ['/usr/local/bin', '/usr/bin', '/bin']) {

if $dependency_class == Class['archive::prerequisites'] {
include archive::prerequisites
}

archive::download {"${name}.${extension}":
ensure => $ensure,
url => $url,
Expand Down Expand Up @@ -86,6 +90,9 @@
timeout => $timeout,
strip_components => $strip_components,
exec_path => $exec_path,
require => Archive::Download["${name}.${extension}"]
require => [
Archive::Download["${name}.${extension}"],
$dependency_class
],
}
}
3 changes: 0 additions & 3 deletions spec/classes/archive_spec.rb

This file was deleted.

6 changes: 6 additions & 0 deletions spec/spec.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
--format
s
--colour
--loadby
mtime
--backtrace
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
require 'rubygems'
require 'puppetlabs_spec_helper/module_spec_helper'
59 changes: 59 additions & 0 deletions spec/unit/defines/archive_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
require 'spec_helper'
require 'rspec-puppet'

describe 'archive', :type => :define do
context 'with filetype => zip' do
let(:title) { 'apache-tomcat-8.0.11' }
let(:params) { {
:ensure => 'present',
:url => 'http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.zip',
:extension => 'zip',
:username => 'example',
:password => 'example',
:target => '/opt',
} }
it { should compile }
it { should compile.with_all_deps }
it { should contain_class('archive::prerequisites') }
it { should contain_archive__download('apache-tomcat-8.0.11.zip') }
it { should contain_archive__extract('apache-tomcat-8.0.11') }
it { should contain_exec('download digest of archive apache-tomcat-8.0.11.zip') }
it {
should contain_exec('download archive apache-tomcat-8.0.11.zip and check sum').with_command(
'curl --user example:example -s -L -o /usr/src/apache-tomcat-8.0.11.zip ' +
'http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.zip'
)
}
it {
should contain_exec('Unpack apache-tomcat-8.0.11').with_command(
'mkdir -p /opt/apache-tomcat-8.0.11 && unzip -o /usr/src/apache-tomcat-8.0.11.zip -d /opt/apache-tomcat-8.0.11'
)
}
end
context 'with filetype => tarball' do
let(:title) { 'apache-tomcat-8.0.11' }
let(:params) { {
:ensure => 'present',
:url => 'http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz',
:target => '/usr/src',
} }
it { should compile }
it { should compile.with_all_deps }
it { should contain_class('archive::prerequisites') }
it { should contain_archive__download('apache-tomcat-8.0.11.tar.gz') }
it { should contain_archive__extract('apache-tomcat-8.0.11') }
it { should contain_exec('download digest of archive apache-tomcat-8.0.11.tar.gz') }
it {
should contain_exec('download archive apache-tomcat-8.0.11.tar.gz and check sum').with_command(
'curl -s -L -o /usr/src/apache-tomcat-8.0.11.tar.gz ' +
'http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.tar.gz'
)
}
it {
should contain_exec('Unpack apache-tomcat-8.0.11').with_command(
'mkdir -p /usr/src/apache-tomcat-8.0.11 && tar --no-same-owner --no-same-permissions ' +
'--strip-components=0 -xzf /usr/src/apache-tomcat-8.0.11.tar.gz -C /usr/src/apache-tomcat-8.0.11'
)
}
end
end
15 changes: 15 additions & 0 deletions tests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
archive { 'apache-tomcat-6.0.26':
ensure => present,
url => 'http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz',
target => '/opt',
}

archive { 'apache-tomcat-8.0.11':
ensure => present,
url => 'http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.11/bin/apache-tomcat-8.0.11.zip',
extension => 'zip',
username => 'example',
password => 'example',
target => '/opt',
}