Skip to content

Commit

Permalink
Add rake tasks for validation and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoneycutt committed Feb 1, 2014
1 parent e3bef50 commit 9f959da
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ env:
- PUPPET_VERSION=3.0.0
notifications:
email: false
gemfile: .gemfile
gemfile: Gemfile
6 changes: 4 additions & 2 deletions .gemfile → Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
source :rubygems
source "https://rubygems.org"

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0', "< 1.8.0"
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Run puppet in noop mode and check for syntax errors."
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
require 'rubygems'
require 'puppetlabs_spec_helper/module_spec_helper'

0 comments on commit 9f959da

Please sign in to comment.