Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Revamp docs site #779

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ coverage/
.idea
/*.pp
/tmp/
/.yardoc/
/doc/
77 changes: 77 additions & 0 deletions .yard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
require 'yard'
require 'pry'

YARD::Tags::Library.define_tag("Enabled", :enabled)
YARD::Tags::Library.define_tag("Style Guide", :style_guide)

module YARD::CodeObjects
module PuppetLint
class Base < YARD::CodeObjects::NamespaceObject
def self.new(*args)
object = Object.class.instance_method(:new).bind(self).call(*args)
existing = YARD::Registry.at(object.path)
object = existing if existing && existing.class == self
yield(object) if block_given?
object
end
end

class Group < YARD::CodeObjects::PuppetLint::Base
def self.instance(key)
instance = P(:root, key)
return instance unless instance.is_a?(YARD::CodeObjects::Proxy)
instance = self.new(:root, key)
instance.visibility = :hidden
P(:root).children << instance
instance
end

def path
@name.to_s
end

def type
@name
end
end

class Checks < Group
def self.instance
super(:puppet_lint_checks)
end

def name(_prefix = false)
'puppet-lint checks'
end
end

class Check < YARD::CodeObjects::PuppetLint::Base
def initialize(name)
super(YARD::CodeObjects::PuppetLint::Checks.instance, name)
end

def type
:puppet_lint_check
end
end
end
end

module YARD::Handlers
module PuppetLint
class CheckHandler < YARD::Handlers::Ruby::Base
handles method_call(:new_check)

def process
return unless statement[0].type == :var_ref
return unless statement[0].children.first.type == :const && statement[0].children.first.source == 'PuppetLint'
check_name = statement[3].children.first.source

object = YARD::CodeObjects::PuppetLint::Check.new(check_name.gsub(/\A:/, ''))
object.source = statement[0]
object.docstring = statement[0].docstring
register object
end
end
end
end
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require 'rake'
require 'rspec/core/rake_task'
require 'puppet-lint'
require 'puppet-lint/tasks/release_test'
require 'puppet-lint/tasks/docs'

task :default => :test

Expand Down
4 changes: 4 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/_site/
/Gemfile.lock
/vendor/
/.bundle/
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
puppet-lint.com
3 changes: 3 additions & 0 deletions docs/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'github-pages'
100 changes: 100 additions & 0 deletions docs/_data/plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
-
name: trailing_newlines
summary: Checks to ensure that your manifest files end with a trailing newline.
url: https://github.com/rodjek/puppet-lint-trailing_newline-check
gem: puppet-lint-trailing_newline-check
-
name: variable_contains_upcase
summary: Extends puppet-lint to ensure that your variables are all lower case.
url: https://github.com/fiddyspence/puppetlint-variablecase
gem: puppet-lint-variable_contains_upcase
-
name: parameter_documentation
summary: Check to validate that all class parameters are documented.
url: https://github.com/domcleal/puppet-lint-param-docs
gem: puppet-lint-param-docs
-
name: roles_and_profiles
summary: Check to validate that your code matches to Roles & Profiles paradigm
url: https://github.com/mcanevet/puppet-lint-roles_and_profiles-check
gem: puppet-lint-roles_and_profiles-check
-
name: absolute_template_path
summary: Check that template paths are relative not absolute.
url: https://github.com/deanwilson/puppet-lint-absolute_template_path-check
gem: puppet-lint-absolute_template_path
-
name: strict_indent
summary: Check that manifests follow a strict indent pattern.
url: https://github.com/relud/puppet-lint-strict_indent-check
gem: puppet-lint-strict_indent-check
-
name: unquoted_string
summary: Check that selectors and case statements cases are quoted.
url: https://github.com/mcanevet/puppet-lint-unquoted_string-check
gem: puppet-lint-unquoted_string-check
-
name: package_ensure
summary: Check for packages with ensure set to latest.
url: https://github.com/danzilio/puppet-lint-package_ensure-check
gem: puppet-lint-package_ensure-check
-
name: reference_syntax
summary: Check that resource references do not contain whitespace between resource reference and opening bracket and title does not start with capital letter.
url: https://github.com/voxpupuli/puppet-lint-resource_reference_syntax
gem: puppet-lint-resource_reference_syntax
-
name: top_scope_facts
summary: Check that facts are accessed using the $facts hash instead of as top scope variables. e.g use $facts['operatingsystem'] instead of $::operatingsystem.
url: https://github.com/mmckinst/puppet-lint-top_scope_facts-check
gem: puppet-lint-top_scope_facts-check
-
name: legacy_facts
summary: Ensure facts are acccessed using new structured facts. e.g use $facts['os']['name'] instead of $facts['operatingsystem']
url: https://github.com/mmckinst/puppet-lint-legacy_facts-check
gem: puppet-lint-legacy_facts-check
-
name: concatenated_template_files
summary: Ensure all template functions expand a file, rather than concatenating multiple templates string together.
url: https://github.com/deanwilson/puppet-lint-concatenated_template_files-check
gem: puppet-lint-concatenated_template_files-check
-
name: duplicate_class_parameters
summary: Ensures class parameter names are unique.
url: https://github.com/deanwilson/puppet-lint_duplicate_class_parameters-check
gem: puppet-lint-duplicate_class_parameters-check
-
name: yumrepo_gpgcheck_enabled
summary: Ensure gpgcheck is enabled on yumrepo resources.
url: https://github.com/deanwilson/puppet-lint-yumrepo_gpgcheck_enabled-check
gem: puppet-lint-yumrepo_gpgcheck_enabled-check
-
name: no_cron_resources
summary: Ensure no cron resources are contained in the catalog.
url: https://github.com/deanwilson/puppet-lint-no_cron_resources-check
gem: puppet-lint-no_cron_resources-check
-
name: world_writable_files
summary: Ensure file resources are not world writable.
url: https://github.com/deanwilson/puppet-lint-world_writable_files-check
gem: puppet-lint-world_writable_files-check
-
name: no_symbolic_file_modes
summary: Ensure all file resource modes are defined as octal values and not symbolic ones.
url: https://github.com/deanwilson/puppet-lint-no_symbolic_file_modes-check
gem: puppet-lint-no_symbolic_file_modes-check
-
name: no_erb_template
summary: Ensure there are no calls to the template() or inline_template() as an aid to migrating to epp templates.
url: https://github.com/deanwilson/puppet-lint-no_erb_template-check
gem: puppet-lint-no_erb_template-check
-
name: no_file_path_attribute
summary: Ensure file resources do not have a path attribute.
url: https://github.com/deanwilson/puppet-lint-no_file_path_attribute-check
gem: puppet-lint-no_file_path_attribute-check
-
name: template_file_extension
summary: Ensure all file names used in template() and epp() functions end with the string '.erb' or '.epp' respectively.
url: https://github.com/deanwilson/puppet-lint-template_file_extension-check
gem: puppet-lint-template_file_extension-check
16 changes: 16 additions & 0 deletions docs/_includes/check_disabling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{:.section-title}
## Disabling the check

To disable this check you add `--no-{{ page.check.name }}-check` to your
`puppet-lint` command line.

{% highlight console %}
$ puppet-lint --no-{{ page.check.name }}-check path/to/file.pp
{% endhighlight %}

Alternatively, if you're calling puppet-lint via the Rake task, you should
insert the following line to your `Rakefile`.

{% highlight ruby %}
PuppetLint.configuration.send('disable_{{ page.check.name }}')
{% endhighlight %}
30 changes: 30 additions & 0 deletions docs/_includes/check_table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<p>
<table class="table">
<thead>
<tr>
<th>Enabled by default</th>
<th>Supports auto-correct</th>
<th>Style Guide reference</th>
</tr>
</thead>
<tbody>
<tr>
{% if page.check.enabled %}
<td>Yes</td>
{% else %}
<td>No</td>
{% endif %}
{% if page.check.fix %}
<td>Yes</td>
{% else %}
<td>No</td>
{% endif %}
{% if page.check.style_guide %}
<td><a href="https://docs.puppetlabs.com/guides/style_guide.html{{ page.check.style_guide}}">Link</a></td>
{% else %}
<td></td>
{% endif %}
</tr>
</tbody>
</table>
</p>
3 changes: 3 additions & 0 deletions docs/_includes/deprecation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="alert alert-warning show" role="alert">
<i class="md-icon dp18 alert-icon mr-3">warning</i><strong>Deprecated!</strong> {{ include.message }}
</div>
1 change: 1 addition & 0 deletions docs/_includes/spacer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="spacer">&nbsp;</div>
90 changes: 90 additions & 0 deletions docs/_layouts/cards.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<!-- Site template licensed from kingstudio.ro -->
<html lang="en">

<head>
<!-- Meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon -->
<link rel="icon" href="/assets/images/favicon.png">
<!-- Site Title -->
<title>puppet-lint</title>
<!-- Bootstrap 4 core CSS -->
<link href="/assets/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom Styles -->
<link href="/assets/css/doc-style.css" rel="stylesheet">
<link href="/assets/css/prism.css" rel="stylesheet">
<link href="/assets/css/animate.css" rel="stylesheet">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Rubik:400,500" rel="stylesheet">
</head>

<body class="doc" data-spy="scroll" data-target="#nav-scroll">

<!-- navigation menu -->
<nav class="navbar doc-nav navbar-expand-lg navbar-inverse bg-primary">
<div class="container no-padding">
<a class="navbar-brand" href="/">puppet-lint</a>

<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#main-menu" aria-controls="main-menu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="main-menu">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link active" href="/documentation/">Documentation</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/plugins/">Plugins/a>
</li>
<li class="nav-item">
<a class="nav-link" href="/faq/">FAQ</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/rodjek/puppet-lint/issues">Support</a>
</li>
</ul>
</div><!-- / collapse -->
</div><!-- container full-width -->
</nav>
<!-- / navigation menu -->

<div class="container">
<div class="row">
<div class="col-md-12 col-lg-12 content">
<section id="introduction">
{{ content }}
</section><!-- / introduction -->
</div><!-- / column -->
</div><!-- / row -->
</div><!-- / container -->

<footer>
<div class="container">
<p>Last updated: {{ site.time | date_to_long_string }}<span class="pull-right"><a href="/documentation/">Documentation</a> <a href="/plugins">Plugins</a> <a href="/faq/">FAQ</a> <a href="https://github.com/rodjek/puppet-lint/issues">Support</a></span></p>
</div><!-- / container -->
</footer>

<!-- Core JavaScript -->
<script src="/assets/js/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="/assets/js/bootstrap.min.js"></script>
<!-- / Core JavaScript -->

<!-- Smooth Scrolling -->
<script src="/assets/js/jquery.easing.min.js"></script>
<script src="/assets/js/smooth-scroll.js"></script>
<!-- / Smooth Scrolling -->

<!-- Prism -->
<script src="/assets/js/prism.js"></script>
<!-- / Prism -->

</body>
</html>
Loading