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

Use GH pages for auto-generated docs #68

Merged
merged 4 commits into from
Nov 24, 2023
Merged
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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bundle exec erblint -a .

## Documentation

You can read about each cop supplied by RuboCop Solidus in [the docs](docs/cops.md).
You can read about each cop supplied by RuboCop Solidus in [the docs](https://solidusio.github.io/rubocop-solidus/).

## Contributing

Expand Down
3 changes: 3 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
theme: jekyll-theme-cayman
title: Automatic Solidus code style checking tool
description: A RuboCop extension focused on enforcing Solidus best practices and coding conventions
34 changes: 34 additions & 0 deletions docs/_layouts/departments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset="UTF-8">

{% seo %}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="preload" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap" as="style" type="text/css" crossorigin>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#157878">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
{% include head-custom.html %}
</head>
<body>
<a id="skip-to-content" href="#content">Skip to the content.</a>

<header class="page-header" role="banner">
<h1>{{ page.title | default: site.title | default: site.github.repository_name }}</h1>
<a href="./" class="btn">Back</a>
</header>

<main id="content" class="main-content" role="main">
{{ content }}

<footer class="site-footer">
{% if site.github.is_project_page %}
<span class="site-footer-owner"><a href="{{ site.github.repository_url }}">{{ site.github.repository_name }}</a> is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a>.</span>
{% endif %}
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span>
</footer>
</main>
</body>
</html>
5 changes: 4 additions & 1 deletion docs/cops_solidus.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Solidus
---
layout: departments
title: List of available Solidus cops
---

## Solidus/ClassEvalDecorator

Expand Down
4 changes: 1 addition & 3 deletions docs/cops.md → docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
## Available cops

In the following section you find all available cops:
In the following sections, you will find all available cops:

<!-- START_COP_LIST -->
#### Department [Solidus](cops_solidus.md)
Expand Down
2 changes: 1 addition & 1 deletion rubocop-solidus.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://www.github.com/solidusio/rubocop-solidus'
spec.metadata['changelog_uri'] = 'https://www.github.com/solidusio/rubocop-solidus/blob/main/CHANGELOG.md'
spec.metadata['documentation_uri'] = 'https://www.github.com/solidusio/rubocop-solidus/blob/main/docs/cops.md'
spec.metadata['documentation_uri'] = 'https://solidusio.github.io/rubocop-solidus/'

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand Down
4 changes: 2 additions & 2 deletions tasks/cops_documentation.rake
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ task generate_cops_documentation: :yard_for_generate_documentation do
end
return if selected_cops.empty?

content = +"# #{department}\n"
content = +"---\nlayout: departments\ntitle: List of available #{department} cops\n---\n"
selected_cops.each do |cop|
content << print_cop_with_doc(cop, config)
end
Expand Down Expand Up @@ -233,7 +233,7 @@ task generate_cops_documentation: :yard_for_generate_documentation do
# rubocop:enable Metrics/AbcSize

def print_table_of_contents(cops)
path = "#{Dir.pwd}/docs/cops.md"
path = "#{Dir.pwd}/docs/index.md"
original = File.read(path)
content = +"<!-- START_COP_LIST -->\n"

Expand Down