From 26302eff4d471af607c0a9a67ef3025f4a2542eb Mon Sep 17 00:00:00 2001 From: varac Date: Mon, 18 Apr 2016 16:42:13 +0200 Subject: initial Rakefile and Gemfile for tests --- Rakefile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Rakefile (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..5a3936f8 --- /dev/null +++ b/Rakefile @@ -0,0 +1,20 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' + +# redefine lint task with specific configuration +Rake::Task[:lint].clear +PuppetLint::RakeTask.new :lint do |config| + # Pattern of files to check, defaults to `**/*.pp` + config.pattern = ['puppet/modules/site_*/**/*.pp'] + #config.ignore_paths = ['puppet/modules/apache/**/*.pp'] + config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] + config.disable_checks = ['documentation', '80chars'] + config.fail_on_warnings = false +end + +# rake syntax::* tasks +PuppetSyntax.exclude_paths = ["**/vendor/**/*"] + +desc "Run all puppet checks required for CI" +task :test => [:lint, :syntax , :validate, :spec] -- cgit v1.2.3 From 97900133a2a7c3538ac20439fe0b7b9cff1357f1 Mon Sep 17 00:00:00 2001 From: varac Date: Mon, 18 Apr 2016 17:47:19 +0200 Subject: Only lint custom modules, not submodules --- Rakefile | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 5a3936f8..8f7a9686 100644 --- a/Rakefile +++ b/Rakefile @@ -2,13 +2,40 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' require 'puppet-syntax/tasks/puppet-syntax' +# return list of modules, either +# submodules or custom modules +# so we can check each array seperately +def modules_pattern (type) + submodules = Array.new + custom_modules = Array.new + + Dir['puppet/modules/*'].sort.each do |m| + system("grep -q #{m} .gitmodules") + if $?.exitstatus == 0 + submodules << m + '/**/*.pp' + else + custom_modules << m + '/**/*.pp' + end + end + + if type == 'submodule' + submodules + elsif type == 'custom' + custom_modules + else + end + +end + + + # redefine lint task with specific configuration Rake::Task[:lint].clear +desc "boo" PuppetLint::RakeTask.new :lint do |config| # Pattern of files to check, defaults to `**/*.pp` - config.pattern = ['puppet/modules/site_*/**/*.pp'] - #config.ignore_paths = ['puppet/modules/apache/**/*.pp'] - config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] + config.pattern = modules_pattern('custom') + config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"] config.disable_checks = ['documentation', '80chars'] config.fail_on_warnings = false end -- cgit v1.2.3