Add Gemfile, Rakefile for generating docs

This commit is contained in:
Kienan Stewart 2018-07-26 19:47:19 -04:00
parent 8d10d151ee
commit e292ae5a98
3 changed files with 49 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.yardoc/
public/

17
Gemfile Normal file
View File

@ -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

30
Rakefile Normal file
View File

@ -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