forked from joshbeard/puppet-bamboo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
80 lines (64 loc) · 1.97 KB
/
Rakefile
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet-lint/tasks/puppet-lint'
repo_dir = File.dirname(__FILE__)
ignore_paths = [
'pkg/**/*.pp',
'spec/**/*.pp',
'tests/**/*.pp',
]
Rake::Task[:lint].clear
PuppetLint::RakeTask.new :lint do |config|
# Pattern of files to ignore
config.ignore_paths = ignore_paths
# List of checks to disable
config.disable_checks = [
'80chars',
'class_inherits_from_params_class',
'documentation',
]
# Should the task fail if there were any warnings, defaults to false
config.fail_on_warnings = true
# Print out the context for the problem, defaults to false
config.with_context = true
# Format string for puppet-lint's output (see the puppet-lint help output
# for details
config.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
# Compare module layout relative to the module root
# config.relative = true
end
PuppetSyntax.exclude_paths = ignore_paths
task :default => [
:syntax,
:lint,
:spec,
]
desc "Populate CONTRIBUTORS file"
task :contributors do
system("git log --format='%aN, %aE' | sort -u > CONTRIBUTORS")
end
namespace :init do
task :bundler do
puts "=> Running 'bundle install'"
sh("bundle", "install")
end
task :hooks do
puts "=> Copying git hooks to ./.git/hooks/"
sh("cp -rf #{repo_dir}/.githooks/* #{repo_dir}/.git/hooks")
end
end
task :init do
Rake::Task['init:bundler'].invoke
Rake::Task['init:hooks'].invoke
puts
puts "======================================================================"
puts "Repo initialized"
puts
puts "You should now have a development environment setup."
puts "Execute 'rake -T' to see the available rake tasks."
puts " For example: rake syntax"
puts
puts "pre-commit hooks for Git were also initialized. Whenever you commit,"
puts "your changes will be validated against puppet syntax, puppet-lint,"
puts "and Ruby validation (erb, yaml, json)."
end