From e292ae5a987e175232f78fc34623f096b14d287e Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Thu, 26 Jul 2018 19:47:19 -0400 Subject: [PATCH] Add Gemfile, Rakefile for generating docs --- .gitignore | 2 ++ Gemfile | 17 +++++++++++++++++ Rakefile | 30 ++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 .gitignore create mode 100644 Gemfile create mode 100644 Rakefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56cef9e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.yardoc/ +public/ \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..027101e --- /dev/null +++ b/Gemfile @@ -0,0 +1,17 @@ +source 'https://rubygems.org' + +gem 'puppet', ENV['PUPPET_VERSION'] +gem 'rake' + +group :test do + gem 'facter', ENV['FACTER_VERSION'] + gem 'hiera', ENV['HIERA_VERSION'] + gem 'metadata-json-lint' + gem 'puppetlabs_spec_helper' + gem 'rspec-puppet-facts' + gem 'semantic_puppet' +end + +group :docs do + gem 'puppet-strings' +end diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..c092e77 --- /dev/null +++ b/Rakefile @@ -0,0 +1,30 @@ +require 'puppetlabs_spec_helper/rake_tasks' + +defaults = [:validate, :spec] +begin + if Gem::Specification::find_by_name('metadata-json-lint') + defaults = defaults.insert(0, :metadata_lint) + end + if Gem::Specification::find_by_name('puppet-lint') + require 'puppet-lint/tasks/puppet-lint' + exclude_paths = [ + 'bundle/**/*', + 'pkg/**/*', + 'vendor/**/*', + 'spec/**/*' + ] + Rake::Task[:lint].clear + PuppetLint::RakeTask.new :lint do |config| + config.ignore_paths = exclude_paths + end + defaults = defaults.insert(-2, :lint) + end +end +task :test => defaults + +task :docs do + require 'puppet-strings' + # Remove TOC, as YARD generates its own + sh "sed -i 's/# alternc/## Description/' README.md" + PuppetStrings.generate(PuppetStrings::DEFAULT_SEARCH_PATTERNS, { :yard_args => ['--output-dir=public'] }) +end