1: <?php
2: /**
3: * LICENSE (BSD)
4: *
5: * Copyright (c) 2013, Gerd Christian Kunze
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions are
10: * met:
11: *
12: * * Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: *
15: * * Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: *
19: * * Neither the name of Gerd Christian Kunze nor the names of the
20: * contributors may be used to endorse or promote products derived from
21: * this software without specific prior written permission.
22: *
23: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
24: * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25: * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34: *
35: * Documentation
36: * 10.06.2013 14:56
37: */
38: namespace MOC\Plugin\Repository;
39: use MOC\Api;
40: use Nette\Config\Adapters\NeonAdapter;
41:
42: /**
43: *
44: */
45: class Documentation extends \MOC\Plugin\Gateway\Documentation {
46:
47: /**
48: * @return bool
49: */
50: public function PluginCapable() {
51: return true;
52: }
53:
54: public function CreateApiDoc() {
55:
56: $this->DocSource( Api::Module()->Drive()->Directory()->Open( __DIR__.'/../../' ) );
57: $this->DocDestination( Api::Module()->Drive()->Directory()->Open( __DIR__.'/Documentation/Content' ) );
58: require_once( __DIR__.'/Documentation/3rdParty/libs/Nette/Nette/loader.php' );
59:
60: set_time_limit(120);
61:
62: $Configuration = Api::Module()->Drive()->File()->Open( __DIR__.'/Documentation/Config.neon' );
63:
64: $Config = array(
65: // Source file or directory to parse
66: 'source' => $this->DocSource()->GetLocation(),
67: // Directory where to save the generated documentation
68: 'destination' => $this->DocDestination()->GetLocation(),
69: // List of allowed file extensions
70: 'extensions' => array( 'php' ),
71: // Mask to exclude file or directory from processing
72: 'exclude' => '*/Documentation/Content/*,*/.idea/*,*/.git/*,*/#Trash/*,*/Data/*,*/Library/*,*/3rdParty/*',
73: // Don't generate documentation for classes from file or directory with this mask
74: //'skipDocPath' => '',
75: // Don't generate documentation for classes with this name prefix
76: //'skipDocPrefix' => '',
77: // Character set of source files
78: 'charset' => 'auto',
79: // Main project name prefix
80: 'main' => 'MOC',
81: // Title of generated documentation
82: 'title' => '',
83: // Documentation base URL
84: //'baseUrl' => '',
85: // Google Custom Search ID
86: //'googleCseId' => '',
87: // Google Custom Search label
88: //'googleCseLabel' => '',
89: // Google Analytics tracking code
90: //'googleAnalytics' => '',
91: // Template config file
92: //'templateConfig' => './templates/default/config.neon',
93: // Grouping of classes
94: 'groups' => 'auto',
95: // List of allowed HTML tags in documentation
96: 'allowedHtml' => array( 'b', 'i', 'a', 'ul', 'ol', 'li', 'p', 'br', 'var', 'samp', 'kbd', 'tt' ),
97: // Element types for search input autocomplete
98: 'autocomplete' => array( 'classes', 'constants', 'functions' ),
99: // Generate documentation for methods and properties with given access level
100: 'accessLevels' => array( 'public', 'protected', 'private' ),
101: // Generate documentation for elements marked as internal and display internal documentation parts
102: 'internal' => true,
103: // Generate documentation for PHP internal classes
104: 'php' => true,
105: // Generate tree view of classes, interfaces and exceptions
106: 'tree' => true,
107: // Generate documentation for deprecated classes, methods, properties and constants
108: 'deprecated' => true,
109: // Generate documentation of tasks
110: 'todo' => true,
111: // Generate highlighted source code files
112: 'sourceCode' => true,
113: // Add a link to download documentation as a ZIP archive
114: 'download' => true,
115: // Save a checkstyle report of poorly documented elements into a file
116: 'report' => '',
117: // Wipe out the destination directory first
118: 'wipeout' => true,
119: // Don't display scanning and generating messages
120: 'quiet' => true,
121: // Display progressbars
122: 'progressbar' => false,
123: // Use colors
124: 'colors' => false,
125: // Check for update
126: 'updateCheck' => false,
127: // Display additional information in case of an error
128: 'debug' => false
129: );
130:
131: $Neon = new NeonAdapter();
132:
133: $Configuration->Write( $Neon->dump( $Config ) );
134:
135: $_SERVER['argv'] = array(
136: 'DUMMY-SHELL-ARGS',
137: '--config', $Configuration->GetLocation()
138: );
139:
140: include( __DIR__.'/Documentation/3rdParty/apigen.php' );
141: }
142:
143: }
144: