summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-05-18 13:39:56 +0200
committervarac <varacanero@zeromail.org>2016-05-18 13:39:56 +0200
commitc046daea6d31e929eee45e47762240b800554d2f (patch)
treed83f557d027030021329b4f40150757948cb2c97 /Rakefile
parent22286f450bef6a28a08f5ff527e3a4f040fab4c3 (diff)
parent3e63ce3c71620433dc135959b2743aa010b28fe1 (diff)
Merge branch 'tests' into develop
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile42
1 files changed, 26 insertions, 16 deletions
diff --git a/Rakefile b/Rakefile
index 8f7a9686..0d1b18ad 100644
--- a/Rakefile
+++ b/Rakefile
@@ -3,11 +3,12 @@ require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
# return list of modules, either
-# submodules or custom modules
+# submodules, custom or all modules
# so we can check each array seperately
def modules_pattern (type)
submodules = Array.new
custom_modules = Array.new
+ all_modules = Array.new
Dir['puppet/modules/*'].sort.each do |m|
system("grep -q #{m} .gitmodules")
@@ -16,32 +17,41 @@ def modules_pattern (type)
else
custom_modules << m + '/**/*.pp'
end
+ all_modules << m + '/**/*.pp'
end
- if type == 'submodule'
- submodules
- elsif type == 'custom'
- custom_modules
- else
+ case type
+ when 'submodule'
+ submodules
+ when 'custom'
+ custom_modules
+ when 'all'
+ all_modules
end
-
end
+exclude_paths = ["**/vendor/**/*", "spec/fixtures/**/*", "pkg/**/*" ]
-
-# redefine lint task with specific configuration
+# redefine lint task so we don't lint submoudules for now
Rake::Task[:lint].clear
-desc "boo"
PuppetLint::RakeTask.new :lint do |config|
- # Pattern of files to check, defaults to `**/*.pp`
- config.pattern = modules_pattern('custom')
- config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"]
+ # only check for custom manifests, not submodules for now
+ config.pattern = modules_pattern('custom')
+ config.ignore_paths = exclude_paths
config.disable_checks = ['documentation', '80chars']
config.fail_on_warnings = false
end
# rake syntax::* tasks
-PuppetSyntax.exclude_paths = ["**/vendor/**/*"]
+PuppetSyntax.exclude_paths = exclude_paths
+PuppetSyntax.future_parser = true
+
+desc "Validate erb templates"
+task :templates do
+ Dir['**/templates/**/*.erb'].each do |template|
+ sh "erb -P -x -T '-' #{template} | ruby -c" unless template =~ /.*vendor.*/
+ end
+end
-desc "Run all puppet checks required for CI"
-task :test => [:lint, :syntax , :validate, :spec]
+desc "Run all puppet checks required for CI (syntax , validate, spec, lint)"
+task :test => [:syntax , :validate, :templates, :spec, :lint]