bixbite 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. data/LICENSE +20 -0
  2. data/README.markdown +49 -0
  3. data/VERSION +1 -0
  4. data/bin/bixbite +73 -0
  5. data/lib/bixbite.rb +13 -0
  6. data/lib/bixbite/command.rb +14 -0
  7. data/lib/bixbite/create.rb +76 -0
  8. data/template/Rakefile +25 -0
  9. data/template/assets/bixbite/Rakefile.rb +297 -0
  10. data/template/assets/naturaldocs/NaturalDocs/Config/Languages.txt +286 -0
  11. data/template/assets/naturaldocs/NaturalDocs/Config/Topics.txt +382 -0
  12. data/template/assets/naturaldocs/NaturalDocs/Help/customizinglanguages.html +52 -0
  13. data/template/assets/naturaldocs/NaturalDocs/Help/customizingtopics.html +74 -0
  14. data/template/assets/naturaldocs/NaturalDocs/Help/documenting.html +58 -0
  15. data/template/assets/naturaldocs/NaturalDocs/Help/documenting/reference.html +146 -0
  16. data/template/assets/naturaldocs/NaturalDocs/Help/documenting/walkthrough.html +180 -0
  17. data/template/assets/naturaldocs/NaturalDocs/Help/example/Default.css +528 -0
  18. data/template/assets/naturaldocs/NaturalDocs/Help/example/NaturalDocs.js +204 -0
  19. data/template/assets/naturaldocs/NaturalDocs/Help/examples.css +90 -0
  20. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/background.png +0 -0
  21. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/leftside.png +0 -0
  22. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/logo.png +0 -0
  23. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbody.png +0 -0
  24. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbodybg.png +0 -0
  25. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overleftmargin.png +0 -0
  26. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenu.png +0 -0
  27. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenubg.png +0 -0
  28. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/rightside.png +0 -0
  29. data/template/assets/naturaldocs/NaturalDocs/Help/images/logo.gif +0 -0
  30. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/about.png +0 -0
  31. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/background.png +0 -0
  32. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomleft.png +0 -0
  33. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomright.png +0 -0
  34. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/community.png +0 -0
  35. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/customizing.png +0 -0
  36. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/using.png +0 -0
  37. data/template/assets/naturaldocs/NaturalDocs/Help/index.html +9 -0
  38. data/template/assets/naturaldocs/NaturalDocs/Help/javascript/BrowserStyles.js +77 -0
  39. data/template/assets/naturaldocs/NaturalDocs/Help/javascript/PNGHandling.js +72 -0
  40. data/template/assets/naturaldocs/NaturalDocs/Help/keywords.html +38 -0
  41. data/template/assets/naturaldocs/NaturalDocs/Help/languages.html +32 -0
  42. data/template/assets/naturaldocs/NaturalDocs/Help/menu.html +79 -0
  43. data/template/assets/naturaldocs/NaturalDocs/Help/output.html +84 -0
  44. data/template/assets/naturaldocs/NaturalDocs/Help/running.html +40 -0
  45. data/template/assets/naturaldocs/NaturalDocs/Help/styles.css +290 -0
  46. data/template/assets/naturaldocs/NaturalDocs/Help/styles.html +52 -0
  47. data/template/assets/naturaldocs/NaturalDocs/Help/troubleshooting.html +18 -0
  48. data/template/assets/naturaldocs/NaturalDocs/Info/CSSGuide.txt +947 -0
  49. data/template/assets/naturaldocs/NaturalDocs/Info/File Parsing.txt +83 -0
  50. data/template/assets/naturaldocs/NaturalDocs/Info/HTMLTestCases.pm +269 -0
  51. data/template/assets/naturaldocs/NaturalDocs/Info/Languages.txt +107 -0
  52. data/template/assets/naturaldocs/NaturalDocs/Info/NDMarkup.txt +91 -0
  53. data/template/assets/naturaldocs/NaturalDocs/Info/Symbol Management.txt +59 -0
  54. data/template/assets/naturaldocs/NaturalDocs/Info/images/Logo.png +0 -0
  55. data/template/assets/naturaldocs/NaturalDocs/JavaScript/NaturalDocs.js +836 -0
  56. data/template/assets/naturaldocs/NaturalDocs/License-GPL.txt +341 -0
  57. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/BinaryFile.pm +294 -0
  58. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder.pm +280 -0
  59. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/Base.pm +348 -0
  60. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/FramedHTML.pm +345 -0
  61. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTML.pm +398 -0
  62. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTMLBase.pm +3693 -0
  63. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy.pm +860 -0
  64. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/Class.pm +412 -0
  65. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/File.pm +157 -0
  66. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ConfigFile.pm +497 -0
  67. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Constants.pm +165 -0
  68. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/DefineMembers.pm +100 -0
  69. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Error.pm +305 -0
  70. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/File.pm +540 -0
  71. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable.pm +383 -0
  72. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/Reference.pm +44 -0
  73. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/String.pm +110 -0
  74. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages.pm +1475 -0
  75. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/ActionScript.pm +1473 -0
  76. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Ada.pm +38 -0
  77. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced.pm +828 -0
  78. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/Scope.pm +95 -0
  79. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm +70 -0
  80. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Base.pm +832 -0
  81. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/CSharp.pm +1484 -0
  82. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/PLSQL.pm +319 -0
  83. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Pascal.pm +143 -0
  84. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Perl.pm +1370 -0
  85. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype.pm +92 -0
  86. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype/Parameter.pm +87 -0
  87. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Simple.pm +503 -0
  88. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Tcl.pm +219 -0
  89. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu.pm +3406 -0
  90. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu/Entry.pm +201 -0
  91. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/NDMarkup.pm +76 -0
  92. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser.pm +1331 -0
  93. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/JavaDoc.pm +464 -0
  94. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/Native.pm +1060 -0
  95. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/ParsedTopic.pm +253 -0
  96. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project.pm +1402 -0
  97. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/ImageFile.pm +160 -0
  98. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/SourceFile.pm +113 -0
  99. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ReferenceString.pm +334 -0
  100. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings.pm +1418 -0
  101. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings/BuildTarget.pm +66 -0
  102. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB.pm +678 -0
  103. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Extension.pm +84 -0
  104. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/File.pm +129 -0
  105. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Item.pm +201 -0
  106. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/ItemDefinition.pm +45 -0
  107. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm +159 -0
  108. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/StatusMessage.pm +102 -0
  109. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolString.pm +212 -0
  110. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable.pm +1984 -0
  111. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/File.pm +186 -0
  112. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/IndexElement.pm +522 -0
  113. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Reference.pm +273 -0
  114. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm +97 -0
  115. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Symbol.pm +428 -0
  116. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm +96 -0
  117. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics.pm +1319 -0
  118. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics/Type.pm +151 -0
  119. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Version.pm +384 -0
  120. data/template/assets/naturaldocs/NaturalDocs/NaturalDocs +400 -0
  121. data/template/assets/naturaldocs/NaturalDocs/NaturalDocs.bat +17 -0
  122. data/template/assets/naturaldocs/NaturalDocs/Styles/Default.css +767 -0
  123. data/template/assets/naturaldocs/NaturalDocs/Styles/Roman.css +765 -0
  124. data/template/assets/naturaldocs/NaturalDocs/Styles/Small.css +763 -0
  125. data/template/assets/utilities/pngout +0 -0
  126. data/template/deploy/public_html/.htaccess +0 -0
  127. data/template/documentation/js/.htaccess +0 -0
  128. data/template/src/html/.htaccess +76 -0
  129. data/template/src/html/css/cmn/global.css +96 -0
  130. data/template/src/html/css/cmn/ie.css +15 -0
  131. data/template/src/html/css/cmn/ie6.css +15 -0
  132. data/template/src/html/images/cmn/.htaccess +0 -0
  133. data/template/src/html/images/tmp/.htaccess +0 -0
  134. data/template/src/html/includes/debug.inc +5 -0
  135. data/template/src/html/includes/footer.inc +52 -0
  136. data/template/src/html/includes/header.inc +61 -0
  137. data/template/src/html/includes/html.inc +3 -0
  138. data/template/src/html/includes/namespace.inc +19 -0
  139. data/template/src/html/includes/page.inc +151 -0
  140. data/template/src/html/index.html +35 -0
  141. data/template/src/html/js/cmn/bootstrap.js +74 -0
  142. data/template/src/html/js/cmn/global.js +142 -0
  143. data/template/src/html/js/cmn/lib/LAB.js +348 -0
  144. data/template/src/html/min/.htaccess +4 -0
  145. data/template/src/html/min/MinifyCLI.php +19 -0
  146. data/template/src/html/min/README.txt +132 -0
  147. data/template/src/html/min/builder/_index.js +242 -0
  148. data/template/src/html/min/builder/bm.js +36 -0
  149. data/template/src/html/min/builder/index.php +182 -0
  150. data/template/src/html/min/builder/ocCheck.php +36 -0
  151. data/template/src/html/min/builder/rewriteTest.js +1 -0
  152. data/template/src/html/min/config.php +187 -0
  153. data/template/src/html/min/groupsConfig.php +34 -0
  154. data/template/src/html/min/index.php +66 -0
  155. data/template/src/html/min/lib/FirePHP.php +1370 -0
  156. data/template/src/html/min/lib/HTTP/ConditionalGet.php +348 -0
  157. data/template/src/html/min/lib/HTTP/Encoder.php +326 -0
  158. data/template/src/html/min/lib/JSMin.php +314 -0
  159. data/template/src/html/min/lib/JSMinPlus.php +1872 -0
  160. data/template/src/html/min/lib/Minify.php +532 -0
  161. data/template/src/html/min/lib/Minify/Build.php +103 -0
  162. data/template/src/html/min/lib/Minify/CSS.php +83 -0
  163. data/template/src/html/min/lib/Minify/CSS/Compressor.php +250 -0
  164. data/template/src/html/min/lib/Minify/CSS/UriRewriter.php +270 -0
  165. data/template/src/html/min/lib/Minify/Cache/APC.php +130 -0
  166. data/template/src/html/min/lib/Minify/Cache/File.php +125 -0
  167. data/template/src/html/min/lib/Minify/Cache/Memcache.php +137 -0
  168. data/template/src/html/min/lib/Minify/ClosureCompiler.php +85 -0
  169. data/template/src/html/min/lib/Minify/CommentPreserver.php +90 -0
  170. data/template/src/html/min/lib/Minify/Controller/Base.php +202 -0
  171. data/template/src/html/min/lib/Minify/Controller/Files.php +78 -0
  172. data/template/src/html/min/lib/Minify/Controller/Groups.php +94 -0
  173. data/template/src/html/min/lib/Minify/Controller/MinApp.php +132 -0
  174. data/template/src/html/min/lib/Minify/Controller/Page.php +82 -0
  175. data/template/src/html/min/lib/Minify/Controller/Version1.php +118 -0
  176. data/template/src/html/min/lib/Minify/HTML.php +245 -0
  177. data/template/src/html/min/lib/Minify/ImportProcessor.php +157 -0
  178. data/template/src/html/min/lib/Minify/Lines.php +131 -0
  179. data/template/src/html/min/lib/Minify/Logger.php +45 -0
  180. data/template/src/html/min/lib/Minify/Packer.php +37 -0
  181. data/template/src/html/min/lib/Minify/Source.php +187 -0
  182. data/template/src/html/min/lib/Minify/YUICompressor.php +139 -0
  183. data/template/src/html/min/lib/Solar/Dir.php +199 -0
  184. data/template/src/html/min/lib/closure-compiler.jar +0 -0
  185. data/template/src/html/min/lib/yuicompressor-2.4.2.jar +0 -0
  186. data/template/src/html/min/utils.php +90 -0
  187. data/template/src/templates/css/template.css +7 -0
  188. data/template/src/templates/js/template.js +72 -0
  189. data/template/src/templates/template.html +18 -0
  190. data/template/src/yaml/config.yml +46 -0
  191. data/template/src/yaml/deploy.yml +35 -0
  192. data/test/bixbite_test.rb +7 -0
  193. data/test/test_helper.rb +10 -0
  194. metadata +278 -0
