-
Notifications
You must be signed in to change notification settings - Fork 84
/
Rakefile
48 lines (38 loc) · 1.17 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
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'rspec/core/rake_task'
require 'puppetlabs_spec_helper/tasks/fixtures'
begin
require 'puppet_litmus/rake_tasks'
rescue LoadError
# Gem not present
end
RSpec::Core::RakeTask.new(:spec) do |t|
t.exclude_pattern = "spec/acceptance/**/*.rb"
end
namespace :spec do
desc 'Run RSpec code examples with coverage collection'
task :coverage do
ENV['COVERAGE'] = 'yes'
Rake::Task['spec'].execute
end
end
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = "spec/unit/**/*.rb"
end
task :spec => :spec_clean
task :acceptance => :spec_prep
# Add our own tasks
require 'puppet-strings/tasks'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = %w(acceptance/**/*.pp spec/**/*.pp pkg/**/*.pp)
desc 'Validate Ruby source files and ERB templates.'
task :validate do
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless /spec\/fixtures/.match?(ruby_file)
end
Dir['lib/puppet-strings/yard/templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end