-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d012a66
Showing
48 changed files
with
6,987 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
composer.lock | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Copyright 2016 Marcel Pociot | ||
Copyright 2008-2013 Concur Technologies, Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
not use this file except in compliance with the License. You may obtain | ||
a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
License for the specific language governing permissions and limitations | ||
under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Documentarian | ||
#### Simply write beautiful API documentation. | ||
======== | ||
|
||
This project started as a fork of the popular [Slate](https://github.com/tripit/slate) API documentation tool, which uses ruby. Since I found the initial setup of Slate quite cumbersome, I started this NodeJS based project. | ||
|
||
<a href="http://www.marcelpociot.com/whiteboard/"><img src="http://www.marcelpociot.com/git/whiteboard_responsive.jpg" style="width: 100%" alt="Whiteboard" /></a> | ||
|
||
Check out a Whiteboard [example API documentation](http://www.marcelpociot.com/whiteboard/). | ||
|
||
## Getting Started with Whiteboard | ||
|
||
### Prerequisites | ||
|
||
You're going to need: | ||
|
||
- **[Node JS](https://nodejs.org/en/)** | ||
|
||
_Yes, that's it!_ | ||
|
||
### Getting Set Up | ||
|
||
1. Clone this repository to your hard drive with `git clone https://github.com/mpociot/whiteboard.git` | ||
2. `cd whiteboard` | ||
3. Install the dependencies: `npm install` | ||
4. Start the test server: `npm start` | ||
|
||
Now go ahead and visit <http://localhost:4000> and you will be presented with a beautiful example API documentation as a starting point. | ||
|
||
Go ahead and modify the markdown file at `source/index.md` to suit your needs. | ||
|
||
### Publishing your API documentation | ||
|
||
The easiest way to publish your API documentation is using this command within your `whiteboard` directory: | ||
|
||
`npm run-script generate` | ||
|
||
This will generate a `public` folder which you can upload anywhere you want. | ||
|
||
> **Windows users:** You need to install the global `hexo-cli` package using `npm install -g hexo-cli`. To publish your API documentation under windows use `hexo generate`. | ||
If you want other (more automated) deployment options like **git**, **heroku**, **rsync** or **ftp** - please take a look at the [Hexo deployment documentation](https://hexo.io/docs/deployment.html). | ||
|
||
### Generate the documentation programmatically | ||
|
||
To generate the API documentation programmatically, for example in your automated build process, use the whiteboard module. | ||
The `generate` method will return a promise. | ||
|
||
```js | ||
var Whiteboard = require('whiteboard'); | ||
Whiteboard.generate() | ||
.then(function(){ | ||
// Generation was successful | ||
}) | ||
.catch(function(){ | ||
// Handle error | ||
}) | ||
``` | ||
|
||
### Slate compatibility | ||
Since both Whiteboard and Slate use regular markdown files to render the API documentation, your existing Slate API documentation should work just fine. If you encounter any issues, please [submit an issue](https://github.com/mpociot/whiteboard/issues). | ||
|
||
### In depth documentation | ||
For further documentation, read the [Slate Wiki](https://github.com/tripit/slate/wiki) or the [hexo documentation](https://hexo.io/docs/). | ||
|
||
### Documentations built with Whiteboard | ||
|
||
* [DISTRIBUTOR API Documentation](https://wifidistribution.com/docs) from [wifidistribution.com](https://wifidistribution.com) | ||
* [CommoPrices API Documentation](https://api.commoprices.com/docs/) from [commoprices.com](https://commoprices.com/) | ||
* [TradeIt JSON API](https://www.trade.it/documentation/api) from [trade.it](https://www.trade.it/) | ||
|
||
Feel free to submit a PR with a link to your documentation. | ||
|
||
### Contributors | ||
|
||
Slate was built by [Robert Lord](https://lord.io) while at [TripIt](http://tripit.com). | ||
|
||
Whiteboard was built by Marcel Pociot. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "mpociot/documentarian", | ||
"description": "", | ||
"keywords": [], | ||
"license": "Apache 2", | ||
"authors": [ | ||
{ | ||
"name": "Marcel Pociot", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"files": [ | ||
"includes/helpers.php" | ||
], | ||
"psr-4": { | ||
"Mpociot\\Documentarian\\": "src/" | ||
} | ||
}, | ||
"bin": [ | ||
"documentarian" | ||
], | ||
"require": { | ||
"php": ">=5.5.9", | ||
"mnapoli/silly": "~1.0", | ||
"illuminate/view": "^5.2", | ||
"mnapoli/front-yaml": "^1.5", | ||
"windwalker/renderer": "2.*" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^5.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
/** | ||
* Load correct autoloader depending on install location. | ||
*/ | ||
if (file_exists(__DIR__ . '/vendor/autoload.php')) { | ||
require __DIR__ . '/vendor/autoload.php'; | ||
} else { | ||
require __DIR__ . '/../../autoload.php'; | ||
} | ||
|
||
use Mpociot\Documentarian\Documentarian; | ||
use Silly\Application; | ||
|
||
$documentarian = new Documentarian(); | ||
|
||
$app = new Application('Documentarian', 'v0.1.0'); | ||
|
||
$app->command('create [folder]', function ($folder) use ($documentarian) { | ||
$folder = getcwd() . '/' . $folder; | ||
$documentarian->create($folder); | ||
$documentarian->generate($folder); | ||
info('Created documentation in folder: ' . $folder); | ||
})->defaults([ | ||
'folder' => '', | ||
]);; | ||
|
||
$app->command('generate', function () use ($documentarian) { | ||
if (!is_dir(getcwd() . '/source')) { | ||
output('<fg=red>Documentarian is not installed in the current folder.</>'); | ||
output('<fg=red>Use `documentarian create` to initiate a new API documentation.</>'); | ||
} else { | ||
$documentarian->generate(getcwd()); | ||
info('Generated documentation.'); | ||
} | ||
}); | ||
|
||
$app->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
/** | ||
* Output the given text to the console. | ||
* | ||
* @param string $output | ||
* @return void | ||
*/ | ||
function info($output) | ||
{ | ||
output('<info>' . $output . '</info>'); | ||
} | ||
|
||
/** | ||
* Output the given text to the console. | ||
* | ||
* @param string $output | ||
* @return void | ||
*/ | ||
function output($output) | ||
{ | ||
if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'testing') { | ||
return; | ||
} | ||
(new Symfony\Component\Console\Output\ConsoleOutput)->writeln($output); | ||
} | ||
|
||
/** | ||
* Recursively copy files from one directory to another | ||
* | ||
* @param String $src - Source of files being moved | ||
* @param String $dest - Destination of files being moved | ||
* @return bool | ||
*/ | ||
function rcopy($src, $dest) | ||
{ | ||
|
||
// If source is not a directory stop processing | ||
if (!is_dir($src)) return false; | ||
|
||
// If the destination directory does not exist create it | ||
if (!is_dir($dest)) { | ||
if (!mkdir($dest)) { | ||
// If the destination directory could not be created stop processing | ||
return false; | ||
} | ||
} | ||
|
||
// Open the source directory to read in files | ||
$i = new DirectoryIterator($src); | ||
foreach ($i as $f) { | ||
if ($f->isFile()) { | ||
copy($f->getRealPath(), "$dest/" . $f->getFilename()); | ||
} else if (!$f->isDot() && $f->isDir()) { | ||
rcopy($f->getRealPath(), "$dest/$f"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Documentarian Test Suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.