From edc5da08264fb221cfa6ead12c10f56ac96a8333 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Mon, 30 Sep 2013 17:17:36 -0700 Subject: [PATCH] Merge puppet-module_skel --- .fixtures.yml | 7 +++++++ .gitignore | 7 +++++++ .nodeset.yml | 11 ++++++++++ .travis.yml | 32 ++++++++++++++++++++++++++++ Gemfile | 23 +++++++++++++++++++++ LICENSE | 13 ++++++++++++ Modulefile | 10 +++++++++ README.md | 39 +++++++++++++++++++++++++++++++++++ Rakefile | 15 ++++++++++++++ manifests/init.pp | 11 ++++++++++ spec/classes/selenium_spec.rb | 9 ++++++++ spec/spec_helper.rb | 1 + spec/spec_helper_system.rb | 28 +++++++++++++++++++++++++ spec/system/selenium_spec.rb | 34 ++++++++++++++++++++++++++++++ 14 files changed, 240 insertions(+) create mode 100644 .fixtures.yml create mode 100644 .gitignore create mode 100644 .nodeset.yml create mode 100644 .travis.yml create mode 100644 Gemfile create mode 100644 LICENSE create mode 100644 Modulefile create mode 100644 README.md create mode 100644 Rakefile create mode 100644 spec/classes/selenium_spec.rb create mode 100644 spec/spec_helper.rb create mode 100644 spec/spec_helper_system.rb create mode 100644 spec/system/selenium_spec.rb diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..e65dbd8 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,7 @@ +fixtures: + repositories: + "stdlib": + repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git" + ref: "3.0.0" + symlinks: + "module_skel": "#{source_dir}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e64147 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +pkg/ +spec/fixtures/ +Gemfile.lock +*.orig +*.rej +*.patch +.rspec_system/ diff --git a/.nodeset.yml b/.nodeset.yml new file mode 100644 index 0000000..b802983 --- /dev/null +++ b/.nodeset.yml @@ -0,0 +1,11 @@ +--- +default_set: 'centos-64-x64' +sets: + 'centos-64-x64': + nodes: + 'main.vm': + prefab: 'centos-64-x64' + 'debian-607-x64': + nodes: + 'main.vm': + prefab: 'debian-607-x64' diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3790aa1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,32 @@ +language: ruby +rvm: + - 1.8.7 + - 1.9.3 + - 2.0.0 + - ruby-head +env: + - PUPPET_GEM_VERSION="~> 2.7.0" + - PUPPET_GEM_VERSION="~> 3.0.0" + - PUPPET_GEM_VERSION="~> 3.1.0" + - PUPPET_GEM_VERSION="~> 3.2.1" + - PUPPET_GEM_VERSION="~> 3.3.0" +matrix: + allow_failures: + - rvm: ruby-head + exclude: + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 2.7.0" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 2.7.0" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 3.0.0" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 3.1.0" + - rvm: ruby-head + env: PUPPET_GEM_VERSION="~> 2.7.0" + - rvm: ruby-head + env: PUPPET_GEM_VERSION="~> 3.0.0" + - rvm: ruby-head + env: PUPPET_GEM_VERSION="~> 3.1.0" +notifications: + email: false diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3fe7aa3 --- /dev/null +++ b/Gemfile @@ -0,0 +1,23 @@ +source 'https://rubygems.org' + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +group :development, :test do + gem 'rake' + gem 'puppetlabs_spec_helper' + gem 'puppet-lint' + gem 'puppet-syntax' +end + +group :system do + gem 'rspec-system' + gem 'rspec-system-puppet' + gem 'rspec-system-serverspec' + gem 'serverspec' +end + +# vim:ft=ruby diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7546c39 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright (C) 2012-2013 Joshua Hoblitt + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/Modulefile b/Modulefile new file mode 100644 index 0000000..4d0932b --- /dev/null +++ b/Modulefile @@ -0,0 +1,10 @@ +name 'jhoblitt-module_skel' +version '0.0.1' + +author 'Joshua Hoblitt ' +license 'Apache' +project_page 'https://github.com/jhoblitt/puppet-module_skel' +source 'https://github.com/jhoblitt/puppet-module_skel.git' +summary 'module skeleton' +description 'module skeleton' +dependency 'puppetlabs/stdlib', '>= 3.0.0' diff --git a/README.md b/README.md new file mode 100644 index 0000000..01b11ec --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +Puppet module_skel Module +========================= + +[![Build Status](https://travis-ci.org/jhoblitt/puppet-module_skel.png)](https://travis-ci.org/jhoblitt/puppet-module_skel) + +#### Table of Contents + +1. [Overview](#overview) +2. [Description](#description) +3. [Usage](#usage) +4. [Limitations](#limitations) + * [Tested Platforms](#tested-platforms) +5. [Support](#support) + + +Overview +-------- + + +Description +----------- + + +Usage +----- + + +Limitations +----------- + +### Tested Platforms + + +Support +------- + +Please log tickets and issues at +[github](https://github.com/jhoblitt/puppet-module_skel/issues) + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..29b1a33 --- /dev/null +++ b/Rakefile @@ -0,0 +1,15 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'rspec-system/rake_task' +require 'puppet-syntax/tasks/puppet-syntax' +require 'puppet-lint/tasks/puppet-lint' + +PuppetSyntax.exclude_paths = ["spec/fixtures/**/*"] +#PuppetLint.configuration.send("disable_class_inherits_from_params_class") +#PuppetLint.configuration.send("disable_variable_scope") +PuppetLint.configuration.ignore_paths = ['pkg/**/*.pp', 'spec/**/*.pp', 'tests/**/*.pp'] + +task :default => [ + :syntax, + :lint, + :spec, +] diff --git a/manifests/init.pp b/manifests/init.pp index e69de29..2cd8625 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -0,0 +1,11 @@ +# == Class: module_skel +# +# simple template +# +# === Examples +# +# include module_skel +# +class module_skel { + +} diff --git a/spec/classes/selenium_spec.rb b/spec/classes/selenium_spec.rb new file mode 100644 index 0000000..ba886c1 --- /dev/null +++ b/spec/classes/selenium_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe 'module_skel', :type => :class do + + describe 'for osfamily RedHat' do + it { should contain_class('module_skel') } + end + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..2c6f566 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/module_spec_helper' diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb new file mode 100644 index 0000000..a821492 --- /dev/null +++ b/spec/spec_helper_system.rb @@ -0,0 +1,28 @@ +require 'rspec-system/spec_helper' +require 'rspec-system-puppet/helpers' +require 'rspec-system-serverspec/helpers' + +include RSpecSystemPuppet::Helpers + +include Serverspec::Helper::RSpecSystem +include Serverspec::Helper::DetectOS + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Enable colour + c.tty = true + + c.include RSpecSystemPuppet::Helpers + + # This is where we 'setup' the nodes before running our tests + c.before :suite do + # Install puppet + puppet_install + + # Install modules and dependencies + puppet_module_install(:source => proj_root, :module_name => 'module_skel') + shell('puppet module install puppetlabs-stdlib') + end +end diff --git a/spec/system/selenium_spec.rb b/spec/system/selenium_spec.rb new file mode 100644 index 0000000..ad1918a --- /dev/null +++ b/spec/system/selenium_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper_system' + +describe 'module_skel class' do + case node.facts['osfamily'] + when 'RedHat', 'Debian' + package_name = 'module_skel' + service_name = 'module_skel' + end + + describe 'running puppet code' do + # Using puppet_apply as a helper + it 'should work with no errors' do + pp = <<-EOS + class { 'module_skel': } + EOS + + # Run it twice and test for idempotency + puppet_apply(pp) do |r| + r.exit_code.should_not == 1 + r.refresh + r.exit_code.should be_zero + end + end + end + + describe package(package_name) do + it { should be_installed } + end + + describe service(service_name) do + it { should be_running } + it { should be_enabled } + end +end