
@binout https://github.com/binout
Living Documentation : vous allez aimer la documentation !Cyril Martraire, BDX/IO 2015
Le code doit être la source de la documentation !
README
TUTORIAL
API REST
langage de balisage (aka Markdown mais en mieux )
toolchain pour convertir l’asciidoc en html, pdf, epub, …
include
pour du code= Tutorial
== Code examples
[source,java]
---
include:{basedir}/src/main/java/io/github/binout/Geek.java[]
---
La documentation présente le code à jour et sans erreur !
include
pour un morceau code= Tutorial
== Code examples
[source,java]
---
include:{basedir}/src/main/java/io/github/binout/Geek.java[tags=hype]
---
public class Geek {
String getName();
//tag::hype[]
Hype computeHype(int age, String language);
//end::hype[]
}
include
pour un morceau code= Tutorial
== Code examples
[source,java]
---
include:{basedir}/src/main/java/io/github/binout/Geek.java[tags=hype]
---
include
pour un fichier de test== Body
[source,asciidoc]
---
include:{basedir}/src/test/resources/io/github/binout/geek.json[]
---
{
"name" : "binout",
"language" : "java",
"hype" : 100
}
BDD (Behavior Driven Development)
Ajouter les dépendances cucumber :
info.cukes:cucumber-java
info.cukes:cucumber-junit
.feature
en Gherkin
Feature: Features of dropbox command line
Scenario: Command whoami
Given a dropbox api key
When i type "whoami"
Then it should return my name
Scenario: Command ls
Given a dropbox api key
When i type "ls"
Then it should return a list of path
@Given("^a dropbox api key$")
public void a_dropbox_api_key() throws Throwable {
assertThat(Dropbox.apiKey()).isNotNull();
}
@When("i type \"([^\"]*)\"")
public void i_type_a_command(String command) throws Throwable {
this.result = executeCommand(command);
}
@Then("^it should return my name$")
public void it_should_return_my_name() throws Throwable {
assertThat(result).contains("Benoît Prioux");
}
@Then("^it should return a list of path$")
public void it_should_return_a_list_of_path() throws Throwable {
Arrays.stream(result.split(System.lineSeparator())).forEach(p -> assertThat(p).startsWith("/"));
}
}
package io.github.binout.dropbox.bdd;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(strict=true, plugin = {"json:target/cucumber.json"} )
public class DropboxCliTest {
}
On doit retrouver le même vocabulaire dans le code !
@Glossary
/*
A peculiar person, especially one who is perceived to be overly intellectual, unfashionable, or socially awkward
*/
public class Geek {
....
}
L’architecte, c’est celui qui fait les diagrammes !
digraph mon_graphe {
a -> b -> c;
b -> d;
}
dot
@startdot
...
@enddot
Plugins Google Chrome et atom |
Peut permettre de visualiser les choix de design
/