documentator 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +72 -0
- data/bin/documentator +6 -0
- data/lib/documentator.rb +55 -0
- data/lib/documentator/bootstrap/Archi.ditaa +0 -0
- data/lib/documentator/bootstrap/Archi.md +0 -0
- data/lib/documentator/bootstrap/Dependencies.md +0 -0
- data/lib/documentator/bootstrap/Deploy.md +0 -0
- data/lib/documentator/bootstrap/Environments.md +0 -0
- data/lib/documentator/bootstrap/Gemfile +4 -0
- data/lib/documentator/templates/beanstalkd.md +29 -0
- data/lib/documentator/templates/capistrano.md +91 -0
- data/lib/documentator/templates/grunt.md +34 -0
- data/lib/documentator/templates/nginx.md +0 -0
- data/lib/documentator/templates/ruby.md +59 -0
- data/lib/documentator/version.rb +3 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1cb2b60a388b55a2ef800f92c0727205a2a87593
|
4
|
+
data.tar.gz: 394c3267f4522ac5e9f3b46b8e29cac433d4dc12
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2f04a465bf81908689d13b5c3492d0a0a007c8ddbf81e4eaa11ff57cb60c2208707e52c8c875f414ea68279319c292f9cba0b14d257c8a05003345d0807a084a
|
7
|
+
data.tar.gz: ae4e8b7aa668ddc5b5239cc9d76007c19eb7310fc4511807a71ad3f2c71fc9f2d53e261b301fe62a2ecca14b7548295388aa8cdb4143ee14a1ea3075c9b087b1
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT LICENSE
|
2
|
+
|
3
|
+
Copyright (c) chatgris <jboyer@af83.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# documentator
|
2
|
+
|
3
|
+
documentator has one primary goal: having better docs on our projects.
|
4
|
+
|
5
|
+
documentator provides two main features to achieve that goal:
|
6
|
+
|
7
|
+
|
8
|
+
### Bootstrap
|
9
|
+
|
10
|
+
`bootstrap` provides a minimal set of documentation's file.
|
11
|
+
Those are empty, and they *must* be written for each project. This is specific
|
12
|
+
to each project:
|
13
|
+
|
14
|
+
* What's the architecture (providing a [ditaa](http://ditaa.sourceforge.net/)
|
15
|
+
schema will make you earns some karma points)?
|
16
|
+
* Dependencies?
|
17
|
+
* Environnements?
|
18
|
+
|
19
|
+
|
20
|
+
As a treat, `bootstrap` generates a Gemfile in `project/doc` which include
|
21
|
+
[Guide'em up](https://github.com/nono/guide-em-up). Guide'em up can be used to
|
22
|
+
preview markdown file in a browser.
|
23
|
+
|
24
|
+
### Import
|
25
|
+
|
26
|
+
`import` provides some templates of common documentation that should be the same
|
27
|
+
from one project to another. And yet, we write them on each project. I mean,
|
28
|
+
installing ElasticSearch is always the same.
|
29
|
+
|
30
|
+
## Installation
|
31
|
+
|
32
|
+
With bundler, add it to your `Gemfile`:
|
33
|
+
|
34
|
+
``` ruby
|
35
|
+
group :development do
|
36
|
+
gem "documentator", git: "git@github.com:AF83/documentator.git"
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
|
42
|
+
Commands should be used from the root directory of the current project.
|
43
|
+
|
44
|
+
### Bootstrap
|
45
|
+
|
46
|
+
``` bash
|
47
|
+
bundle exec documentator bootstrap
|
48
|
+
```
|
49
|
+
|
50
|
+
### Importing templates
|
51
|
+
|
52
|
+
``` bash
|
53
|
+
bundle exec documentator list
|
54
|
+
```
|
55
|
+
|
56
|
+
``` bash
|
57
|
+
bundle exec documentator import nginx
|
58
|
+
```
|
59
|
+
|
60
|
+
## Contribution
|
61
|
+
|
62
|
+
YES. We want contributions.
|
63
|
+
|
64
|
+
* Adding a bootstrap's file is done by adding a file to
|
65
|
+
`lib/documentator/bootstrap`.
|
66
|
+
* Adding a templates's file is done by adding a file to
|
67
|
+
`lib/documentator/templates`.
|
68
|
+
|
69
|
+
|
70
|
+
## Copyright
|
71
|
+
|
72
|
+
MIT. See LICENSE for further details.
|
data/bin/documentator
ADDED
data/lib/documentator.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'boson/runner'
|
3
|
+
require 'pathname'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Documentator
|
7
|
+
class Runner < Boson::Runner
|
8
|
+
include FileUtils
|
9
|
+
|
10
|
+
desc "Generate and populate a doc directory"
|
11
|
+
def bootstrap
|
12
|
+
create_default_dir!
|
13
|
+
Dir[bootstrap_path.join("*")].each do |file|
|
14
|
+
cp(file, doc_path).tap { puts "✓ #{File.basename(file, File.extname(file))} created!" }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "import a template to doc directory"
|
19
|
+
def import(template)
|
20
|
+
unless File.exists?(doc_path)
|
21
|
+
puts "You should run `bootstrap` before trying to import documentation"
|
22
|
+
exit 1
|
23
|
+
end
|
24
|
+
cp(templates_path.join("#{template}.md"), doc_path)
|
25
|
+
puts "✓ File #{template} copied."
|
26
|
+
rescue Errno::ENOENT
|
27
|
+
puts "x File #{template} not found."
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "List all templates"
|
31
|
+
def list
|
32
|
+
Dir[templates_path.join("*")].each do |file|
|
33
|
+
puts "* #{File.basename(file, File.extname(file))}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def create_default_dir!
|
40
|
+
mkdir doc_path rescue nil
|
41
|
+
end
|
42
|
+
|
43
|
+
def doc_path
|
44
|
+
Pathname.new(Dir.pwd).join('doc')
|
45
|
+
end
|
46
|
+
|
47
|
+
def bootstrap_path
|
48
|
+
Pathname.new(File.expand_path("../", __FILE__)).join "documentator", "bootstrap"
|
49
|
+
end
|
50
|
+
|
51
|
+
def templates_path
|
52
|
+
Pathname.new(File.expand_path("../", __FILE__)).join "documentator", "templates"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Beanstalkd
|
2
|
+
|
3
|
+
[A simple, fast work queue](http://kr.github.com/beanstalkd/).
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
En tant que root:
|
8
|
+
|
9
|
+
``` shell
|
10
|
+
aptitude install beanstalkd
|
11
|
+
```
|
12
|
+
|
13
|
+
## Configuration
|
14
|
+
|
15
|
+
Exemple de fichier de configuration:
|
16
|
+
|
17
|
+
## Defaults for the beanstalkd init script, /etc/init.d/beanstalkd on
|
18
|
+
## Debian systems. Append ``-b /var/lib/beanstalkd'' for persistent
|
19
|
+
## storage.
|
20
|
+
BEANSTALKD_LISTEN_ADDR=0.0.0.0
|
21
|
+
BEANSTALKD_LISTEN_PORT=11300
|
22
|
+
DAEMON_OPTS="-l $BEANSTALKD_LISTEN_ADDR -p $BEANSTALKD_LISTEN_PORT"
|
23
|
+
|
24
|
+
## Uncomment to enable startup during boot.
|
25
|
+
START=yes
|
26
|
+
|
27
|
+
`beanstalkd` accepte le flag `-b` suivit d'un chemin. Cette option active un
|
28
|
+
binlog. Cela permet de ne pas perdre de message lors d'un redémarrage de
|
29
|
+
beanstalkd.
|
@@ -0,0 +1,91 @@
|
|
1
|
+
Déploiement avec capistrano
|
2
|
+
---------------------------
|
3
|
+
|
4
|
+
Pour nos applications, nous mettons en place un script de déploiement
|
5
|
+
automatisé. Celui-ci s'appuie sur l'outil Capistrano et nos recettes maison :
|
6
|
+
[capistrano-af83](https://github.com/AF83/capistrano-af83).
|
7
|
+
|
8
|
+
Sur le serveur
|
9
|
+
--------------
|
10
|
+
|
11
|
+
Nous conseillons de faire tourner l'application avec un user UNIX au nom du
|
12
|
+
projet. Pour ce guide de déploiement, nous supposons que son `$HOME` est
|
13
|
+
`/var/www/projet` et que les dépendances (Git, Ruby, Nginx, etc.) ont déjà été
|
14
|
+
installées.
|
15
|
+
|
16
|
+
Il est alors nécessaire de créer une clé ssh pour cet utilisateur, à l'aide de
|
17
|
+
la commande `ssh-keygen`. Puis, il faudra nous fournir cette clé pour que l'on
|
18
|
+
ajoute cette clé SSH comme clé de déploiement sur github.
|
19
|
+
|
20
|
+
On peut alors se connecter en ssh pour, d'une part, vérifier que ça marche et,
|
21
|
+
d'autre part, définir quelques variables d'environnement. Nous avons pour
|
22
|
+
habitude de les placer dans le fichier `~/ruby-env` et d'ajouter la ligne
|
23
|
+
`source ~/ruby-env` au début du fichier `~/.bashrc`. Voici le contenu de ce
|
24
|
+
fichier `ruby-env` :
|
25
|
+
|
26
|
+
```
|
27
|
+
#!/bin/sh
|
28
|
+
export GEM_HOME=~/gem
|
29
|
+
export PATH=~/bin:$GEM_HOME/bin:$PATH
|
30
|
+
export APP_ROOT=~/prod/current
|
31
|
+
export THIN_CONF=~/prod/shared/thin.yml
|
32
|
+
|
33
|
+
if [ -z "en_US.UTF-8" ]; then
|
34
|
+
export LANG=en_US.UTF-8
|
35
|
+
fi
|
36
|
+
|
37
|
+
export RAILS_ENV=production
|
38
|
+
|
39
|
+
reload() {
|
40
|
+
pushd $APP_ROOT && bundle exec thin restart -C $THIN_CONF
|
41
|
+
popd
|
42
|
+
}
|
43
|
+
|
44
|
+
stop() {
|
45
|
+
pushd $APP_ROOT && bundle exec thin stop -C $THIN_CONF
|
46
|
+
popd
|
47
|
+
}
|
48
|
+
```
|
49
|
+
|
50
|
+
Dernière étape coté serveur, il faut installer bundler avec `gem install
|
51
|
+
bundler`.
|
52
|
+
|
53
|
+
|
54
|
+
Sur la sandbox de déploiement
|
55
|
+
-----------------------------
|
56
|
+
|
57
|
+
D'autre part, la personne qui fera le déploiement du code a également besoin
|
58
|
+
d'accéder à notre dépôt github (envoyez-nous la liste des comptes github) et à
|
59
|
+
un environnement Ruby depuis lequel le déploiement capistrano se fera. Sur cet
|
60
|
+
environnement, il faudra également installer la gem Ruby bundler (`gem install
|
61
|
+
bundler`).
|
62
|
+
|
63
|
+
Comme pour le coté serveur, il peut être utile de définir les variables
|
64
|
+
d'environnement suivantes si Ruby a été installé en root :
|
65
|
+
|
66
|
+
```
|
67
|
+
export GEM_HOME=~/gem
|
68
|
+
export PATH=~/bin:$GEM_HOME/bin:$PATH
|
69
|
+
```
|
70
|
+
|
71
|
+
Le déploiement se fera depuis le répertoire contenant le code :
|
72
|
+
|
73
|
+
```
|
74
|
+
git clone git@github.com:AF83/projet.git
|
75
|
+
cd projet
|
76
|
+
```
|
77
|
+
|
78
|
+
La configuration spécifique pour l'environnement de production peut être
|
79
|
+
adaptée dans le fichier `config/deploy/prod.rb` (créez le fichier s'il
|
80
|
+
n'existe pas). Les principales variables peuvent être affichées avec `cap prod
|
81
|
+
info`.
|
82
|
+
|
83
|
+
Lors du premier déploiement, il convient de lancer `cap prod deploy:setup`.
|
84
|
+
Puis, chaque déploiement se fera en lançant `cap prod deploy`.
|
85
|
+
|
86
|
+
**Note** : il est recommandé de faire un git clone depuis le serveur avant le
|
87
|
+
premier déploiement pour éviter le message d'avertissement de ssh (connexion à
|
88
|
+
un hôte inconnu).
|
89
|
+
|
90
|
+
**Astuce** : il est possible de se connecter en ssh sur le serveur en faisant
|
91
|
+
`cap prod ssh`.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Grunt
|
2
|
+
|
3
|
+
[The JavaScript Task Runner](http://gruntjs.com/)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Version recommandé: 0.4
|
8
|
+
Il est supposé que nodejs est installé dans une version supérieure à 0.8
|
9
|
+
|
10
|
+
``` shell
|
11
|
+
npm install -g grunt-cli
|
12
|
+
```
|
13
|
+
|
14
|
+
## Modules projet
|
15
|
+
|
16
|
+
Pour installer les modules nécessaires au build d'un projet
|
17
|
+
|
18
|
+
``` shell
|
19
|
+
npm install .
|
20
|
+
```
|
21
|
+
|
22
|
+
## Utilisation
|
23
|
+
|
24
|
+
Pour connaitre la liste des taches disponibles
|
25
|
+
|
26
|
+
``` shell
|
27
|
+
grunt --help
|
28
|
+
```
|
29
|
+
|
30
|
+
Dans la plupart des cas, la tache par défaut permet de construire le projet
|
31
|
+
|
32
|
+
``` shell
|
33
|
+
grunt
|
34
|
+
```
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Ruby
|
2
|
+
|
3
|
+
## Install
|
4
|
+
|
5
|
+
Our recommandation is to use the most recent Ruby 1.9.3.
|
6
|
+
|
7
|
+
Debian doesn't provide official packages for Ruby 1.9.3, but it's possible to
|
8
|
+
use other sources for that. We trust Bearstech and use their debian packages.
|
9
|
+
You can use them for Ruby by creating a
|
10
|
+
`/etc/apt/sources.list.d/bearstech-ruby1.9.3.list` file with this line:
|
11
|
+
|
12
|
+
```
|
13
|
+
deb http://deb.bearstech.com/squeeze ruby-1.9.3/
|
14
|
+
```
|
15
|
+
|
16
|
+
Then, as root, you can launch the install with:
|
17
|
+
|
18
|
+
``` shell
|
19
|
+
aptitude update && aptitude install ruby1.9.3 ruby1.9.1-dev build-essential libxml2-dev libxslt1-dev libcurl4-gnutls-dev
|
20
|
+
```
|
21
|
+
|
22
|
+
|
23
|
+
## Configuration
|
24
|
+
|
25
|
+
First of all, you need to do some manual setup on the server, create a ruby-env
|
26
|
+
shell script with:
|
27
|
+
|
28
|
+
``` shell
|
29
|
+
cat > ~/ruby-env << EOF
|
30
|
+
#!/bin/sh
|
31
|
+
export GEM_HOME=~/gem
|
32
|
+
export PATH=~/bin:\$GEM_HOME/bin:\$PATH
|
33
|
+
if [ -z "\$LANG" ]; then
|
34
|
+
export LANG=en_US.UTF-8
|
35
|
+
fi
|
36
|
+
export RAILS_ENV=production
|
37
|
+
export RACK_ENV=production
|
38
|
+
EOF
|
39
|
+
```
|
40
|
+
|
41
|
+
A gemrc file:
|
42
|
+
|
43
|
+
``` shell
|
44
|
+
cat > ~/.gemrc << EOF
|
45
|
+
gem: --no-ri --no-rdoc
|
46
|
+
EOF
|
47
|
+
```
|
48
|
+
|
49
|
+
And source the ~/ruby-env file on top of bashrc.
|
50
|
+
|
51
|
+
|
52
|
+
## Gems
|
53
|
+
|
54
|
+
To manage our gems, we use a tool called Bundler. So, you can install them
|
55
|
+
by going in the application directory and taping this one-liner:
|
56
|
+
|
57
|
+
``` shell
|
58
|
+
gem install bundler && bundle install
|
59
|
+
```
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: documentator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- chatgris
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: boson
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: |-
|
28
|
+
documentator provides templates of documentations and
|
29
|
+
command-line utilities to add them to a project.
|
30
|
+
email:
|
31
|
+
- julien.boyer@af83.com
|
32
|
+
executables:
|
33
|
+
- documentator
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- LICENSE
|
38
|
+
- README.md
|
39
|
+
- bin/documentator
|
40
|
+
- lib/documentator.rb
|
41
|
+
- lib/documentator/bootstrap/Archi.ditaa
|
42
|
+
- lib/documentator/bootstrap/Archi.md
|
43
|
+
- lib/documentator/bootstrap/Dependencies.md
|
44
|
+
- lib/documentator/bootstrap/Deploy.md
|
45
|
+
- lib/documentator/bootstrap/Environments.md
|
46
|
+
- lib/documentator/bootstrap/Gemfile
|
47
|
+
- lib/documentator/templates/beanstalkd.md
|
48
|
+
- lib/documentator/templates/capistrano.md
|
49
|
+
- lib/documentator/templates/grunt.md
|
50
|
+
- lib/documentator/templates/nginx.md
|
51
|
+
- lib/documentator/templates/ruby.md
|
52
|
+
- lib/documentator/version.rb
|
53
|
+
homepage: https://github.com/AF83/documentator
|
54
|
+
licenses: []
|
55
|
+
metadata: {}
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 2.0.0
|
73
|
+
signing_key:
|
74
|
+
specification_version: 4
|
75
|
+
summary: Documents all the things
|
76
|
+
test_files: []
|