bixbite 0.1.0
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.
- data/LICENSE +20 -0
- data/README.markdown +49 -0
- data/VERSION +1 -0
- data/bin/bixbite +73 -0
- data/lib/bixbite.rb +13 -0
- data/lib/bixbite/command.rb +14 -0
- data/lib/bixbite/create.rb +76 -0
- data/template/Rakefile +25 -0
- data/template/assets/bixbite/Rakefile.rb +297 -0
- data/template/assets/naturaldocs/NaturalDocs/Config/Languages.txt +286 -0
- data/template/assets/naturaldocs/NaturalDocs/Config/Topics.txt +382 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/customizinglanguages.html +52 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/customizingtopics.html +74 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting.html +58 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting/reference.html +146 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/documenting/walkthrough.html +180 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/example/Default.css +528 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/example/NaturalDocs.js +204 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/examples.css +90 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/background.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/leftside.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/logo.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbody.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbodybg.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overleftmargin.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenu.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenubg.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/header/rightside.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/logo.gif +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/about.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/background.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomleft.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomright.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/community.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/customizing.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/using.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/index.html +9 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/javascript/BrowserStyles.js +77 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/javascript/PNGHandling.js +72 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/keywords.html +38 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/languages.html +32 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/menu.html +79 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/output.html +84 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/running.html +40 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/styles.css +290 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/styles.html +52 -0
- data/template/assets/naturaldocs/NaturalDocs/Help/troubleshooting.html +18 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/CSSGuide.txt +947 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/File Parsing.txt +83 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/HTMLTestCases.pm +269 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/Languages.txt +107 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/NDMarkup.txt +91 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/Symbol Management.txt +59 -0
- data/template/assets/naturaldocs/NaturalDocs/Info/images/Logo.png +0 -0
- data/template/assets/naturaldocs/NaturalDocs/JavaScript/NaturalDocs.js +836 -0
- data/template/assets/naturaldocs/NaturalDocs/License-GPL.txt +341 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/BinaryFile.pm +294 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder.pm +280 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/Base.pm +348 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/FramedHTML.pm +345 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTML.pm +398 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTMLBase.pm +3693 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy.pm +860 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/Class.pm +412 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/File.pm +157 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ConfigFile.pm +497 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Constants.pm +165 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/DefineMembers.pm +100 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Error.pm +305 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/File.pm +540 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable.pm +383 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/Reference.pm +44 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/String.pm +110 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages.pm +1475 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/ActionScript.pm +1473 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Ada.pm +38 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced.pm +828 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/Scope.pm +95 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm +70 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Base.pm +832 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/CSharp.pm +1484 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/PLSQL.pm +319 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Pascal.pm +143 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Perl.pm +1370 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype.pm +92 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype/Parameter.pm +87 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Simple.pm +503 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Tcl.pm +219 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu.pm +3406 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu/Entry.pm +201 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/NDMarkup.pm +76 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser.pm +1331 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/JavaDoc.pm +464 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/Native.pm +1060 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/ParsedTopic.pm +253 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project.pm +1402 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/ImageFile.pm +160 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/SourceFile.pm +113 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ReferenceString.pm +334 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings.pm +1418 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings/BuildTarget.pm +66 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB.pm +678 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Extension.pm +84 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/File.pm +129 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Item.pm +201 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/ItemDefinition.pm +45 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm +159 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/StatusMessage.pm +102 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolString.pm +212 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable.pm +1984 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/File.pm +186 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/IndexElement.pm +522 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Reference.pm +273 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm +97 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Symbol.pm +428 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm +96 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics.pm +1319 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics/Type.pm +151 -0
- data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Version.pm +384 -0
- data/template/assets/naturaldocs/NaturalDocs/NaturalDocs +400 -0
- data/template/assets/naturaldocs/NaturalDocs/NaturalDocs.bat +17 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Default.css +767 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Roman.css +765 -0
- data/template/assets/naturaldocs/NaturalDocs/Styles/Small.css +763 -0
- data/template/assets/utilities/pngout +0 -0
- data/template/deploy/public_html/.htaccess +0 -0
- data/template/documentation/js/.htaccess +0 -0
- data/template/src/html/.htaccess +76 -0
- data/template/src/html/css/cmn/global.css +96 -0
- data/template/src/html/css/cmn/ie.css +15 -0
- data/template/src/html/css/cmn/ie6.css +15 -0
- data/template/src/html/images/cmn/.htaccess +0 -0
- data/template/src/html/images/tmp/.htaccess +0 -0
- data/template/src/html/includes/debug.inc +5 -0
- data/template/src/html/includes/footer.inc +52 -0
- data/template/src/html/includes/header.inc +61 -0
- data/template/src/html/includes/html.inc +3 -0
- data/template/src/html/includes/namespace.inc +19 -0
- data/template/src/html/includes/page.inc +151 -0
- data/template/src/html/index.html +35 -0
- data/template/src/html/js/cmn/bootstrap.js +74 -0
- data/template/src/html/js/cmn/global.js +142 -0
- data/template/src/html/js/cmn/lib/LAB.js +348 -0
- data/template/src/html/min/.htaccess +4 -0
- data/template/src/html/min/MinifyCLI.php +19 -0
- data/template/src/html/min/README.txt +132 -0
- data/template/src/html/min/builder/_index.js +242 -0
- data/template/src/html/min/builder/bm.js +36 -0
- data/template/src/html/min/builder/index.php +182 -0
- data/template/src/html/min/builder/ocCheck.php +36 -0
- data/template/src/html/min/builder/rewriteTest.js +1 -0
- data/template/src/html/min/config.php +187 -0
- data/template/src/html/min/groupsConfig.php +34 -0
- data/template/src/html/min/index.php +66 -0
- data/template/src/html/min/lib/FirePHP.php +1370 -0
- data/template/src/html/min/lib/HTTP/ConditionalGet.php +348 -0
- data/template/src/html/min/lib/HTTP/Encoder.php +326 -0
- data/template/src/html/min/lib/JSMin.php +314 -0
- data/template/src/html/min/lib/JSMinPlus.php +1872 -0
- data/template/src/html/min/lib/Minify.php +532 -0
- data/template/src/html/min/lib/Minify/Build.php +103 -0
- data/template/src/html/min/lib/Minify/CSS.php +83 -0
- data/template/src/html/min/lib/Minify/CSS/Compressor.php +250 -0
- data/template/src/html/min/lib/Minify/CSS/UriRewriter.php +270 -0
- data/template/src/html/min/lib/Minify/Cache/APC.php +130 -0
- data/template/src/html/min/lib/Minify/Cache/File.php +125 -0
- data/template/src/html/min/lib/Minify/Cache/Memcache.php +137 -0
- data/template/src/html/min/lib/Minify/ClosureCompiler.php +85 -0
- data/template/src/html/min/lib/Minify/CommentPreserver.php +90 -0
- data/template/src/html/min/lib/Minify/Controller/Base.php +202 -0
- data/template/src/html/min/lib/Minify/Controller/Files.php +78 -0
- data/template/src/html/min/lib/Minify/Controller/Groups.php +94 -0
- data/template/src/html/min/lib/Minify/Controller/MinApp.php +132 -0
- data/template/src/html/min/lib/Minify/Controller/Page.php +82 -0
- data/template/src/html/min/lib/Minify/Controller/Version1.php +118 -0
- data/template/src/html/min/lib/Minify/HTML.php +245 -0
- data/template/src/html/min/lib/Minify/ImportProcessor.php +157 -0
- data/template/src/html/min/lib/Minify/Lines.php +131 -0
- data/template/src/html/min/lib/Minify/Logger.php +45 -0
- data/template/src/html/min/lib/Minify/Packer.php +37 -0
- data/template/src/html/min/lib/Minify/Source.php +187 -0
- data/template/src/html/min/lib/Minify/YUICompressor.php +139 -0
- data/template/src/html/min/lib/Solar/Dir.php +199 -0
- data/template/src/html/min/lib/closure-compiler.jar +0 -0
- data/template/src/html/min/lib/yuicompressor-2.4.2.jar +0 -0
- data/template/src/html/min/utils.php +90 -0
- data/template/src/templates/css/template.css +7 -0
- data/template/src/templates/js/template.js +72 -0
- data/template/src/templates/template.html +18 -0
- data/template/src/yaml/config.yml +46 -0
- data/template/src/yaml/deploy.yml +35 -0
- data/test/bixbite_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +278 -0
@@ -0,0 +1,151 @@
|
|
1
|
+
###############################################################################
|
2
|
+
#
|
3
|
+
# Package: NaturalDocs::Topics::Type
|
4
|
+
#
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# A class storing information about a <TopicType>.
|
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
|
+
|
18
|
+
package NaturalDocs::Topics::Type;
|
19
|
+
|
20
|
+
use NaturalDocs::DefineMembers 'NAME', 'Name()',
|
21
|
+
'PLURAL_NAME', 'PluralName()', 'SetPluralName()',
|
22
|
+
'INDEX', 'Index()', 'SetIndex()',
|
23
|
+
'SCOPE', 'Scope()', 'SetScope()',
|
24
|
+
'PAGE_TITLE_IF_FIRST', 'PageTitleIfFirst()', 'SetPageTitleIfFirst()',
|
25
|
+
'BREAK_LISTS', 'BreakLists()', 'SetBreakLists()',
|
26
|
+
'CLASS_HIERARCHY', 'ClassHierarchy()', 'SetClassHierarchy()',
|
27
|
+
'CAN_GROUP_WITH';
|
28
|
+
|
29
|
+
# Dependency: New() depends on the order of these and that there are no parent classes.
|
30
|
+
|
31
|
+
use base 'Exporter';
|
32
|
+
our @EXPORT = ('SCOPE_NORMAL', 'SCOPE_START', 'SCOPE_END', 'SCOPE_ALWAYS_GLOBAL');
|
33
|
+
|
34
|
+
#
|
35
|
+
# Constants: Members
|
36
|
+
#
|
37
|
+
# The object is implemented as a blessed arrayref, with the following constants as its indexes.
|
38
|
+
#
|
39
|
+
# NAME - The topic's name.
|
40
|
+
# PLURAL_NAME - The topic's plural name.
|
41
|
+
# INDEX - Whether the topic is indexed.
|
42
|
+
# SCOPE - The topic's <ScopeType>.
|
43
|
+
# PAGE_TITLE_IF_FIRST - Whether the topic becomes the page title if it's first in a file.
|
44
|
+
# BREAK_LISTS - Whether list topics should be broken into individual topics in the output.
|
45
|
+
# CLASS_HIERARCHY - Whether the topic is part of the class hierarchy.
|
46
|
+
# CAN_GROUP_WITH - The existence hashref of <TopicTypes> the type can be grouped with.
|
47
|
+
#
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
###############################################################################
|
52
|
+
# Group: Types
|
53
|
+
|
54
|
+
|
55
|
+
#
|
56
|
+
# Constants: ScopeType
|
57
|
+
#
|
58
|
+
# The possible values for <Scope()>.
|
59
|
+
#
|
60
|
+
# SCOPE_NORMAL - The topic stays in the current scope without affecting it.
|
61
|
+
# SCOPE_START - The topic starts a scope.
|
62
|
+
# SCOPE_END - The topic ends a scope, returning it to global.
|
63
|
+
# SCOPE_ALWAYS_GLOBAL - The topic is always global, but it doesn't affect the current scope.
|
64
|
+
#
|
65
|
+
use constant SCOPE_NORMAL => 1;
|
66
|
+
use constant SCOPE_START => 2;
|
67
|
+
use constant SCOPE_END => 3;
|
68
|
+
use constant SCOPE_ALWAYS_GLOBAL => 4;
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
###############################################################################
|
73
|
+
# Group: Functions
|
74
|
+
|
75
|
+
|
76
|
+
#
|
77
|
+
# Function: New
|
78
|
+
#
|
79
|
+
# Creates and returns a new object.
|
80
|
+
#
|
81
|
+
# Parameters:
|
82
|
+
#
|
83
|
+
# name - The topic name.
|
84
|
+
# pluralName - The topic's plural name.
|
85
|
+
# index - Whether the topic is indexed.
|
86
|
+
# scope - The topic's <ScopeType>.
|
87
|
+
# pageTitleIfFirst - Whether the topic becomes the page title if it's the first one in a file.
|
88
|
+
# breakLists - Whether list topics should be broken into individual topics in the output.
|
89
|
+
#
|
90
|
+
sub New #(name, pluralName, index, scope, pageTitleIfFirst, breakLists)
|
91
|
+
{
|
92
|
+
my ($self, @params) = @_;
|
93
|
+
|
94
|
+
# Dependency: Depends on the parameter order matching the member order and that there are no parent classes.
|
95
|
+
|
96
|
+
my $object = [ @params ];
|
97
|
+
bless $object, $self;
|
98
|
+
|
99
|
+
return $object;
|
100
|
+
};
|
101
|
+
|
102
|
+
|
103
|
+
#
|
104
|
+
# Functions: Accessors
|
105
|
+
#
|
106
|
+
# Name - Returns the topic name.
|
107
|
+
# PluralName - Returns the topic's plural name.
|
108
|
+
# SetPluralName - Replaces the topic's plural name.
|
109
|
+
# Index - Whether the topic is indexed.
|
110
|
+
# SetIndex - Sets whether the topic is indexed.
|
111
|
+
# Scope - Returns the topic's <ScopeType>.
|
112
|
+
# SetScope - Replaces the topic's <ScopeType>.
|
113
|
+
# PageTitleIfFirst - Returns whether the topic becomes the page title if it's first in the file.
|
114
|
+
# SetPageTitleIfFirst - Sets whether the topic becomes the page title if it's first in the file.
|
115
|
+
# BreakLists - Returns whether list topics should be broken into individual topics in the output.
|
116
|
+
# SetBreakLists - Sets whether list topics should be broken into individual topics in the output.
|
117
|
+
# ClassHierarchy - Returns whether the topic is part of the class hierarchy.
|
118
|
+
# SetClassHierarchy - Sets whether the topic is part of the class hierarchy.
|
119
|
+
#
|
120
|
+
|
121
|
+
|
122
|
+
#
|
123
|
+
# Function: CanGroupWith
|
124
|
+
#
|
125
|
+
# Returns whether the type can be grouped with the passed <TopicType>.
|
126
|
+
#
|
127
|
+
sub CanGroupWith #(TopicType type) -> bool
|
128
|
+
{
|
129
|
+
my ($self, $type) = @_;
|
130
|
+
return ( defined $self->[CAN_GROUP_WITH] && exists $self->[CAN_GROUP_WITH]->{$type} );
|
131
|
+
};
|
132
|
+
|
133
|
+
|
134
|
+
#
|
135
|
+
# Function: SetCanGroupWith
|
136
|
+
#
|
137
|
+
# Sets the list of <TopicTypes> the type can be grouped with.
|
138
|
+
#
|
139
|
+
sub SetCanGroupWith #(TopicType[] types)
|
140
|
+
{
|
141
|
+
my ($self, $types) = @_;
|
142
|
+
|
143
|
+
$self->[CAN_GROUP_WITH] = { };
|
144
|
+
|
145
|
+
foreach my $type (@$types)
|
146
|
+
{ $self->[CAN_GROUP_WITH]->{$type} = 1; };
|
147
|
+
};
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
1;
|
@@ -0,0 +1,384 @@
|
|
1
|
+
###############################################################################
|
2
|
+
#
|
3
|
+
# Package: NaturalDocs::Version
|
4
|
+
#
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# A package for handling version information. What? That's right. Although it should be easy and obvious, version numbers
|
8
|
+
# need to be dealt with in a variety of formats, plus there's compatibility with older releases which handled it differently. I
|
9
|
+
# wanted to centralize the code after it started getting complicated. So there ya go.
|
10
|
+
#
|
11
|
+
###############################################################################
|
12
|
+
|
13
|
+
# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
|
14
|
+
# Natural Docs is licensed under the GPL
|
15
|
+
|
16
|
+
use strict;
|
17
|
+
use integer;
|
18
|
+
|
19
|
+
package NaturalDocs::Version;
|
20
|
+
|
21
|
+
|
22
|
+
###############################################################################
|
23
|
+
# Group: Functions
|
24
|
+
|
25
|
+
|
26
|
+
#
|
27
|
+
# Function: ToString
|
28
|
+
#
|
29
|
+
# Converts a <VersionInt> to a string.
|
30
|
+
#
|
31
|
+
sub ToString #(VersionInt version) => string
|
32
|
+
{
|
33
|
+
my ($self, $version) = @_;
|
34
|
+
|
35
|
+
my ($major, $minor, $month, $day, $year) = $self->ToValues($version);
|
36
|
+
|
37
|
+
if ($minor % 10 == 0)
|
38
|
+
{ $minor /= 10; };
|
39
|
+
|
40
|
+
if ($day)
|
41
|
+
{ return sprintf('Development Release %02d-%02d-%d (%d.%d base)', $month, $day, $year, $major, $minor); }
|
42
|
+
else
|
43
|
+
{ return $major . '.' . $minor; };
|
44
|
+
};
|
45
|
+
|
46
|
+
|
47
|
+
#
|
48
|
+
# Function: FromString
|
49
|
+
#
|
50
|
+
# Converts a version string to a <VersionInt>.
|
51
|
+
#
|
52
|
+
sub FromString #(string string) => VersionInt
|
53
|
+
{
|
54
|
+
my ($self, $string) = @_;
|
55
|
+
|
56
|
+
if ($string eq '1')
|
57
|
+
{
|
58
|
+
return $self->FromValues(0, 91, 0, 0, 0); # 0.91
|
59
|
+
}
|
60
|
+
else
|
61
|
+
{
|
62
|
+
my ($major, $minor, $month, $day, $year);
|
63
|
+
|
64
|
+
if ($string =~ /^(\d{1,2})\.(\d{1,2})$/)
|
65
|
+
{
|
66
|
+
($major, $minor) = ($1, $2);
|
67
|
+
($month, $day, $year) = (0, 0, 0);
|
68
|
+
}
|
69
|
+
elsif ($string =~ /^Development Release (\d{1,2})-(\d{1,2})-(\d\d\d\d) \((\d{1,2})\.(\d{1,2}) base\)$/)
|
70
|
+
{
|
71
|
+
($month, $day, $year, $major, $minor) = ($1, $2, $3, $4, $5);
|
72
|
+
|
73
|
+
# We have to do sanity checking because these can come from user-editable text files. The version numbers should
|
74
|
+
# already be constrained simply by being forced to have only two digits.
|
75
|
+
|
76
|
+
if ($month > 12 || $month < 1 || $day > 31 || $day < 1 || $year > 2255 || $year < 2000)
|
77
|
+
{ die 'The version string ' . $string . " doesn't have a valid date.\n"; };
|
78
|
+
}
|
79
|
+
else
|
80
|
+
{
|
81
|
+
die 'The version string ' . $string . " isn't in a recognized format.\n";
|
82
|
+
};
|
83
|
+
|
84
|
+
if (length $minor == 1)
|
85
|
+
{ $minor *= 10; };
|
86
|
+
|
87
|
+
return $self->FromValues($major, $minor, $month, $day, $year);
|
88
|
+
};
|
89
|
+
};
|
90
|
+
|
91
|
+
|
92
|
+
#
|
93
|
+
# Function: ToTextFile
|
94
|
+
#
|
95
|
+
# Writes a <VersionInt> to a text file.
|
96
|
+
#
|
97
|
+
# Parameters:
|
98
|
+
#
|
99
|
+
# fileHandle - The handle of the file to write it to. It should be at the correct location.
|
100
|
+
# version - The <VersionInt> to write.
|
101
|
+
#
|
102
|
+
sub ToTextFile #(handle fileHandle, VersionInt version)
|
103
|
+
{
|
104
|
+
my ($self, $fileHandle, $version) = @_;
|
105
|
+
|
106
|
+
print $fileHandle $self->ToString($version) . "\n";
|
107
|
+
};
|
108
|
+
|
109
|
+
|
110
|
+
#
|
111
|
+
# Function: FromTextFile
|
112
|
+
#
|
113
|
+
# Retrieves a <VersionInt> from a text file.
|
114
|
+
#
|
115
|
+
# Parameters:
|
116
|
+
#
|
117
|
+
# fileHandle - The handle of the file to read it from. It should be at the correct location.
|
118
|
+
#
|
119
|
+
# Returns:
|
120
|
+
#
|
121
|
+
# The <VersionInt>.
|
122
|
+
#
|
123
|
+
sub FromTextFile #(handle fileHandle) => VersionInt
|
124
|
+
{
|
125
|
+
my ($self, $fileHandle) = @_;
|
126
|
+
|
127
|
+
my $version = <$fileHandle>;
|
128
|
+
::XChomp(\$version);
|
129
|
+
|
130
|
+
return $self->FromString($version);
|
131
|
+
};
|
132
|
+
|
133
|
+
|
134
|
+
#
|
135
|
+
# Function: ToBinaryFile
|
136
|
+
#
|
137
|
+
# Writes a <VersionInt> to a binary file.
|
138
|
+
#
|
139
|
+
# Parameters:
|
140
|
+
#
|
141
|
+
# fileHandle - The handle of the file to write it to. It should be at the correct location.
|
142
|
+
# version - The <VersionInt> to write.
|
143
|
+
#
|
144
|
+
sub ToBinaryFile #(handle fileHandle, VersionInt version)
|
145
|
+
{
|
146
|
+
my ($self, $fileHandle, $version) = @_;
|
147
|
+
|
148
|
+
my ($major, $minor, $month, $day, $year) = $self->ToValues($version);
|
149
|
+
|
150
|
+
# 1.35 development releases are encoded as 1.36. Everything else is literal.
|
151
|
+
if ($day && $major == 1 && $minor == 35)
|
152
|
+
{ $minor = 36; };
|
153
|
+
|
154
|
+
print $fileHandle pack('CC', $major, $minor);
|
155
|
+
|
156
|
+
# Date fields didn't exist with 1.35 stable and earlier. 1.35 development releases are encoded as 1.36, so this works.
|
157
|
+
if ($major > 1 || ($major == 1 && $minor > 35))
|
158
|
+
{
|
159
|
+
if ($day)
|
160
|
+
{ $year -= 2000; };
|
161
|
+
|
162
|
+
print $fileHandle pack('CCC', $month, $day, $year);
|
163
|
+
};
|
164
|
+
};
|
165
|
+
|
166
|
+
|
167
|
+
#
|
168
|
+
# Function: FromBinaryFile
|
169
|
+
#
|
170
|
+
# Retrieves a <VersionInt> from a binary file.
|
171
|
+
#
|
172
|
+
# Parameters:
|
173
|
+
#
|
174
|
+
# fileHandle - The handle of the file to read it from. It should be at the correct location.
|
175
|
+
#
|
176
|
+
# Returns:
|
177
|
+
#
|
178
|
+
# The <VersionInt>.
|
179
|
+
#
|
180
|
+
sub FromBinaryFile #(handle fileHandle) => VersionInt
|
181
|
+
{
|
182
|
+
my ($self, $fileHandle) = @_;
|
183
|
+
|
184
|
+
my ($major, $minor, $month, $day, $year);
|
185
|
+
|
186
|
+
my $raw;
|
187
|
+
read($fileHandle, $raw, 2);
|
188
|
+
|
189
|
+
($major, $minor) = unpack('CC', $raw);
|
190
|
+
|
191
|
+
# 1.35 stable is the last release without the date fields. 1.35 development releases are encoded as 1.36, so this works.
|
192
|
+
if ($major > 1 || ($major == 1 && $minor > 35))
|
193
|
+
{
|
194
|
+
read($fileHandle, $raw, 3);
|
195
|
+
($month, $day, $year) = unpack('CCC', $raw);
|
196
|
+
|
197
|
+
if ($day)
|
198
|
+
{ $year += 2000; };
|
199
|
+
}
|
200
|
+
else
|
201
|
+
{ ($month, $day, $year) = (0, 0, 0); };
|
202
|
+
|
203
|
+
# Fix the 1.35 development release special encoding.
|
204
|
+
if ($major == 1 && $minor == 36)
|
205
|
+
{ $minor = 35; };
|
206
|
+
|
207
|
+
|
208
|
+
return $self->FromValues($major, $minor, $month, $day, $year);
|
209
|
+
};
|
210
|
+
|
211
|
+
|
212
|
+
#
|
213
|
+
# Function: ToValues
|
214
|
+
#
|
215
|
+
# Converts a <VersionInt> to the array ( major, minor, month, day, year ). The minor version will be in two digit form, so x.2
|
216
|
+
# will return 20. The date fields will be zero for stable releases.
|
217
|
+
#
|
218
|
+
sub ToValues #(VersionInt version) => ( int, int, int, int, int )
|
219
|
+
{
|
220
|
+
my ($self, $version) = @_;
|
221
|
+
|
222
|
+
my $major = ($version & 0x00003F80) >> 7;
|
223
|
+
my $minor = ($version & 0x0000007F);
|
224
|
+
my $month = ($version & 0x00780000) >> 19;
|
225
|
+
my $day = ($version & 0x0007C000) >> 14;
|
226
|
+
my $year = ($version & 0x7F800000) >> 23;
|
227
|
+
|
228
|
+
if ($year)
|
229
|
+
{ $year += 2000; };
|
230
|
+
|
231
|
+
return ( $major, $minor, $month, $day, $year );
|
232
|
+
};
|
233
|
+
|
234
|
+
|
235
|
+
#
|
236
|
+
# Function: FromValues
|
237
|
+
#
|
238
|
+
# Returns a <VersionInt> created from the passed values.
|
239
|
+
#
|
240
|
+
# Parameters:
|
241
|
+
#
|
242
|
+
# major - The major version number. For development releases, it should be the stable version it's based off of.
|
243
|
+
# minor - The minor version number. It should always be two digits, so x.2 should pass 20. For development
|
244
|
+
# releases, it should be the stable version it's based off of.
|
245
|
+
# month - The numeric month of the development release. For stable releases it should be zero.
|
246
|
+
# day - The day of the development release. For stable releases it should be zero.
|
247
|
+
# year - The year of the development release. For stable releases it should be zero.
|
248
|
+
#
|
249
|
+
# Returns:
|
250
|
+
#
|
251
|
+
# The <VersionInt>.
|
252
|
+
#
|
253
|
+
sub FromValues #(int major, int minor, int month, int day, int year) => VersionInt
|
254
|
+
{
|
255
|
+
my ($self, $major, $minor, $month, $day, $year) = @_;
|
256
|
+
|
257
|
+
if ($day)
|
258
|
+
{ $year -= 2000; };
|
259
|
+
|
260
|
+
return ($major << 7) + ($minor) + ($month << 19) + ($day << 14) + ($year << 23);
|
261
|
+
};
|
262
|
+
|
263
|
+
|
264
|
+
#
|
265
|
+
# Function: CheckFileFormat
|
266
|
+
#
|
267
|
+
# Checks if a file's format is compatible with the current release.
|
268
|
+
#
|
269
|
+
# - If the application is a development release or the file is from one, this only returns true if they are from the exact same
|
270
|
+
# development release.
|
271
|
+
# - If neither of them are development releases, this only returns true if the file is from a release between the minimum specified
|
272
|
+
# and the current version. If there's no minimum it just checks that it's below the current version.
|
273
|
+
#
|
274
|
+
# Parameters:
|
275
|
+
#
|
276
|
+
# fileVersion - The <VersionInt> of the file format.
|
277
|
+
# minimumVersion - The minimum <VersionInt> required of the file format. May be undef.
|
278
|
+
#
|
279
|
+
# Returns:
|
280
|
+
#
|
281
|
+
# Whether the file's format is compatible per the above rules.
|
282
|
+
#
|
283
|
+
sub CheckFileFormat #(VersionInt fileVersion, optional VersionInt minimumVersion) => bool
|
284
|
+
{
|
285
|
+
my ($self, $fileVersion, $minimumVersion) = @_;
|
286
|
+
|
287
|
+
my $appVersion = NaturalDocs::Settings->AppVersion();
|
288
|
+
|
289
|
+
if ($self->IsDevelopmentRelease($appVersion) || $self->IsDevelopmentRelease($fileVersion))
|
290
|
+
{ return ($appVersion == $fileVersion); }
|
291
|
+
elsif ($minimumVersion && $fileVersion < $minimumVersion)
|
292
|
+
{ return 0; }
|
293
|
+
else
|
294
|
+
{ return ($fileVersion <= $appVersion); };
|
295
|
+
};
|
296
|
+
|
297
|
+
|
298
|
+
#
|
299
|
+
# Function: IsDevelopmentRelease
|
300
|
+
#
|
301
|
+
# Returns whether the passed <VersionInt> is for a development release.
|
302
|
+
#
|
303
|
+
sub IsDevelopmentRelease #(VersionInt version) => bool
|
304
|
+
{
|
305
|
+
my ($self, $version) = @_;
|
306
|
+
|
307
|
+
# Return if any of the date fields are set.
|
308
|
+
return ($version & 0x7FFFC000);
|
309
|
+
};
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
###############################################################################
|
314
|
+
# Group: Implementation
|
315
|
+
|
316
|
+
#
|
317
|
+
# About: String Format
|
318
|
+
#
|
319
|
+
# Full Releases:
|
320
|
+
#
|
321
|
+
# Full releases are in the common major.minor format. Either part can be up to two digits. The minor version is interpreted
|
322
|
+
# as decimal places, so 1.3 > 1.22. There are no leading or trailing zeroes.
|
323
|
+
#
|
324
|
+
# Development Releases:
|
325
|
+
#
|
326
|
+
# Development releases are in the format "Development Release mm-dd-yyyy (vv.vv base)" where vv.vv is the version
|
327
|
+
# number of the full release it's based off of. The month and day will have leading zeroes where applicable. Example:
|
328
|
+
# "Development Release 07-09-2006 (1.35 base)".
|
329
|
+
#
|
330
|
+
# 0.91 and Earlier:
|
331
|
+
#
|
332
|
+
# Text files from releases prior to 0.95 had a separate file format version number that was used instead of the application
|
333
|
+
# version. These were never changed between 0.85 and 0.91, so they are simply "1". Text version numbers that are "1"
|
334
|
+
# instead of "1.0" will be interpreted as 0.91.
|
335
|
+
#
|
336
|
+
|
337
|
+
#
|
338
|
+
# About: Integer Format
|
339
|
+
#
|
340
|
+
# <VersionInts> are 32-bit values with the bit distribution below.
|
341
|
+
#
|
342
|
+
# > s yyyyyyyy mmmm ddddd vvvvvvv xxxxxxx
|
343
|
+
# > [syyy|yyyy] [ymmm|mddd] [ddvv|vvvv] [vxxx|xxxx]
|
344
|
+
#
|
345
|
+
# s - The sign bit. Always zero, so it's always interpreted as positive.
|
346
|
+
# y - The year bits if it's a development release, zero otherwise. 2000 is added to the value, so the range is from 2000 to 2255.
|
347
|
+
# m - The month bits if it's a development release, zero otherwise.
|
348
|
+
# d - The day bits if it's a development release, zero otherwise.
|
349
|
+
# v - The major version bits. For development releases, it's the last stable version it was based off of.
|
350
|
+
# x - The minor version bits. It's always stored as two decimals, so x.2 would store 20 here. For development releases, it's the
|
351
|
+
# last stable version it was based off of.
|
352
|
+
#
|
353
|
+
# It's stored with the development release date at a higher significance than the version because we want a stable release to
|
354
|
+
# always treat a development release as higher than itself, and thus not attempt to read any of the data files. I'm not tracking
|
355
|
+
# data file formats at the development release level.
|
356
|
+
#
|
357
|
+
|
358
|
+
#
|
359
|
+
# About: Binary File Format
|
360
|
+
#
|
361
|
+
# Current:
|
362
|
+
#
|
363
|
+
# Five 8-bit unsigned values, appearing major, minor, month, day, year. Minor is always stored with two digits, so x.2 would
|
364
|
+
# store 20. Year is stored minus 2000, so 2006 is stored 6. Stable releases store zero for all the date fields.
|
365
|
+
#
|
366
|
+
# 1.35 Development Releases:
|
367
|
+
#
|
368
|
+
# 1.35-based development releases are stored the same as current releases, but with 1.36 as the version number. This is
|
369
|
+
# done so previous versions of Natural Docs that didn't include the date fields would still know it's a higher version. There is
|
370
|
+
# no actual 1.36 release.
|
371
|
+
#
|
372
|
+
# 1.35 and Earlier:
|
373
|
+
#
|
374
|
+
# Two 8-bit unsigned values, appearing major then minor. Minor is always stored with two digits, so x.2 would store 20.
|
375
|
+
#
|
376
|
+
|
377
|
+
#
|
378
|
+
# About: Text File Format
|
379
|
+
#
|
380
|
+
# In text files, versions are the <String Format> followed by a native line break.
|
381
|
+
#
|
382
|
+
|
383
|
+
|
384
|
+
1;
|