Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fixtures:
repositories:
stdlib: git://github.com/puppetlabs/puppetlabs-stdlib.git
symlinks:
java: "#{source_dir}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pkg/
.DS_Store
metadata.json
spec/fixtures
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source "http://rubygems.org"

if ENV.key?('PUPPET_VERSION')
puppetversion = "= #{ENV['PUPPET_VERSION']}"
else
puppetversion = ['~> 2.7']
end

gem "rake"
gem "puppet", puppetversion
gem "puppet-lint"
gem "rspec-puppet"
gem "puppetlabs_spec_helper"
37 changes: 37 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
GEM
remote: http://rubygems.org/
specs:
diff-lcs (1.2.2)
facter (1.6.18)
metaclass (0.0.1)
mocha (0.13.3)
metaclass (~> 0.0.1)
puppet (2.7.21)
facter (~> 1.5)
puppet-lint (0.3.2)
puppetlabs_spec_helper (0.4.1)
mocha (>= 0.10.5)
rake
rspec (>= 2.9.0)
rspec-puppet (>= 0.1.1)
rake (10.0.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.0)
rspec-puppet (0.1.6)
rspec

PLATFORMS
ruby

DEPENDENCIES
puppet (~> 2.7)
puppet-lint
puppetlabs_spec_helper
rake
rspec-puppet
17 changes: 8 additions & 9 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name 'puppetlabs-java'
version '0.2.0'
source 'git://github.com/puppetlabs/puppetlabs-java'
author 'puppetlabs'
license 'Apache'
summary 'Manage the official Java runtime'
description 'Manage the official Java runtime'
name 'puppetlabs-java'
version '0.2.0'
source 'git://github.com/puppetlabs/puppetlabs-java'
author 'puppetlabs'
license 'Apache'
summary 'Manage the official Java runtime'
description 'Manage the official Java runtime'
project_page 'https://github.com/puppetlabs/puppetlabs-java'

## Add dependencies, if any:
dependency 'puppetlabs/stdlib', '>= 0.1.6'
dependency 'puppetlabs/stdlib', '>= 0.1.6'
3 changes: 3 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Currently this simply deploys the package on Enterprise Linux based systems and
Tested on:

* Centos 5.6
* Centos 5.8
* Centos 6.3
* Ubuntu 10.04 Lucid
* Ubuntu 12.04 Precise

# RedHat Support #

Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'

PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
28 changes: 15 additions & 13 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#
# Sample Usage:
#
# [Remember: No empty lines between comments and class definition]
class java(
$distribution = 'jdk',
$version = 'present'
Expand All @@ -26,20 +25,23 @@

'RedHat': {

if ($operatingsystem == 'Fedora') {
class { 'java::package_redhat':
version => $version,
distribution => 'java',
require => Anchor['java::begin'],
before => Anchor['java::end'],
if ($::operatingsystem == 'Fedora') {
$distribution_redhat = 'java'
} elsif ($::operatingsystem == 'Centos') {
case $::operatingsystemrelease {
'5.8': { $distribution_redhat = 'java-1.7.0-openjdk' }
'6.3': { $distribution_redhat = 'java-1.7.0-openjdk' }
default: { $distribution_redhat = $distribution }
}
} else {
class { 'java::package_redhat':
version => $version,
distribution => $distribution,
require => Anchor['java::begin'],
before => Anchor['java::end'],
}
$distribution_redhat = $distribution
}

class { 'java::package_redhat':
version => $version,
distribution => $distribution_redhat,
require => Anchor['java::begin'],
before => Anchor['java::end'],
}

}
Expand Down
26 changes: 26 additions & 0 deletions spec/classes/java_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'spec_helper'

describe 'java', :type => :class do

context 'select openjdk for Centos 5.8' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} }
it { should contain_package('java').with_name('java-1.7.0-openjdk') }
end

context 'select openjdk for Centos 6.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} }
it { should contain_package('java').with_name('java-1.7.0-openjdk') }
end

context 'select default for Centos 5.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
it { should contain_package('java').with_name('jdk') }
end

context 'select passed value for Centos 5.3' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
let(:params) { { 'distribution' => 'java-1.6.0-openjdk' } }
it { should contain_package('java').with_name('java-1.6.0-openjdk') }
end

end
6 changes: 0 additions & 6 deletions spec/spec.opts

This file was deleted.

19 changes: 1 addition & 18 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1 @@
require 'pathname'
dir = Pathname.new(__FILE__).parent
$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')

require 'mocha'
require 'puppet'
gem 'rspec', '=1.2.9'
require 'spec/autorun'

Spec::Runner.configure do |config|
config.mock_with :mocha
end

# We need this because the RAL uses 'should' as a method. This
# allows us the same behaviour but with a different method name.
class Object
alias :must :should
end
require 'puppetlabs_spec_helper/module_spec_helper'