summaryrefslogtreecommitdiff
path: root/Rakefile
blob: 8f7a9686f9cb63fbe4ce46708d16e605b0cceba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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           = modules_pattern('custom')
  config.ignore_paths     = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.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]