Skip to content

Commit

Permalink
Migrate to spec helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
nanliu committed Aug 22, 2012
1 parent 93b9544 commit f0a07a1
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 130 deletions.
5 changes: 5 additions & 0 deletions .fixtures.yml
@@ -0,0 +1,5 @@
fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
symlinks:
"staging": "#{source_dir}"
5 changes: 5 additions & 0 deletions .gemfile
@@ -0,0 +1,5 @@
source :rubygems

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
18 changes: 5 additions & 13 deletions .travis.yml
@@ -1,24 +1,16 @@
language: ruby
rvm:
- 1.8.7
- 1.9.2
- ree
before_script:
- 'git clone git://github.com/puppetlabs/hiera-puppet.git spec/fixtures/modules/hiera-puppet'
- 'mkdir /home/vagrant/.puppet'
- 'cp spec/fixtures/hiera.yaml /home/vagrant/.puppet/hiera.yaml'
after_script:
- 'rm /home/vagrant/.puppet/hiera.yaml'
- 'rmdir /home/vagrant/.puppet'
script: "rake spec"
branches:
only:
- master
env:
- PUPPET_VERSION=2.6.12
- PUPPET_VERSION=2.7.13
- PUPPET_VERSION=2.7.6
- PUPPET_VERSION=2.7.9
matrix:
exclude:
- rvm: 1.9.2
env: PUPPET_VERSION=2.6.12
- PUPPET_VERSION=2.6.9
notifications:
email: false
gemfile: .gemfile
13 changes: 0 additions & 13 deletions Gemfile

This file was deleted.

4 changes: 2 additions & 2 deletions Modulefile
@@ -1,7 +1,7 @@
name 'puppet-staging'
version '0.1.0'
version '0.2.0'
source 'git@github.com:nanliu/puppet-staging.git'
author 'puppetlabs'
author 'nanliu'
license 'Apache License Version 2.0'
summary 'File Staging'
description 'Manages file staging.'
Expand Down
36 changes: 4 additions & 32 deletions README.md
@@ -1,9 +1,11 @@
# puppet-staging
# Staging module for Puppet

Puppet management of staging directory, along with retrieval/extraction of staging files.
Manages staging directory, along with download/extraction of compressed files.

[![Build Status](https://secure.travis-ci.org/nanliu/puppet-staging.png?branch=master)](http://travis-ci.org/nanliu/puppet-staging)

WARNING: Version 0.2.0 no longer uses hiera functions. The same behavior should be available in Puppet 3.0.

## Usage

Specify a different default staging path (must be declared before using resource):
Expand Down Expand Up @@ -43,33 +45,3 @@ Staging files currently support the following source:
* puppet://
* ftp://
* local (though this doesn't serve any real purpose.)

I'm considering support for additional protocols such as rsync and git.

## Requirement

This module no longer requires hiera on the puppet master.

(no changes to puppet agent) with puppet backend and data as the datasource (default setting):

---
:backend: - puppet

:puppet:
:datasource: data

If you don't have hiera in your environment either module with the appropriate manifests will deploy hiera on the puppet master:

* [puppet-hiera](https://github.com/nanliu/puppet-hiera)

class { 'hiera':
confdir => '/etc/puppet',
modulepath => '/etc/puppet/modules',
}

* [puppetlabs-puppet](https://github.com/puppetlabs/puppetlabs-puppet)

class { 'puppet::hiera':
confdir => '/etc/puppet',
modulepath => '/etc/puppet/modules',
}
54 changes: 1 addition & 53 deletions Rakefile
@@ -1,54 +1,2 @@
require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'

task :default do
system("rake -T")
end

task :specs => [:spec]

desc "Run all rspec-puppet tests"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ['--color']
# ignores fixtures directory.
t.pattern = 'spec/{classes,defines,unit}/**/*_spec.rb'
end

desc "Build puppet module package"
task :build do
# This will be deprecated once puppet-module is a face.
begin
Gem::Specification.find_by_name('puppet-module')
rescue Gem::LoadError, NoMethodError
require 'puppet/face'
pmod = Puppet::Face['module', :current]
pmod.build('./')
end
end

desc "Check puppet manifests with puppet-lint"
task :lint do
# This requires pull request: https://github.com/rodjek/puppet-lint/pull/81
system("puppet-lint manifests")
system("puppet-lint tests")
end

desc "Testing in virtual system."
task :vm do
require 'vagrant'
env = Vagrant::Environment.new
puts "Bringing up vagrant environment"
env.cli("up")
end

desc "Unit test in virtual system."
task :vm_test do
require 'facter'
unless Facter.value('virtual')
Dir.chdir('tests')
Dir.glob('**/*.pp').each do |f|
system("puppet apply -v #{f}")
end
end
end
require 'puppetlabs_spec_helper/rake_tasks'
Empty file removed spec/fixtures/manifests/site.pp
Empty file.
1 change: 0 additions & 1 deletion spec/fixtures/modules/staging

This file was deleted.

18 changes: 2 additions & 16 deletions spec/spec_helper.rb
@@ -1,16 +1,2 @@
require 'puppet'
require 'rspec'
require 'rspec-puppet'

def param_value(subject, type, title, param)
subject.resource(type, title).send(:parameters)[param.to_sym]
end

RSpec.configure do |c|
c.module_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/modules'))
# Using an empty site.pp file to avoid: https://github.com/rodjek/rspec-puppet/issues/15
c.manifest_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/manifests'))
# Use fixtures for config file mainly to support using our own hiera.yaml settings.
# Pending: https://github.com/rodjek/rspec-puppet/pull/21
# c.config = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/puppet.conf'))
end
require 'rubygems'
require 'puppetlabs_spec_helper/module_spec_helper'

0 comments on commit f0a07a1

Please sign in to comment.