-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert test fixtures over to new style provided by PL - fixes #12
Test fixtures are now generated as per https://puppetlabs.com/blog/the-next-generation-of-puppet-module-testing/
- Loading branch information
Tray Torrance
committed
Jun 20, 2013
1 parent
c00d50d
commit b955693
Showing
8 changed files
with
17 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
fixtures: | ||
symlinks: | ||
cron: "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
source :rubygems | ||
source 'https://rubygems.org' | ||
|
||
gem 'puppet' | ||
puppet_version = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7'] | ||
|
||
gem 'rake' | ||
gem 'rspec' | ||
gem 'rspec-puppet' | ||
gem 'puppetlabs_spec_helper' | ||
gem 'puppet', puppet_version | ||
gem 'puppetlabs_spec_helper', '>= 0.1.0' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
language: ruby | ||
script: "rake spec" | ||
rvm: | ||
- 1.8.7 | ||
- 1.9.3 | ||
|
||
- 2.0.0 | ||
env: | ||
- PUPPET_VERSION=2.7.22 | ||
- PUPPET_VERSION=3.2.2 | ||
gemfile: .travis/Gemfile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,3 @@ | ||
require 'rake' | ||
require 'json' | ||
require 'fileutils' | ||
require 'rspec/core/rake_task' | ||
|
||
task :default => :spec | ||
|
||
RSpec::Core::RakeTask.new( :spec ) do |task| | ||
task.rspec_opts = %w[ --color --format doc ] | ||
task.pattern = 'spec/*/*_spec.rb' | ||
end | ||
|
||
task :build => [:spec, :clean] do | ||
`puppet module build` | ||
|
||
# TODO: Find a way to package without such a nasty hack | ||
pkg = Dir['pkg/*.tar.gz'].first | ||
pkg_dir = pkg.gsub('.tar.gz', '') | ||
name = pkg.match(%r{^pkg/(\w+-\w+)})[1] | ||
version = pkg.match(%r{\d\.\d\.\d})[0] | ||
|
||
# Blow away and re-create the module without specs | ||
# (Works around https://github.com/torrancew/puppet-cron/issues/12) | ||
FileUtils.rm_f pkg | ||
Dir["#{pkg_dir}/{Rakefile,spec}"].each { |f| FileUtils.rm_rf f } | ||
|
||
metadata = JSON.parse(File.read("#{pkg_dir}/metadata.json")) | ||
|
||
metadata["checksums"].delete_if do |key, value| | ||
key.match(%r{^(spec/|Rakefile)}) | ||
end | ||
|
||
File.open("#{pkg_dir}/metadata.json", 'w') { |f| f.write(JSON.dump(metadata)) } | ||
puts 'Building module' | ||
`tar cvzf #{pkg} -C pkg/ #{name}-#{version}/` | ||
end | ||
|
||
task :clean do | ||
puts 'Cleaning module builds' | ||
Dir['pkg/*'].each { |f| FileUtils.rm_rf f } | ||
end | ||
require 'rubygems' | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
|
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters