Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
add download_base to specify download url of source tar.gz
Browse files Browse the repository at this point in the history
  • Loading branch information
dwerder committed Apr 5, 2016
1 parent 6dea873 commit 3fdbca0
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 28 deletions.
28 changes: 13 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
---
sudo: false
language: ruby
cache: bundler
bundler_args: --without system_tests
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
before_install: rm Gemfile.lock || true
script: bundle exec rake validate lint spec
matrix:
fast_finish: true
include:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.4.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.0"
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.6.0"
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- rvm: 2.1.6
env: PUPPET_GEM_VERSION='~> 4.0' COVERAGE=yes STRICT_VARIABLES=yes
- rvm: 2.1.6
env: PUPPET_GEM_VERSION='https://github.com/puppetlabs/puppet.git#stable
- rvm: 2.1.5
env: PUPPET_GEM_VERSION='~> 3.0' FUTURE_PARSER=yes
- rvm: 2.1.5
env: PUPPET_GEM_VERSION='~> 3.0'
- rvm: 1.9.3
env: PUPPET_GEM_VERSION='~> 3.0'
notifications:
email: false
30 changes: 22 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
source 'https://rubygems.org'
source ENV['GEM_SOURCE'] || "https://rubygems.org"

puppetversion = ENV.key?('PUPPET_GEM_VERSION') ? "#{ENV['PUPPET_GEM_VERSION']}" : ['>= 3.3']
facterversion = ENV.key?('FACTER_GEM_VERSION') ? "#{ENV['FACTER_GEM_VERSION']}" : ['>= 1.7']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', facterversion
gem 'rspec', '< 3.2.0'
def location_for(place, version = nil)
if place =~ /^((?:git|https?)[:@][^#]*)#(.*)/
[version, { :git => $1, :branch => $2, :require => false }].compact
elsif place =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
else
[place, version, { :require => false }].compact
end
end

gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'] || '~> 4')
gem 'facter', '>= 2.0'
gem 'puppetlabs_spec_helper', '>= 0.1.0', :require => false
gem 'puppet-lint', '>= 0.3.2', :require => false
gem 'rspec-puppet', '>= 2.3.2', :require => false
gem 'metadata-json-lint', :require => false
gem 'rake', '< 11.0.0' # rubi <1.9 versus rake 11.0.0 workaround

if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ the redis install package. Therefor, these values must be adjusted too.
Redis system group. Default: undef (string)
Default 'undef' results to 'root' as redis system group

#####`download_base`

Url where to find the source tar.gz.
Default value is 'http://download.redis.io/releases'

####Defined Type: `redis::server`

Used to configure redis instances. You can setup multiple redis servers on the
Expand Down
10 changes: 5 additions & 5 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# [*redis_group*]
# The redis system group. Default value is 'undef', which results to 'root' as system group.
#
# [*download_base*]
# Url where to find the source tar.gz. Default value is 'http://download.redis.io/releases'
#
class redis::install (
$redis_version = $::redis::params::redis_version,
$redis_build_dir = $::redis::params::redis_build_dir,
Expand All @@ -28,6 +31,7 @@
$download_tool = $::redis::params::download_tool,
$redis_user = $::redis::params::redis_user,
$redis_group = $::redis::params::redis_group,
$download_base = $::redis::params::download_base,
) inherits redis {
if ( $redis_package == true ) {
case $::operatingsystem {
Expand Down Expand Up @@ -90,11 +94,7 @@
ensure => directory,
}

if $redis_version == $::redis::params::redis_version {
$redis_download_url = 'http://download.redis.io/redis-stable.tar.gz'
} else {
$redis_download_url = "http://download.redis.io/releases/redis-${redis_version}.tar.gz"
}
$redis_download_url = "${download_base}/redis-${redis_version}.tar.gz"

exec { "Download and untar redis ${redis_version}":
require => File[$redis_build_dir],
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
$download_tool = 'curl -s -L'
$redis_user = undef
$redis_group = undef
$download_base = 'http://download.redis.io/releases'
}
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
if ENV['COVERAGE'] == 'yes'
RSpec.configure do |c|
c.after(:suite) do
RSpec::Puppet::Coverage.report!
end
end
end

require 'puppetlabs_spec_helper/module_spec_helper'

0 comments on commit 3fdbca0

Please sign in to comment.