Skip to content

Instantly share code, notes, and snippets.

@mgagne
Created November 14, 2014 19:29
Show Gist options
  • Save mgagne/f6e60b438d4d77fe3837 to your computer and use it in GitHub Desktop.
Save mgagne/f6e60b438d4d77fe3837 to your computer and use it in GitHub Desktop.
Using librarian-puppet-simple to read Puppetfile for your rspec-puppet fixtures
# Don't forget to add librarian-puppet-simple to your Gemfile
# From git
gem 'librarian-puppet-simple',
:git => 'git://github.com/bodepd/librarian-puppet-simple.git'
# From rubygems
gem 'librarian-puppet-simple', '~> 0.0.3'
require 'puppetlabs_spec_helper/rake_tasks'
Rake::Task[:spec_prep].clear
desc "Create the fixtures directory"
task :spec_prep do
FileUtils::mkdir_p("spec/fixtures/modules")
FileUtils::mkdir_p("spec/fixtures/manifests")
FileUtils::touch("spec/fixtures/manifests/site.pp")
sh "librarian-puppet install --path=spec/fixtures/modules"
end
Rake::Task[:spec_clean].clear
desc "Clean up the fixtures directory"
task :spec_clean do
sh "librarian-puppet clean --path=spec/fixtures/modules"
if File.zero?("spec/fixtures/manifests/site.pp")
FileUtils::rm_f("spec/fixtures/manifests/site.pp")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment