Initial commit

This commit is contained in:
Blerim Sheqa 2017-07-18 13:36:11 +02:00
parent 00007fab1c
commit cfebfdfb10
14 changed files with 742 additions and 1 deletions

12
.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
mkdocs.yml
.bundle/
vendor/
Gemfile.lock
html/
projects/*
!projects/
!projects/index.md
!projects/archive.md
.idea/
.DS_Store

3
Gemfile Normal file
View File

@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'git'

View File

@ -1 +1,72 @@
# icinga-docs-tools
# Icinga Documentation
This repository includes everything for building the documentation for all tools in the Icinga ecosystem.
The `build-docs.rb` script clones each configured project to the specified directory and switches to the specified
branch. It searches for `*.md` files within the configured directory and creates documentation sections out of the found
files. The ordering is defined by the file names. The capitalized name of each file is used as a title for this documentation
section. The script will generate the `mkdocs.yml`
## Configuration
### `config.yml`
This file defines generally for which projects documentation should be build. All settings are required.
| Option | Description |
| ------------- | ----------------------------------------------------------------------- |
| `projects_dir` | Directory where all projects are stored |
| `projects` | Array of projects |
| `git` | Git repository |
| `ref` | Branch or Tag to check out |
| `latest` | If set to `true`, the project will be cloned into a `latest` directory. |
| `target` | Target directory within `projects_dir` |
| `docs_dir` | Directory that includes the `*.md` files |
Example:
``` yaml
projects_dir: 'projects'
projects:
Icinga 2:
git: 'https://github.com/Icinga/icinga2.git'
ref: 'tags/v2.6.3'
target: 'icinga2'
docs_dir: 'doc'
Icinga Web 2:
git: 'https://github.com/Icinga/icingaweb2.git'
ref: 'tags/v2.4.1'
target: 'icingaweb2'
docs_dir: 'doc'
```
### `mkdocs.template.yml`
This file is used as a template for the final `mkdocs.yml`. Default settings and some other configuration options are
here.
### Run Development Server
To see a live preview of the documentation you can run a development server that will refresh automatically on changes.
Install `mkdocs` and the `material` theme:
``` bash
user@localhost ~/ $ pip install mkdocs
user@localhost ~/ $ pip install mkdocs-material
```
Clone this repository and install dependencies:
``` bash
user@localhost ~/ $ git clone https://github.com/Icinga/icinga-docs-tools.git
user@localhost ~/ $ cd icinga-docs-tools
user@localhost ~/ $ bundle install
user@localhost ~/ $ bundle exec build-docs.rb
```
Run server:
``` bash
user@localhost ~/ $ mkdocs serve
```
You should be able to access the documentation now in your browser by calling the address https://localhost:8000

59
build-docs.rb Executable file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env ruby
require 'fileutils'
require 'yaml'
require 'git'
config = YAML::load_file('config.yml')
mkdocs = YAML::load_file('mkdocs.template.yml')
config['projects'].each do |project_name, project_config|
puts "== #{project_name}"
project_dir = config['projects_dir'] + '/' + project_config['target']
if project_config['latest'] == true
clone_target = project_dir + '/latest'
else
clone_target = project_dir + '/' + project_config['ref'].gsub('tags/', '')
end
project_docs_dir = clone_target + '/' + project_config['docs_dir']
pages = []
if File.directory?(clone_target)
puts 'Project already exists, cleaning up'
FileUtils.rm_rf(clone_target)
end
puts 'Cloning ...'
FileUtils.mkdir_p(project_dir)
repo = Git.clone(project_config['git'], clone_target)
puts "Switching to ref '#{project_config['ref']}'"
repo.branch(project_config['ref']).checkout
puts 'Cleaning up everything not related to docs'
Dir::foreach(clone_target) do |file|
next if(file == project_config['docs_dir'])
next if(file == '.' || file == '..')
FileUtils.rm_rf(clone_target + '/' + file)
end
puts "Building page index from #{project_docs_dir}"
Dir.glob("#{project_docs_dir}/*.md") do |file|
filepath = file.gsub('projects/', '')
filename = filepath.match(/(\d+)-(.*).md$/)
header = filename[2].gsub('-', ' ').split.map(&:capitalize).join(' ')
pages.push(header => filepath)
end
mkdocs['pages'].push(project_name => pages)
end
mkdocs['extra']['append_pages'].each do |name, target|
mkdocs['pages'].push(name => target)
end
File.write('mkdocs.yml', mkdocs.to_yaml)
%x( mkdocs build )

27
config.yml Normal file
View File

@ -0,0 +1,27 @@
---
projects_dir: 'projects'
projects:
Icinga 2:
git: 'https://github.com/Icinga/icinga2.git'
ref: 'tags/v2.6.3'
latest: true
target: 'icinga2'
docs_dir: 'doc'
Icinga Web 2:
git: 'https://github.com/Icinga/icingaweb2.git'
ref: 'tags/v2.4.1'
latest: true
target: 'icingaweb2'
docs_dir: 'doc'
Director:
git: 'https://github.com/Icinga/icingaweb2-module-director.git'
ref: 'tags/v1.3.1'
latest: true
target: 'director'
docs_dir: 'doc'
Business Process:
git: 'https://github.com/Icinga/icingaweb2-module-businessprocess.git'
ref: 'tags/v2.1.0'
latest: true
target: 'businessprocess'
docs_dir: 'doc'

52
mkdocs.template.yml Normal file
View File

@ -0,0 +1,52 @@
---
site_name: Documentation
theme: material
theme_dir: theme
docs_dir: projects
site_dir: 'html'
pages:
- Introduction: index.md
extra:
append_pages:
Archive: archive.md
font:
text: 'Open Sans:300,400,400i,600,700'
menu:
- text: 'Products'
link: 'https://www.icinga.com/products/'
- text: 'Partners'
link: 'https://www.icinga.com/partners/'
- text: 'Training'
link: 'https://www.icinga.com/training/'
- text: 'Events'
link: 'https://www.icinga.com/events/'
- text: 'Docs'
link: 'https://www.icinga.com/docs/'
- text: 'Support'
link: 'https://www.icinga.com/support/'
- text: 'Blog'
link: 'https://www.icinga.com/blog/'
- text: 'Download'
link: 'https://www.icinga.com/downloads/'
cssid: 'download-button'
social:
- type: 'facebook'
link: 'https://www.facebook.com/icinga'
- type: 'twitter'
link: 'https://twitter.com/icinga'
- type: 'google-plus'
link: 'http://plus.google.com/+icinga'
- type: 'feed'
link: 'https://www.icinga.com/feed/'
extra_css:
- css/theme.css
extra_javascript: []
markdown_extensions:
- smarty
- admonition
- codehilite(guess_lang=true)
- toc(permalink=true)
copyright: '2017 - Icinga Open Source Monitoring'
google_analytics:
- 'UA-280659-15'
- 'auto'

6
projects/archive.md Normal file
View File

@ -0,0 +1,6 @@
# Archive
Here you will find older versions of documentations and docs of older products.
#### Icinga 1
* [English Online](https://www.icinga.com/docs/icinga1/latest/en/)
* [German Online](https://www.icinga.com/docs/icinga1/latest/de/)

6
projects/index.md Normal file
View File

@ -0,0 +1,6 @@
# Icinga Documentation
Welcome to the Icinga Documation. Please select your preferred product on the left.
Built on proven technologies and concepts as well as progressive frameworks and standards, Icinga is a product of the
community - their ideas, needs and combined passion for innovation.

352
theme/css/theme.css Normal file
View File

@ -0,0 +1,352 @@
.clearfix:after {
content: "";
display: block;
clear: both;
}
#main-header {
width: 100%;
float: left;
background: #000000;
position: relative;
color: #ffffff;
}
#main-header-container {
width: 80%;
max-width: 1255px;
margin: auto;
position: relative;
}
#main-header-logo-container {
float: left;
position: relative;
height: 64px;
line-height: 8.5em;
padding-top: 0.1em;
padding-left: 0.3em;
}
#main-header-logo-container img{
max-width: 100%;
}
#logo {
float: none;
display: inline-block;
height: 38.39px;
}
#top-menu-nav {
float: left;
line-height: 0;
}
.top-menu-item a:hover {
opacity: .6;
}
#top-menu-hamburger {
display:none;
color: white;
font-size: 32px;
color: #0095BF;
}
#top-menu-nav ul {
list-style: none;
padding: 0;
margin: 0;
}
#top-menu-nav li {
line-height: 2.9em;
position: relative;
font-size: 14px;
padding-right: 9px;
display: inline-block;
}
#top-menu-nav a {
padding: 10px 12px;
font-weight: 600;
font-family: "Open Sans";
}
#main-header-navigation {
float: right;
font-weight: 600;
height: 100%;
padding: 1.1em 0;
}
#download-button > a {
border: 1px solid white;
border-radius: 3px;
}
.md-header {
background: url(../images/icinga-hero-background.jpg);
background-size: cover;
background-position: center;
background-repeat: no-repeat;
position: relative;
float: left;
width: 100%;
padding: 20px;
height: auto;
box-shadow: none;
}
.md-header[data-md-state=shadow] {
box-shadow: none;
}
.md-header-nav {
width: 80%;
position: relative;
margin: auto;
padding: 2% 0;
}
.md-header-nav__title {
padding: 0;
font-size: 32px;
line-height: 1em;
font-family: "Open Sans";
font-weight: 700;
}
.md-container {
padding-top: 0;
font-family: "Open Sans"
}
.md-content a {
color: #0095BF;
}
.md-content a:hover {
color: #EF4F98;
}
.md-nav__item a:hover {
color: #0095BF;
}
.md-nav__link:hover {
color: #0095BF;
}
.md-nav__link--active {
color: #0095BF;
}
.md-nav--secondary {
border-left: .2rem solid #0095BF;
}
.md-sidebar[data-md-state=lock] {
top: 1rem;
}
#mkdocs-search-results {
font-family: "Open Sans"
}
#search-loading {
display: table;
margin: 0 auto;
color: #EF4F98;;
}
#search-loading p{
color: #000000;
margin: 1em 0;
}
#searchpage-form {
display: none;
}
#mobile-search-form {
width: 100%;
}
.mobile-search-form-input {
width: 100%;
border: 1px solid #c7c9cb;
line-height: 2em;
padding-left: 5px;
}
#footer {
width: 100%;
background: #000000;
}
.footer-container {
width: 80%;
position: relative;
margin: auto;
text-align: left;
}
#footer-widgets {
padding: 6% 0 0;
}
.footer-widget {
margin: 0 5.5% 5.5% 0;
font-size: 13px;
float: left;
color: #ffffff;
line-height: 1.7em;
width: 20.875%;
}
.footer-widget h4 {
font-size: 22px;
}
.footer-widget-text {
float: left;
max-width: 100%;
}
.footer-widget-text:last-child {
margin-bottom: 0 !important;
}
.textwidget ul {
list-style: none;
margin: 0;
padding: 0;
line-height: 1.7em;
}
.textwidget ul li {
margin-bottom: 0.5em;
}
.footer-title {
margin: 0;
padding: 0;
padding-bottom: 10px;
}
.footer-menu-item a:hover {
opacity: .6;
}
.footer-logo {
padding-top: 15px;
height: 70px;
}
.footer-logo:hover {
opacity: .6;
}
#stay-informed-email {
padding: 5px;
font-size: 14px;
width: 100%;
border: 1px solid #bbb;
color: #4e4e4e;
background-color: #fff;
}
#submit-button {
margin-left: 0px;
margin-top: 10px;
background-color: #0095bf;
font-size: 14px;
font-weight: 500;
border-radius: 2px;
border: 2px solid transparent;
color: #ffffff;
width: 100%;
line-height: 1.4em;
}
.footer-bottom {
padding: 15px 0 5px;
color: #ffffff;
}
#footer-social-icons {
list-style: none;
float: right;
margin: 0;
padding: 0;
font-size: 18px;
}
.footer-social-icon {
display: inline-block;
margin-left: 20px;
}
#footer-copyright {
font-size: 13px;
padding-bottom: 17px;
}
@media screen and (max-width:65em) {
#top-menu {
display: none;
position: absolute;
left: 0;
right: 0;
z-index: 999;
background-color: #000000;
border-top: 4px solid #0095BF;
padding: 5%;
}
#top-menu-hamburger {
display: block;
}
#top-menu-nav li {
display: block;
padding-top: 10px;
padding-bottom: 20px;
}
#download-button > a {
border: none;
}
.md-search__form {
display: none;
}
.md-header-nav__button.md-icon--search {
display: block;
}
#searchpage-form {
display: table;
margin: 0px 0px 50px 0px;
width: 30%;
}
#search-loading {
display: none;
}
.footer-widget:nth-child(n) {
width: 42% !important;
margin: 0 7.5% 7.5% 0 !important;
}
}
@media only screen and (max-width: 76.1875em) {
html .md-nav--primary .md-nav__title--site {
background-color: #0095BF;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -0,0 +1,73 @@
<footer id="footer">
<div class="footer-container">
<div id="footer-widgets" class="clearfix">
<div class="footer-widget">
<div class="footer-widget-text">
<h4 class="footer-title">We love monitoring</h4>
<div class="textwidget">
<a href="https://www.icinga.com/" alt="Icinga">
<img class="footer-logo" alt="Icinga" src="{{ base_url }}/images/icinga-logo-white.png"">
</a>
</div>
</div>
</div>
<div class="footer-widget">
<div class="footer-widget-text">
<h4 class="footer-title">About us</h4>
<div class="textwidget">
<ul>
<li class="footer-menu-item"><a href="https://www.icinga.com/about/team/">Team</a></li>
<li class="footer-menu-item"><a href="https://www.icinga.com/about/customers/">Customers</a></li>
<li class="footer-menu-item"><a href="https://www.icinga.com/partners/">Partners</a></li>
<li class="footer-menu-item"><a href="https://www.icinga.com/shop/">Shop</a></li>
</ul>
</div>
</div>
</div>
<div class="footer-widget">
<div class="footer-widget-text">
<h4 class="footer-title">Connect</h4>
<div class="textwidget">
<ul>
<li class="footer-menu-item"><a href="https://www.icinga.com/contact/">Contact us</a></li>
<li class="footer-menu-item"><a href="https://www.icinga.com/events/">Events</a></li>
<li class="footer-menu-item"><a href="https://www.icinga.com/about/get-involved/">Get involved</a></li>
<li class="footer-menu-item"><a href="https://www.icinga.com/blog/">Blog</a></li>
</ul>
</div>
</div>
</div>
<div class="footer-widget" style="margin-right:0px">
<div class="footer-widget-text">
<h4 class="footer-title">Stay informed</h4>
<div class="textwidget">
<p></p>
<div id="footer-signup">
<form action="//icinga.us8.list-manage.com/subscribe/post?u=b791f3f89c2aa4ce5e741f273&#038;id=056e3dafee" method="post" target="_blank">
<div><input id="stay-informed-email" name="EMAIL" required="" type="email" value="" placeholder="email address" />
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input tabindex="-1" name="b_b791f3f89c2aa4ce5e741f273_056e3dafee" type="text" value="" /></div>
<div>
<input id="submit-button" class="button" name="subscribe" type="submit" value="Subscribe" />
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer-bottom">
<div class="footer-container clearfix">
<ul id="footer-social-icons">
{% set path = "ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/{{ path }}">
{% for social in config.extra.social %}
<li class="footer-social-icon"><a href="{{ social.link }}" class="fa fa-{{ social.type }}"></a></li>
{% endfor %}
</ul>
<div id="footer-copyright">© {{ config.copyright }}</div>
</div>
</div>
</footer>

View File

@ -0,0 +1,46 @@
<div id="main-header">
<div id="main-header-container" class="clearfix">
<div id="main-header-logo-container">
<a href="https://www.icinga.com/" alt="Icinga">
<img alt="Icinga" src="{{ base_url }}/images/icinga-logo-white.png" id="logo">
</a>
</div>
<div id="main-header-navigation">
<nav id="top-menu-nav">
<button id="top-menu-hamburger" class="md-icon md-icon--menu" onclick="document.querySelector('#top-menu').style.display = (document.querySelector('#top-menu').style.display == 'block') ? 'none' : 'block'"></button>
<ul id="top-menu">
{% for menuitem in config.extra.menu %}
{% if menuitem.cssid %}
<li class="top-menu-item" id="{{ menuitem.cssid }}"><a href="{{ menuitem.link }}">{{ menuitem.text }}</a></li>
{% else %}
<li class="top-menu-item"><a href="{{ menuitem.link }}">{{ menuitem.text }}</a></li>
{% endif %}
{% endfor %}
</ul>
</nav>
</div>
</div>
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<span class="md-flex__ellipsis md-header-nav__title">
{{ config.site_name }}
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<a class="md-icon md-icon--search md-header-nav__button" href="{{ base_url }}/search.html"></a>
<form class="md-search__form" action="{{ base_url }}/search.html">
<span role="status" aria-live="polite"></span>
<input name="q" id="mkdocs-search-query" class="md-search__input" type="text" required placeholder="Search" autocomplete="off">
<label class="md-icon md-search__icon" for="search"></label>
</form>
</div>
</div>
</nav>
</header>

34
theme/search.html Normal file
View File

@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block extrahead %}
<script>var base_url = '{{ base_url }}';</script>
<script data-main="{{ base_url }}/mkdocs/js/search.js" src="{{ base_url }}/mkdocs/js/require.js"></script>
{% endblock %}
{% block content %}
<h1 id="search-documentation">Search Results</h1>
<noscript>
<div class="admonition warning">
<p>
Please activate JavaScript to enable the search
functionality.
</p>
</div>
</noscript>
<div id="searchpage-form">
<form id="mobile-search-form" action="{{ base_url }}/search.html">
<span role="status" aria-live="polite"></span>
<input name="q" id="mkdocs-search-query" class="mobile-search-form-input" type="text" required placeholder="Search" autocomplete="off">
</form>
</div>
<div id="mkdocs-search-results">
<div id="search-loading">
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<p>Searching ...</p>
</div>
</div>
{% endblock %}