@@ -0,0 +1,280 @@
1
+ ###############################################################################
2
+ #
3
+ # Package: NaturalDocs::Builder
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A package that takes parsed source file and builds the output for it.
8
+ #
9
+ # Usage and Dependencies:
10
+ #
11
+ # - <Add()> can be called immediately.
12
+ # - <OutputPackages()> and <OutputPackageOf()> can be called once all sub-packages have been registered via <Add()>.
13
+ # Since this is normally done in their INIT functions, they should be available to all normal functions immediately.
14
+ #
15
+ # - Prior to calling <Run()>, <NaturalDocs::Settings>, <NaturalDocs::Project>, <NaturalDocs::Menu>, and
16
+ # <NaturalDocs::Parser> must be initialized. <NaturalDocs::Settings->GenerateDirectoryNames()> must be called.
17
+ # <NaturalDocs::SymbolTable> and <NaturalDocs::ClassHierarchy> must be initialized and fully resolved.
18
+ #
19
+ ###############################################################################
20
+
21
+ # This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
22
+ # Natural Docs is licensed under the GPL
23
+
24
+
25
+ use strict;
26
+ use integer;
27
+
28
+ use NaturalDocs::Builder::Base;
29
+ use NaturalDocs::Builder::HTML;
30
+ use NaturalDocs::Builder::FramedHTML;
31
+
32
+ package NaturalDocs::Builder;
33
+
34
+
35
+ ###############################################################################
36
+ # Group: Variables
37
+
38
+ #
39
+ # Array: outputPackages
40
+ #
41
+ # An array of the output packages available for use.
42
+ #
43
+ my @outputPackages;
44
+
45
+
46
+ ###############################################################################
47
+ # Group: Functions
48
+
49
+
50
+ #
51
+ # Function: OutputPackages
52
+ #
53
+ # Returns an arrayref of the output packages available for use. The arrayref is not a copy of the data, so don't change it.
54
+ #
55
+ # Add output packages to this list with the <Add()> function.
56
+ #
57
+ sub OutputPackages
58
+ { return \@outputPackages; };
59
+
60
+
61
+ #
62
+ # Function: OutputPackageOf
63
+ #
64
+ # Returns the output package corresponding to the passed command line option, or undef if none.
65
+ #
66
+ sub OutputPackageOf #(commandLineOption)
67
+ {
68
+ my ($self, $commandLineOption) = @_;
69
+
70
+ $commandLineOption = lc($commandLineOption);
71
+
72
+ foreach my $package (@outputPackages)
73
+ {
74
+ if (lc($package->CommandLineOption()) eq $commandLineOption)
75
+ { return $package; };
76
+ };
77
+
78
+ return undef;
79
+ };
80
+
81
+
82
+
83
+ #
84
+ # Function: Add
85
+ #
86
+ # Adds an output package to those available for use. All output packages must call this function in order to be recognized.
87
+ #
88
+ # Parameters:
89
+ #
90
+ # package - The package name.
91
+ #
92
+ sub Add #(package)
93
+ {
94
+ my ($self, $package) = @_;
95
+
96
+ # Output packages shouldn't register themselves more than once, so we don't need to check for it.
97
+ push @outputPackages, $package;
98
+ };
99
+
100
+
101
+ #
102
+ # Function: Run
103
+ #
104
+ # Runs the build process. This must be called *every time* Natural Docs is run, regardless of whether any source files changed
105
+ # or not. Some output packages have dependencies on files outside of the source tree that need to be checked.
106
+ #
107
+ # Since there are multiple stages to the build process, this function will handle its own status messages. There's no need to print
108
+ # "Building files..." or something similar beforehand.
109
+ #
110
+ sub Run
111
+ {
112
+ my ($self) = @_;
113
+
114
+
115
+ # Determine what we're doing.
116
+
117
+ my $buildTargets = NaturalDocs::Settings->BuildTargets();
118
+
119
+ my $filesToBuild = NaturalDocs::Project->FilesToBuild();
120
+ my $numberOfFilesToBuild = (scalar keys %$filesToBuild) * (scalar @$buildTargets);
121
+
122
+ my $filesToPurge = NaturalDocs::Project->FilesToPurge();
123
+ my $numberOfFilesToPurge = (scalar keys %$filesToPurge) * (scalar @$buildTargets);
124
+
125
+ my $imagesToUpdate = NaturalDocs::Project->ImageFilesToUpdate();
126
+ my $numberOfImagesToUpdate = (scalar keys %$imagesToUpdate) * (scalar @$buildTargets);
127
+
128
+ my $imagesToPurge = NaturalDocs::Project->ImageFilesToPurge();
129
+ my $numberOfImagesToPurge = (scalar keys %$imagesToPurge) * (scalar @$buildTargets);
130
+
131
+ my %indexesToBuild;
132
+ my %indexesToPurge;
133
+
134
+ my $currentIndexes = NaturalDocs::Menu->Indexes();
135
+ my $previousIndexes = NaturalDocs::Menu->PreviousIndexes();
136
+
137
+ foreach my $index (keys %$currentIndexes)
138
+ {
139
+ if (NaturalDocs::SymbolTable->IndexChanged($index) || !exists $previousIndexes->{$index})
140
+ {
141
+ $indexesToBuild{$index} = 1;
142
+ };
143
+ };
144
+
145
+ # All indexes that still exist should have been deleted.
146
+ foreach my $index (keys %$previousIndexes)
147
+ {
148
+ if (!exists $currentIndexes->{$index})
149
+ {
150
+ $indexesToPurge{$index} = 1;
151
+ };
152
+ };
153
+
154
+ my $numberOfIndexesToBuild = (scalar keys %indexesToBuild) * (scalar @$buildTargets);
155
+ my $numberOfIndexesToPurge = (scalar keys %indexesToPurge) * (scalar @$buildTargets);
156
+
157
+
158
+ # Start the build process
159
+
160
+ foreach my $buildTarget (@$buildTargets)
161
+ {
162
+ $buildTarget->Builder()->BeginBuild( $numberOfFilesToBuild || $numberOfFilesToPurge ||
163
+ $numberOfImagesToUpdate || $numberOfImagesToPurge ||
164
+ $numberOfIndexesToBuild || $numberOfIndexesToPurge ||
165
+ NaturalDocs::Menu->HasChanged() );
166
+ };
167
+
168
+ if ($numberOfFilesToPurge)
169
+ {
170
+ NaturalDocs::StatusMessage->Start('Purging ' . $numberOfFilesToPurge
171
+ . ' file' . ($numberOfFilesToPurge > 1 ? 's' : '') . '...',
172
+ scalar @$buildTargets);
173
+
174
+ foreach my $buildTarget (@$buildTargets)
175
+ {
176
+ $buildTarget->Builder()->PurgeFiles($filesToPurge);
177
+ NaturalDocs::StatusMessage->CompletedItem();
178
+ };
179
+ };
180
+
181
+ if ($numberOfIndexesToPurge)
182
+ {
183
+ NaturalDocs::StatusMessage->Start('Purging ' . $numberOfIndexesToPurge
184
+ . ' index' . ($numberOfIndexesToPurge > 1 ? 'es' : '') . '...',
185
+ scalar @$buildTargets);
186
+
187
+ foreach my $buildTarget (@$buildTargets)
188
+ {
189
+ $buildTarget->Builder()->PurgeIndexes(\%indexesToPurge);
190
+ NaturalDocs::StatusMessage->CompletedItem();
191
+ };
192
+ };
193
+
194
+ if ($numberOfImagesToPurge)
195
+ {
196
+ NaturalDocs::StatusMessage->Start('Purging ' . $numberOfImagesToPurge
197
+ . ' image' . ($numberOfImagesToPurge > 1 ? 's' : '') . '...',
198
+ scalar @$buildTargets);
199
+
200
+ foreach my $buildTarget (@$buildTargets)
201
+ {
202
+ $buildTarget->Builder()->PurgeImages($imagesToPurge);
203
+ NaturalDocs::StatusMessage->CompletedItem();
204
+ };
205
+ };
206
+
207
+ if ($numberOfFilesToBuild)
208
+ {
209
+ NaturalDocs::StatusMessage->Start('Building ' . $numberOfFilesToBuild
210
+ . ' file' . ($numberOfFilesToBuild > 1 ? 's' : '') . '...',
211
+ $numberOfFilesToBuild);
212
+
213
+ foreach my $file (keys %$filesToBuild)
214
+ {
215
+ my $parsedFile = NaturalDocs::Parser->ParseForBuild($file);
216
+
217
+ NaturalDocs::Error->OnStartBuilding($file);
218
+
219
+ foreach my $buildTarget (@$buildTargets)
220
+ {
221
+ $buildTarget->Builder()->BuildFile($file, $parsedFile);
222
+ NaturalDocs::StatusMessage->CompletedItem();
223
+ };
224
+
225
+ NaturalDocs::Error->OnEndBuilding($file);
226
+ };
227
+ };
228
+
229
+ if ($numberOfIndexesToBuild)
230
+ {
231
+ NaturalDocs::StatusMessage->Start('Building ' . $numberOfIndexesToBuild
232
+ . ' index' . ($numberOfIndexesToBuild > 1 ? 'es' : '') . '...',
233
+ $numberOfIndexesToBuild);
234
+
235
+ foreach my $index (keys %indexesToBuild)
236
+ {
237
+ foreach my $buildTarget (@$buildTargets)
238
+ {
239
+ $buildTarget->Builder()->BuildIndex($index);
240
+ NaturalDocs::StatusMessage->CompletedItem();
241
+ };
242
+ };
243
+ };
244
+
245
+ if ($numberOfImagesToUpdate)
246
+ {
247
+ NaturalDocs::StatusMessage->Start('Updating ' . $numberOfImagesToUpdate
248
+ . ' image' . ($numberOfImagesToUpdate > 1 ? 's' : '') . '...',
249
+ $numberOfImagesToUpdate);
250
+
251
+ foreach my $image (keys %$imagesToUpdate)
252
+ {
253
+ foreach my $buildTarget (@$buildTargets)
254
+ {
255
+ $buildTarget->Builder()->UpdateImage($image);
256
+ NaturalDocs::StatusMessage->CompletedItem();
257
+ };
258
+ };
259
+ };
260
+
261
+ if (NaturalDocs::Menu->HasChanged())
262
+ {
263
+ if (!NaturalDocs::Settings->IsQuiet())
264
+ { print "Updating menu...\n"; };
265
+
266
+ foreach my $buildTarget (@$buildTargets)
267
+ { $buildTarget->Builder()->UpdateMenu(); };
268
+ };
269
+
270
+ foreach my $buildTarget (@$buildTargets)
271
+ {
272
+ $buildTarget->Builder()->EndBuild($numberOfFilesToBuild || $numberOfFilesToPurge ||
273
+ $numberOfIndexesToBuild || $numberOfIndexesToPurge ||
274
+ $numberOfImagesToUpdate || $numberOfImagesToPurge ||
275
+ NaturalDocs::Menu->HasChanged());
276
+ };
277
+ };
278
+
279
+
280
+ 1;
@@ -0,0 +1,348 @@
1
+ ###############################################################################
2
+ #
3
+ # Class: NaturalDocs::Builder::Base
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A base class for all Builder output formats.
8
+ #
9
+ ###############################################################################
10
+
11
+ # This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
12
+ # Natural Docs is licensed under the GPL
13
+
14
+ use strict;
15
+ use integer;
16
+
17
+ package NaturalDocs::Builder::Base;
18
+
19
+
20
+ ###############################################################################
21
+ # Group: Notes
22
+
23
+
24
+ #
25
+ # Topic: Implementation
26
+ #
27
+ # Builder packages are implemented as blessed arrayrefs, not hashrefs. This is done for all objects in Natural Docs for
28
+ # efficiency reasons. You create members by defining constants via <NaturalDocs::DefineMembers> and using them as
29
+ # indexes into the array.
30
+ #
31
+
32
+ #
33
+ # Topic: Function Order
34
+ #
35
+ # The functions in the build process will always be called in the following order.
36
+ #
37
+ # - <BeginBuild()> will always be called.
38
+ # - <PurgeFiles()> will be called next only if there's files that need to be purged.
39
+ # - <PurgeIndexes()> will be called next only if there's indexes that need to be purged.
40
+ # - <PurgeImages()> will e called next only if there's images that need to be purged.
41
+ # - <BuildFile()> will be called once for each file that needs to be built, if any.
42
+ # - <BuildIndex()> will be called once for each index that changed and is part of the menu, if any.
43
+ # - <UpdateImage()> will be called once for each image that needs to be updated, if any.
44
+ # - <UpdateMenu()> will be called next only if the menu changed.
45
+ # - <EndBuild()> will always be called.
46
+ #
47
+
48
+ #
49
+ # Topic: How to Approach
50
+ #
51
+ # Here's an idea of how to approach making packages for different output types.
52
+ #
53
+ #
54
+ # Multiple Output Files, Embedded Menu:
55
+ #
56
+ # This example is for when you want to build one output file per source file, each with its own copy of the menu within it.
57
+ # This is how <NaturalDocs::Builder::HTML> works.
58
+ #
59
+ # Make sure you create a function that generates just the menu for a particular source file. We'll need to generate menus for
60
+ # both building a file from scratch and for updating the menu on an existing output file, so it's better to give it its own function.
61
+ # You may want to surround it with something that can be easily detected in the output file to make replacing easier.
62
+ #
63
+ # <BeginBuild()> isn't important. You don't need to implement it.
64
+ #
65
+ # Implement <PurgeFiles()> to delete the output files associated with the purged files.
66
+ #
67
+ # Implement <PurgeIndexes()> to delete the output files associated with the purged indexes.
68
+ #
69
+ # Implement <BuildFile()> to create an output file for the parsed source file. Use the menu function described earlier.
70
+ #
71
+ # Implement <BuildIndex()> to create an output file for each index. Use the menu function described earlier for each page.
72
+ #
73
+ # Implement <UpdateMenu()> to go through the list of unbuilt files and update their menus. You can get the list from
74
+ # <NaturalDocs::Project->UnbuiltFilesWithContent()>. You need to open their output files, replace the menu, and save it back
75
+ # to disk. Yes, it would be simpler from a programmer's point of view to just rebuild the file completely, but that would be
76
+ # _very_ inefficient since there could potentially be a _lot_ of files in this group.
77
+ #
78
+ # Also make sure <UpdateMenu()> goes through the unchanged indexes and updates them as well.
79
+ #
80
+ # <EndBuild()> isn't important. You don't need to implement it.
81
+ #
82
+ #
83
+ # Multiple Output Files, Menu in File:
84
+ #
85
+ # This example is for when you want to build one output file per source file, but keep the menu in its own separate file. This
86
+ # is how <NaturalDocs::Builder::FramedHTML> works.
87
+ #
88
+ # <BeginBuild()> isn't important. You don't need to implement it.
89
+ #
90
+ # Implement <PurgeFiles()> to delete the output files associated with the purged files.
91
+ #
92
+ # Implement <PurgeIndexes()> to delete the output files associated with the purged indexes.
93
+ #
94
+ # Implement <BuildFile()> to generate an output file from the parsed source file.
95
+ #
96
+ # Implement <BuildIndex()> to generate an output file for each index.
97
+ #
98
+ # Implement <UpdateMenu()> to rebuild the menu file.
99
+ #
100
+ # <EndBuild()> isn't important. You don't need to implement it.
101
+ #
102
+ #
103
+ # Single Output File using Intermediate Files:
104
+ #
105
+ # This example is for when you want to build one output file, such as a PDF file, but use intermediate files to handle differential
106
+ # building. This would be much like how a compiler compiles each source file into a object file, and then a linker stitches them
107
+ # all together into the final executable file.
108
+ #
109
+ # <BeginBuild()> isn't important. You don't need to implement it.
110
+ #
111
+ # Implement <PurgeFiles()> to delete the intermediate files associated with the purged files.
112
+ #
113
+ # Implement <PurgeIndexes()> to delete the intermediate files associated with the purged indexes.
114
+ #
115
+ # Implement <BuildFile()> to generate an intermediate file from the parsed source file.
116
+ #
117
+ # Implement <BuildIndex()> to generate an intermediate file for the specified index.
118
+ #
119
+ # Implement <UpdateMenu()> to generate the intermediate file for the menu.
120
+ #
121
+ # Implement <EndBuild()> so that if the project changed, it stitches the intermediate files together into the final
122
+ # output file. Make sure you check the parameter because the function will be called when nothing changes too.
123
+ #
124
+ #
125
+ # Single Output File using Direct Changes:
126
+ #
127
+ # This example is for when you want to build one output file, such as a PDF file, but engineering it in such a way that you don't
128
+ # need to use intermediate files. In other words, you're able to add, delete, and modify entries directly in the output file.
129
+ #
130
+ # Implement <BeginBuild()> so that if the project changed, it opens the output file and does anything it needs to do
131
+ # to get ready for editing.
132
+ #
133
+ # Implement <PurgeFiles()> to remove the entries associated with the purged files.
134
+ #
135
+ # Implement <PurgeIndexes()> to remove the entries associated with the purged indexes.
136
+ #
137
+ # Implement <BuildFile()> to add or replace a section of the output file with a new one generated from the parsed file.
138
+ #
139
+ # Implement <BuildIndex()> to add or replace an index in the output file with a new one generated from the specified index.
140
+ #
141
+ # Implement <EndBuild()> so that if the project changed, it saves the output file to disk.
142
+ #
143
+ # How you handle the menu depends on how the output file references other sections of itself. If it can do so by name, then
144
+ # you can implement <UpdateMenu()> to update the menu section of the file and you're done. If it has to reference itself
145
+ # by address or offset, it gets trickier. You should skip <UpdateMenu()> and instead rebuild the menu in <EndBuild()> if
146
+ # the parameter is true. This lets you do it whenever anything changes in a file, rather than just when the menu
147
+ # visibly changes. How you keep track of the locations and how they change is your problem.
148
+ #
149
+
150
+
151
+ ###############################################################################
152
+ #
153
+ # Group: Required Interface Functions
154
+ #
155
+ # All Builder classes *must* define these functions.
156
+ #
157
+
158
+
159
+ #
160
+ # Function: INIT
161
+ #
162
+ # Define this function to call <NaturalDocs::Builder->Add()> so that <NaturalDocs::Builder> knows about this package.
163
+ # Packages are defined this way so that new ones can be added without messing around in other code.
164
+ #
165
+
166
+
167
+ #
168
+ # Function: CommandLineOption
169
+ #
170
+ # Define this function to return the text that should be put in the command line after -o to use this package. It cannot have
171
+ # spaces and is not case sensitive.
172
+ #
173
+ # For example, <NaturalDocs::Builder::HTML> returns 'html' so someone could use -o html [directory] to use that package.
174
+ #
175
+ sub CommandLineOption
176
+ {
177
+ NaturalDocs::Error->SoftDeath($_[0] . " didn't define CommandLineOption().");
178
+ };
179
+
180
+
181
+ #
182
+ # Function: BuildFile
183
+ #
184
+ # Define this function to convert a parsed file to this package's output format. This function will be called once for every source
185
+ # file that needs to be rebuilt. However, if a file hasn't changed since the last time Natural Docs was run, it will not be sent to
186
+ # this function. All packages must support differential build.
187
+ #
188
+ # Parameters:
189
+ #
190
+ # sourceFile - The name of the source file.
191
+ # parsedFile - The parsed source file, as an arrayref of <NaturalDocs::Parser::ParsedTopic> objects.
192
+ #
193
+ sub BuildFile #(sourceFile, parsedFile)
194
+ {
195
+ NaturalDocs::Error->SoftDeath($_[0] . " didn't define BuildFile().");
196
+ };
197
+
198
+
199
+ ###############################################################################
200
+ #
201
+ # Group: Optional Interface Functions
202
+ #
203
+ # These functions can be implemented but packages are not required to do so.
204
+ #
205
+
206
+
207
+ #
208
+ # Function: New
209
+ #
210
+ # Creates and returns a new object.
211
+ #
212
+ # Note that this is the only function where the first parameter will be the package name, not the object itself.
213
+ #
214
+ sub New
215
+ {
216
+ my $package = shift;
217
+
218
+ my $object = [ ];
219
+ bless $object, $package;
220
+
221
+ return $object;
222
+ };
223
+
224
+
225
+ #
226
+ # Function: BeginBuild
227
+ #
228
+ # Define this function if the package needs to do anything at the beginning of the build process. This function will be called
229
+ # every time Natural Docs is run, even if the project hasn't changed. This allows you to manage dependencies specific
230
+ # to the output format that may change independently from the source tree and menu. For example,
231
+ # <NaturalDocs::Builder::HTML> needs to keep the CSS files in sync regardless of whether the source tree changed or not.
232
+ #
233
+ # Parameters:
234
+ #
235
+ # hasChanged - Whether the project has changed, such as source files or the menu file. If false, nothing else is going to be
236
+ # called except <EndBuild()>.
237
+ #
238
+ sub BeginBuild #(hasChanged)
239
+ {
240
+ };
241
+
242
+
243
+ #
244
+ # Function: EndBuild
245
+ #
246
+ # Define this function if the package needs to do anything at the end of the build process. This function will be called every time
247
+ # Natural Docs is run, even if the project hasn't changed. This allows you to manage dependencies specific to the output
248
+ # format that may change independently from the source tree. For example, <NaturalDocs::Builder::HTML> needs to keep the
249
+ # CSS files in sync regardless of whether the source tree changed or not.
250
+ #
251
+ # Parameters:
252
+ #
253
+ # hasChanged - Whether the project has changed, such as source files or the menu file. If false, the only other function that
254
+ # was called was <BeginBuild()>.
255
+ #
256
+ sub EndBuild #(hasChanged)
257
+ {
258
+ };
259
+
260
+
261
+ #
262
+ # Function: BuildIndex
263
+ #
264
+ # Define this function to create an index for the passed topic. You can get the index from
265
+ # <NaturalDocs::SymbolTable->Index()>.
266
+ #
267
+ # The reason it's not passed directly to this function is because indexes may be time-consuming to create. As such, they're
268
+ # generated on demand because some output packages may choose not to implement them.
269
+ #
270
+ # Parameters:
271
+ #
272
+ # topic - The <TopicType> to limit the index by.
273
+ #
274
+ sub BuildIndex #(topic)
275
+ {
276
+ };
277
+
278
+
279
+ #
280
+ # Function: UpdateImage
281
+ #
282
+ # Define this function to add or update the passed image in the output.
283
+ #
284
+ # Parameters:
285
+ #
286
+ # file - The image <FileName>
287
+ #
288
+ sub UpdateImage #(file)
289
+ {
290
+ };
291
+
292
+
293
+ #
294
+ # Function: PurgeFiles
295
+ #
296
+ # Define this function to make the package remove all output related to the passed files. These files no longer have Natural Docs
297
+ # content.
298
+ #
299
+ # Parameters:
300
+ #
301
+ # files - An existence hashref of the files to purge.
302
+ #
303
+ sub PurgeFiles #(files)
304
+ {
305
+ };
306
+
307
+
308
+ #
309
+ # Function: PurgeIndexes
310
+ #
311
+ # Define this function to make the package remove all output related to the passed indexes. These indexes are no longer part
312
+ # of the menu.
313
+ #
314
+ # Parameters:
315
+ #
316
+ # indexes - An existence hashref of the <TopicTypes> of the indexes to purge.
317
+ #
318
+ sub PurgeIndexes #(indexes)
319
+ {
320
+ };
321
+
322
+
323
+ #
324
+ # Function: PurgeImages
325
+ #
326
+ # Define this function to make the package remove all output related to the passed image files. These files are no longer used
327
+ # by the documentation.
328
+ #
329
+ # Parameters:
330
+ #
331
+ # files - An existence hashref of the image <FileNames> to purge.
332
+ #
333
+ sub PurgeImages #(files)
334
+ {
335
+ };
336
+
337
+
338
+ #
339
+ # Function: UpdateMenu
340
+ #
341
+ # Define this function to make the package update the menu. It will only be called if the menu changed.
342
+ #
343
+ sub UpdateMenu
344
+ {
345
+ };
346
+
347
+
348
+ 1;