2018-06-26 07:29:46 +00:00
|
|
|
require 'bundler/gem_tasks'
|
2018-06-26 16:06:26 +00:00
|
|
|
#require 'puppetlabs_spec_helper/rake_tasks'
|
2014-05-16 04:08:35 +00:00
|
|
|
require 'puppet-lint/tasks/puppet-lint'
|
2016-09-11 21:46:57 +00:00
|
|
|
|
|
|
|
# Add our own tasks
|
|
|
|
require 'puppet-strings/tasks'
|
|
|
|
|
2014-05-16 04:08:35 +00:00
|
|
|
PuppetLint.configuration.send('disable_80chars')
|
2016-09-14 19:20:26 +00:00
|
|
|
PuppetLint.configuration.ignore_paths = %w(acceptance/**/*.pp spec/**/*.pp pkg/**/*.pp)
|
2014-05-16 04:08:35 +00:00
|
|
|
|
2016-09-14 19:20:26 +00:00
|
|
|
desc 'Validate Ruby source files and ERB templates.'
|
2014-05-16 04:08:35 +00:00
|
|
|
task :validate do
|
|
|
|
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
|
|
|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
|
|
|
end
|
2016-09-14 19:20:26 +00:00
|
|
|
Dir['lib/puppet-strings/yard/templates/**/*.erb'].each do |template|
|
2014-05-16 04:08:35 +00:00
|
|
|
sh "erb -P -x -T '-' #{template} | ruby -c"
|
|
|
|
end
|
|
|
|
end
|
2014-10-01 00:15:02 +00:00
|
|
|
|
|
|
|
task :acceptance do
|
2016-06-20 21:13:41 +00:00
|
|
|
require 'beaker-hostgenerator'
|
|
|
|
|
2017-02-07 00:32:58 +00:00
|
|
|
install_type = 'aio'
|
2016-06-20 21:13:41 +00:00
|
|
|
target = ENV['platform']
|
2017-10-04 22:35:19 +00:00
|
|
|
abs = if ENV['BEAKER_ABS'] then 'abs' else 'vmpooler' end
|
2016-06-20 21:13:41 +00:00
|
|
|
if ! target
|
|
|
|
STDERR.puts 'TEST_TARGET environment variable is not set'
|
2016-09-16 22:01:21 +00:00
|
|
|
STDERR.puts 'setting to default value of "centos7-64ma".'
|
2017-02-07 00:32:58 +00:00
|
|
|
target = "centos7-64ma{type=#{install_type}}"
|
2016-06-20 21:13:41 +00:00
|
|
|
end
|
|
|
|
|
2017-02-07 01:04:18 +00:00
|
|
|
unless target =~ /type=/
|
|
|
|
puts "INFO: adding 'type=#{install_type}' to host config"
|
|
|
|
target += "{type=#{install_type}}"
|
|
|
|
end
|
|
|
|
|
2017-10-04 22:35:19 +00:00
|
|
|
cli = BeakerHostGenerator::CLI.new([target, '--hypervisor', abs])
|
2016-09-16 22:01:21 +00:00
|
|
|
nodeset_dir = 'spec/acceptance/nodesets'
|
2016-06-20 21:13:41 +00:00
|
|
|
nodeset = "#{nodeset_dir}/#{target}.yml"
|
|
|
|
FileUtils.mkdir_p(nodeset_dir)
|
|
|
|
File.open(nodeset, 'w') do |fh|
|
|
|
|
fh.print(cli.execute)
|
|
|
|
end
|
2017-02-07 00:32:58 +00:00
|
|
|
puts "nodeset file:"
|
2016-06-20 21:13:41 +00:00
|
|
|
puts nodeset
|
2016-09-14 19:20:26 +00:00
|
|
|
sh 'gem build puppet-strings.gemspec'
|
2016-09-16 22:01:21 +00:00
|
|
|
sh 'puppet module build spec/fixtures/acceptance/modules/test'
|
2017-02-07 00:32:58 +00:00
|
|
|
if ENV['BEAKER_keyfile']
|
|
|
|
sh "BEAKER_set=#{target} rspec spec/acceptance/*.rb"
|
|
|
|
else
|
|
|
|
sh "BEAKER_keyfile=$HOME/.ssh/id_rsa-acceptance BEAKER_set=#{target} rspec spec/acceptance/*.rb"
|
|
|
|
end
|
2014-10-01 00:15:02 +00:00
|
|
|
end
|
2014-10-08 20:35:14 +00:00
|
|
|
|
|
|
|
task(:rubocop) do
|
|
|
|
require 'rubocop'
|
|
|
|
cli = RuboCop::CLI.new
|
|
|
|
cli.run(%w(-D -f s))
|
|
|
|
end
|
2018-06-26 07:29:46 +00:00
|
|
|
|
|
|
|
#### CHANGELOG ####
|
|
|
|
begin
|
|
|
|
require 'github_changelog_generator/task'
|
|
|
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
|
|
require 'puppet-strings/version'
|
|
|
|
config.future_release = "v#{PuppetStrings::VERSION}"
|
|
|
|
config.header = "# Changelog\n\n" \
|
|
|
|
"All significant changes to this repo will be summarized in this file.\n"
|
|
|
|
config.configure_sections = {
|
|
|
|
added: {
|
|
|
|
prefix: "Added",
|
|
|
|
labels: ["enhancement"]
|
|
|
|
},
|
|
|
|
fixed: {
|
|
|
|
prefix: "Fixed",
|
|
|
|
labels: ["bugfix"]
|
|
|
|
},
|
|
|
|
breaking: {
|
|
|
|
prefix: "Changed",
|
|
|
|
labels: ["backwards-incompatible"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
config.exclude_labels = ['maintenance']
|
|
|
|
config.user = 'puppetlabs'
|
|
|
|
config.project = 'puppet-strings'
|
|
|
|
end
|
|
|
|
rescue LoadError
|
|
|
|
desc 'Install github_changelog_generator to get access to automatic changelog generation'
|
|
|
|
task :changelog do
|
|
|
|
raise 'Install github_changelog_generator to get access to automatic changelog generation'
|
|
|
|
end
|
|
|
|
end
|