bixbite 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,66 @@
|
|
1
|
+
###############################################################################
|
2
|
+
#
|
3
|
+
# Class: NaturalDocs::Settings::BuildTarget
|
4
|
+
#
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# A class that stores information about a build target.
|
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::Settings::BuildTarget;
|
18
|
+
|
19
|
+
use NaturalDocs::DefineMembers 'BUILDER', 'Builder()', 'SetBuilder()',
|
20
|
+
'DIRECTORY', 'Directory()', 'SetDirectory()';
|
21
|
+
|
22
|
+
|
23
|
+
#
|
24
|
+
# Constants: Members
|
25
|
+
#
|
26
|
+
# The class is implemented as a blessed arrayref with the members below.
|
27
|
+
#
|
28
|
+
# BUILDER - The <NaturalDocs::Builder::Base>-derived object for the target's output format.
|
29
|
+
# DIRECTORY - The output directory of the target.
|
30
|
+
#
|
31
|
+
|
32
|
+
#
|
33
|
+
# Function: New
|
34
|
+
#
|
35
|
+
# Creates and returns a new object.
|
36
|
+
#
|
37
|
+
# Parameters:
|
38
|
+
#
|
39
|
+
# builder - The <NaturalDocs::Builder::Base>-derived object for the target's output format.
|
40
|
+
# directory - The directory to place the output files in.
|
41
|
+
#
|
42
|
+
sub New #(builder, directory)
|
43
|
+
{
|
44
|
+
my ($package, $builder, $directory) = @_;
|
45
|
+
|
46
|
+
my $object = [ ];
|
47
|
+
bless $object, $package;
|
48
|
+
|
49
|
+
$object->SetBuilder($builder);
|
50
|
+
$object->SetDirectory($directory);
|
51
|
+
|
52
|
+
return $object;
|
53
|
+
};
|
54
|
+
|
55
|
+
|
56
|
+
#
|
57
|
+
# Functions: Member Functions
|
58
|
+
#
|
59
|
+
# Builder - Returns the <NaturalDocs::Builder::Base>-derived object for the target's output format.
|
60
|
+
# SetBuilder - Replaces the <NaturalDocs::Builder::Base>-derived object for the target's output format.
|
61
|
+
# Directory - Returns the directory for the target's output files.
|
62
|
+
# SetDirectory - Replaces the directory for the target's output files.
|
63
|
+
#
|
64
|
+
|
65
|
+
|
66
|
+
1;
|
@@ -0,0 +1,678 @@
|
|
1
|
+
###############################################################################
|
2
|
+
#
|
3
|
+
# Package: NaturalDocs::SourceDB
|
4
|
+
#
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# SourceDB is an experimental package meant to unify the tracking of various elements in the source code.
|
8
|
+
#
|
9
|
+
# Requirements:
|
10
|
+
#
|
11
|
+
# - All extension packages must call <RegisterExtension()> before they can be used.
|
12
|
+
#
|
13
|
+
#
|
14
|
+
# Architecture: The Idea
|
15
|
+
#
|
16
|
+
# For quite a while Natural Docs only needed <SymbolTable>. However, 1.3 introduced the <ClassHierarchy> package
|
17
|
+
# which duplicated some of its functionality to track classes and parent references. 1.4 now needs <ImageReferenceTable>,
|
18
|
+
# so this package was an attempt to isolate the common functionality so the wheel doesn't have to keep being rewritten as
|
19
|
+
# the scope of Natural Docs expands.
|
20
|
+
#
|
21
|
+
# SourceDB is designed around <Extensions> and items. The purposefully vague "items" are anything in the source code
|
22
|
+
# that we need to track the definitions of. Extensions are the packages to track them, only they're derived from
|
23
|
+
# <NaturalDocs::SourceDB::Extension> and registered with this package instead of being free standing and duplicating
|
24
|
+
# functionality such as watched files.
|
25
|
+
#
|
26
|
+
# The architecture on this package isn't comprehensive yet. As more extensions are added or previously made free standing
|
27
|
+
# packages are migrated to it it will expand to encompass them. However, it's still experimental so this concept may
|
28
|
+
# eventually be abandoned for something better instead.
|
29
|
+
#
|
30
|
+
#
|
31
|
+
# Architecture: Assumptions
|
32
|
+
#
|
33
|
+
# SourceDB is built around certain assumptions.
|
34
|
+
#
|
35
|
+
# One item per file:
|
36
|
+
#
|
37
|
+
# SourceDB assumes that only the first item per file with a particular item string is relevant. For example, if two functions
|
38
|
+
# have the exact same name, there's no way to link to the second one either in HTML or internally so it doesn't matter for
|
39
|
+
# our purposes. Likewise, if two references are exactly the same they go to the same target, so it doesn't matter whether
|
40
|
+
# there's one or two or a thousand. All that matters is that at least one reference exists in this file because you only need
|
41
|
+
# to determine whether the entire file gets rebuilt. If two items are different in some meaningful way, they should generate
|
42
|
+
# different item strings.
|
43
|
+
#
|
44
|
+
# Watched file parsing:
|
45
|
+
#
|
46
|
+
# SourceDB assumes the parse method is that the information that was stored from Natural Docs' previous run is loaded, a
|
47
|
+
# file is watched, that file is reparsed, and then <AnalyzeWatchedFileChanges()> is called. When the file is reparsed all
|
48
|
+
# items within it are added the same as if the file was never parsed before.
|
49
|
+
#
|
50
|
+
# If there's a new item this time around, that's fine no matter what. However, a changed item wouldn't normally be
|
51
|
+
# recorded because the previous run's definition is seen as the first one and subsequent ones are ignored. Also, deleted
|
52
|
+
# items would normally not be recorded either because we're only adding.
|
53
|
+
#
|
54
|
+
# The watched file method fixes this because everything is also added to a second, clean database specifically for the
|
55
|
+
# watched file. Because it starts clean, it always gets the first definition from the current parse which can then be
|
56
|
+
# compared to the original by <AnalyzeWatchedFileChanges()>. Because it starts clean you can also compare it to the
|
57
|
+
# main database to see if anything was deleted, because it would appear in the main database but not the watched one.
|
58
|
+
#
|
59
|
+
# This means that functions like <ChangeDefinition()> and <DeleteDefinition()> should only be called by
|
60
|
+
# <AnalyzeWatchedFileChanges()>. Externally only <AddDefinition()> should be called. <DeleteItem()> is okay to be
|
61
|
+
# called externally because entire items aren't managed by the watched file database, only definitions.
|
62
|
+
#
|
63
|
+
#
|
64
|
+
###############################################################################
|
65
|
+
|
66
|
+
# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
|
67
|
+
# Natural Docs is licensed under the GPL
|
68
|
+
|
69
|
+
use strict;
|
70
|
+
use integer;
|
71
|
+
|
72
|
+
|
73
|
+
use NaturalDocs::SourceDB::Extension;
|
74
|
+
use NaturalDocs::SourceDB::Item;
|
75
|
+
use NaturalDocs::SourceDB::ItemDefinition;
|
76
|
+
use NaturalDocs::SourceDB::File;
|
77
|
+
use NaturalDocs::SourceDB::WatchedFileDefinitions;
|
78
|
+
|
79
|
+
|
80
|
+
package NaturalDocs::SourceDB;
|
81
|
+
|
82
|
+
|
83
|
+
###############################################################################
|
84
|
+
# Group: Types
|
85
|
+
|
86
|
+
|
87
|
+
#
|
88
|
+
# Type: ExtensionID
|
89
|
+
#
|
90
|
+
# A unique identifier for each <NaturalDocs::SourceDB> extension as given out by <RegisterExtension()>.
|
91
|
+
#
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
###############################################################################
|
96
|
+
# Group: Variables
|
97
|
+
|
98
|
+
|
99
|
+
#
|
100
|
+
# array: extensions
|
101
|
+
#
|
102
|
+
# An array of <NaturalDocs::SourceDB::Extension>-derived extensions, as added with <RegisterExtension()>. The indexes
|
103
|
+
# are the <ExtensionIDs> and the values are package references.
|
104
|
+
#
|
105
|
+
my @extensions;
|
106
|
+
|
107
|
+
#
|
108
|
+
# array: extensionUsesDefinitionObjects
|
109
|
+
#
|
110
|
+
# An array where the indexes are <ExtensionIDs> and the values are whether that extension uses its own definition class
|
111
|
+
# derived from <NaturalDocs::SourceDB::ItemDefinition> or it just tracks their existence.
|
112
|
+
#
|
113
|
+
my @extensionUsesDefinitionObjects;
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
#
|
118
|
+
# array: items
|
119
|
+
#
|
120
|
+
# The array of source items. The <ExtensionIDs> are the indexes, and the values are hashrefs mapping the item
|
121
|
+
# string to <NaturalDocs::SourceDB::Item>-derived objects. Hashrefs may be undef.
|
122
|
+
#
|
123
|
+
my @items;
|
124
|
+
|
125
|
+
|
126
|
+
#
|
127
|
+
# hash: files
|
128
|
+
#
|
129
|
+
# A hashref mapping source <FileNames> to <NaturalDocs::SourceDB::Files>.
|
130
|
+
#
|
131
|
+
my %files;
|
132
|
+
|
133
|
+
|
134
|
+
#
|
135
|
+
# object: watchedFile
|
136
|
+
#
|
137
|
+
# When a file is being watched for changes, will be a <NaturalDocs::SourceDB::File> for that file. Is undef otherwise.
|
138
|
+
#
|
139
|
+
# When the file is parsed, items are added to both this and the version in <files>. Thus afterwards we can compare the two to
|
140
|
+
# see if any were deleted since the last time Natural Docs was run, because they would be in the <files> version but not this
|
141
|
+
# one.
|
142
|
+
#
|
143
|
+
my $watchedFile;
|
144
|
+
|
145
|
+
|
146
|
+
#
|
147
|
+
# string: watchedFileName
|
148
|
+
#
|
149
|
+
# When a file is being watched for changes, will be the <FileName> of the file being watched. Is undef otherwise.
|
150
|
+
#
|
151
|
+
my $watchedFileName;
|
152
|
+
|
153
|
+
|
154
|
+
#
|
155
|
+
# object: watchedFileDefinitions
|
156
|
+
#
|
157
|
+
# When a file is being watched for changes, will be a <NaturalDocs::SourceDB::WatchedFileDefinitions> object. Is undef
|
158
|
+
# otherwise.
|
159
|
+
#
|
160
|
+
# When the file is parsed, items are added to both this and the version in <items>. Since only the first definition is kept, this
|
161
|
+
# will always have the definition info from the file whereas the version in <items> will have the first definition as of the last time
|
162
|
+
# Natural Docs was run. Thus they can be compared to see if the definitions of items that existed the last time around have
|
163
|
+
# changed.
|
164
|
+
#
|
165
|
+
my $watchedFileDefinitions;
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
###############################################################################
|
170
|
+
# Group: Extension Functions
|
171
|
+
|
172
|
+
|
173
|
+
#
|
174
|
+
# Function: RegisterExtension
|
175
|
+
#
|
176
|
+
# Registers a <NaturalDocs::SourceDB::Extension>-derived package and returns a unique <ExtensionID> for it. All extensions
|
177
|
+
# must call this before they can be used.
|
178
|
+
#
|
179
|
+
# Registration Order:
|
180
|
+
#
|
181
|
+
# The order in which extensions register is important. Whenever possible, items are added in the order their extensions
|
182
|
+
# registered. However, items are changed and deleted in the reverse order. Take advantage of this to minimize
|
183
|
+
# churn between extensions that are dependent on each other.
|
184
|
+
#
|
185
|
+
# For example, when symbols are added or deleted they may cause references to be retargeted and thus their files need to
|
186
|
+
# be rebuilt. However, adding or deleting references never causes the symbols' files to be rebuilt. So it makes sense that
|
187
|
+
# symbols should be created before references, and that references should be deleted before symbols.
|
188
|
+
#
|
189
|
+
# Parameters:
|
190
|
+
#
|
191
|
+
# extension - The package or object of the extension. Must be derived from <NaturalDocs::SourceDB::Extension>.
|
192
|
+
# usesDefinitionObjects - Whether the extension uses its own class derived from <NaturalDocs::SourceDB::ItemDefinition>
|
193
|
+
# or simply tracks each definitions existence.
|
194
|
+
#
|
195
|
+
# Returns:
|
196
|
+
#
|
197
|
+
# An <ExtensionID> unique to the extension. This should be saved because it's required in functions such as <AddItem()>.
|
198
|
+
#
|
199
|
+
sub RegisterExtension #(package extension, bool usesDefinitionObjects) => ExtensionID
|
200
|
+
{
|
201
|
+
my ($self, $extension, $usesDefinitionObjects) = @_;
|
202
|
+
|
203
|
+
push @extensions, $extension;
|
204
|
+
push @extensionUsesDefinitionObjects, $usesDefinitionObjects;
|
205
|
+
|
206
|
+
return scalar @extensions - 1;
|
207
|
+
};
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
###############################################################################
|
213
|
+
# Group: File Functions
|
214
|
+
|
215
|
+
|
216
|
+
#
|
217
|
+
# Function: Load
|
218
|
+
#
|
219
|
+
# Loads the data of the source database and all the extensions. Will call <NaturalDocs::SourceDB::Extension->Load()> for
|
220
|
+
# all of them, unless there's a situation where all the source files are going to be reparsed anyway in which case it's not needed.
|
221
|
+
#
|
222
|
+
sub Load
|
223
|
+
{
|
224
|
+
my $self = shift;
|
225
|
+
|
226
|
+
# No point loading if RebuildData is set.
|
227
|
+
if (!NaturalDocs::Settings->RebuildData())
|
228
|
+
{
|
229
|
+
# If any load fails, stop loading the rest and just reparse all the source files.
|
230
|
+
my $success = 1;
|
231
|
+
|
232
|
+
for (my $extension = 0; $extension < scalar @extensions && $success; $extension++)
|
233
|
+
{
|
234
|
+
$success = $extensions[$extension]->Load();
|
235
|
+
};
|
236
|
+
|
237
|
+
if (!$success)
|
238
|
+
{ NaturalDocs::Project->ReparseEverything(); };
|
239
|
+
};
|
240
|
+
};
|
241
|
+
|
242
|
+
|
243
|
+
#
|
244
|
+
# Function: Save
|
245
|
+
#
|
246
|
+
# Saves the data of the source database and all its extensions. Will call <NaturalDocs::SourceDB::Extension->Save()> for all
|
247
|
+
# of them.
|
248
|
+
#
|
249
|
+
sub Save
|
250
|
+
{
|
251
|
+
my $self = shift;
|
252
|
+
|
253
|
+
for (my $extension = scalar @extensions - 1; $extension >= 0; $extension--)
|
254
|
+
{
|
255
|
+
$extensions[$extension]->Save();
|
256
|
+
};
|
257
|
+
};
|
258
|
+
|
259
|
+
|
260
|
+
#
|
261
|
+
# Function: PurgeDeletedSourceFiles
|
262
|
+
#
|
263
|
+
# Removes all data associated with deleted source files.
|
264
|
+
#
|
265
|
+
sub PurgeDeletedSourceFiles
|
266
|
+
{
|
267
|
+
my $self = shift;
|
268
|
+
|
269
|
+
my $filesToPurge = NaturalDocs::Project->FilesToPurge();
|
270
|
+
|
271
|
+
# Extension is the outermost loop because we want the extensions added last to have their definitions removed first to cause
|
272
|
+
# the least amount of churn between interdependent extensions.
|
273
|
+
for (my $extension = scalar @extensions - 1; $extension >= 0; $extension--)
|
274
|
+
{
|
275
|
+
foreach my $file (keys %$filesToPurge)
|
276
|
+
{
|
277
|
+
if (exists $files{$file})
|
278
|
+
{
|
279
|
+
my @items = $files{$file}->ListItems($extension);
|
280
|
+
|
281
|
+
foreach my $item (@items)
|
282
|
+
{
|
283
|
+
$self->DeleteDefinition($extension, $item, $file);
|
284
|
+
};
|
285
|
+
}; # file exists
|
286
|
+
}; # each file
|
287
|
+
}; # each extension
|
288
|
+
};
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
###############################################################################
|
295
|
+
# Group: Item Functions
|
296
|
+
|
297
|
+
|
298
|
+
#
|
299
|
+
# Function: AddItem
|
300
|
+
#
|
301
|
+
# Adds the passed item to the database. This will not work if the item string already exists. The item added should *not*
|
302
|
+
# already have definitions attached. Only use this to add blank items and then call <AddDefinition()> instead.
|
303
|
+
#
|
304
|
+
# Parameters:
|
305
|
+
#
|
306
|
+
# extension - An <ExtensionID>.
|
307
|
+
# itemString - The string serving as the item identifier.
|
308
|
+
# item - An object derived from <NaturalDocs::SourceDB::Item>.
|
309
|
+
#
|
310
|
+
# Returns:
|
311
|
+
#
|
312
|
+
# Whether the item was added, that is, whether it was the first time this item was added.
|
313
|
+
#
|
314
|
+
sub AddItem #(ExtensionID extension, string itemString, NaturalDocs::SourceDB::Item item) => bool
|
315
|
+
{
|
316
|
+
my ($self, $extension, $itemString, $item) = @_;
|
317
|
+
|
318
|
+
if (!defined $items[$extension])
|
319
|
+
{ $items[$extension] = { }; };
|
320
|
+
|
321
|
+
if (!exists $items[$extension]->{$itemString})
|
322
|
+
{
|
323
|
+
if ($item->HasDefinitions())
|
324
|
+
{ die "Tried to add an item to SourceDB that already had definitions."; };
|
325
|
+
|
326
|
+
$items[$extension]->{$itemString} = $item;
|
327
|
+
return 1;
|
328
|
+
};
|
329
|
+
|
330
|
+
return 0;
|
331
|
+
};
|
332
|
+
|
333
|
+
|
334
|
+
#
|
335
|
+
# Function: GetItem
|
336
|
+
#
|
337
|
+
# Returns the <NaturalDocs::SourceDB::Item>-derived object for the passed <ExtensionID> and item string, or undef if there
|
338
|
+
# is none.
|
339
|
+
#
|
340
|
+
sub GetItem #(ExtensionID extension, string itemString) => bool
|
341
|
+
{
|
342
|
+
my ($self, $extensionID, $itemString) = @_;
|
343
|
+
|
344
|
+
if (defined $items[$extensionID])
|
345
|
+
{ return $items[$extensionID]->{$itemString}; }
|
346
|
+
else
|
347
|
+
{ return undef; };
|
348
|
+
};
|
349
|
+
|
350
|
+
|
351
|
+
#
|
352
|
+
# Function: DeleteItem
|
353
|
+
#
|
354
|
+
# Deletes the record of the passed <ExtensionID> and item string. Do *not* delete items that still have definitions. Use
|
355
|
+
# <DeleteDefinition()> first.
|
356
|
+
#
|
357
|
+
# Parameters:
|
358
|
+
#
|
359
|
+
# extension - The <ExtensionID>.
|
360
|
+
# itemString - The item's identifying string.
|
361
|
+
#
|
362
|
+
# Returns:
|
363
|
+
#
|
364
|
+
# Whether it was successful, meaning whether an entry existed for it.
|
365
|
+
#
|
366
|
+
sub DeleteItem #(ExtensionID extension, string itemString) => bool
|
367
|
+
{
|
368
|
+
my ($self, $extension, $itemString) = @_;
|
369
|
+
|
370
|
+
if (defined $items[$extension] && exists $items[$extension]->{$itemString})
|
371
|
+
{
|
372
|
+
if ($items[$extension]->{$itemString}->HasDefinitions())
|
373
|
+
{ die "Tried to delete an item from SourceDB that still has definitions."; };
|
374
|
+
|
375
|
+
delete $items[$extension]->{$itemString};
|
376
|
+
return 1;
|
377
|
+
}
|
378
|
+
else
|
379
|
+
{ return 0; };
|
380
|
+
};
|
381
|
+
|
382
|
+
|
383
|
+
#
|
384
|
+
# Function: HasItem
|
385
|
+
#
|
386
|
+
# Returns whether there is an item defined for the passed <ExtensionID> and item string.
|
387
|
+
#
|
388
|
+
sub HasItem #(ExtensionID extension, string itemString) => bool
|
389
|
+
{
|
390
|
+
my ($self, $extension, $itemString) = @_;
|
391
|
+
|
392
|
+
if (defined $items[$extension])
|
393
|
+
{ return (exists $items[$extension]->{$itemString}); }
|
394
|
+
else
|
395
|
+
{ return 0; };
|
396
|
+
};
|
397
|
+
|
398
|
+
|
399
|
+
#
|
400
|
+
# Function: GetAllItemsHashRef
|
401
|
+
#
|
402
|
+
# Returns a hashref of all the items defined for an extension. *Do not change the contents.* The keys are the item strings and
|
403
|
+
# the values are <NaturalDocs::SourceDB::Items> or derived classes.
|
404
|
+
#
|
405
|
+
sub GetAllItemsHashRef #(ExtensionID extension) => hashref
|
406
|
+
{
|
407
|
+
my ($self, $extension) = @_;
|
408
|
+
return $items[$extension];
|
409
|
+
};
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
###############################################################################
|
414
|
+
# Group: Definition Functions
|
415
|
+
|
416
|
+
|
417
|
+
#
|
418
|
+
# Function: AddDefinition
|
419
|
+
#
|
420
|
+
# Adds a definition to an item. Assumes the item was already created with <AddItem()>. If there's already a definition for this
|
421
|
+
# file in the item, the new definition will be ignored.
|
422
|
+
#
|
423
|
+
# Parameters:
|
424
|
+
#
|
425
|
+
# extension - The <ExtensionID>.
|
426
|
+
# itemString - The item string.
|
427
|
+
# file - The <FileName> the definition is in.
|
428
|
+
# definition - If you're using a custom <NaturalDocs::SourceDB::ItemDefinition> class, you must include an object for it here.
|
429
|
+
# Otherwise this parameter is ignored.
|
430
|
+
#
|
431
|
+
# Returns:
|
432
|
+
#
|
433
|
+
# Whether the definition was added, which is to say, whether this was the first definition for the passed <FileName>.
|
434
|
+
#
|
435
|
+
sub AddDefinition #(ExtensionID extension, string itemString, FileName file, optional NaturalDocs::SourceDB::ItemDefinition definition) => bool
|
436
|
+
{
|
437
|
+
my ($self, $extension, $itemString, $file, $definition) = @_;
|
438
|
+
|
439
|
+
|
440
|
+
# Items
|
441
|
+
|
442
|
+
my $item = $self->GetItem($extension, $itemString);
|
443
|
+
|
444
|
+
if (!defined $item)
|
445
|
+
{ die "Tried to add a definition to an undefined item in SourceDB."; };
|
446
|
+
|
447
|
+
if (!$extensionUsesDefinitionObjects[$extension])
|
448
|
+
{ $definition = 1; };
|
449
|
+
|
450
|
+
my $result = $item->AddDefinition($file, $definition);
|
451
|
+
|
452
|
+
|
453
|
+
# Files
|
454
|
+
|
455
|
+
if (!exists $files{$file})
|
456
|
+
{ $files{$file} = NaturalDocs::SourceDB::File->New(); };
|
457
|
+
|
458
|
+
$files{$file}->AddItem($extension, $itemString);
|
459
|
+
|
460
|
+
|
461
|
+
# Watched File
|
462
|
+
|
463
|
+
if ($self->WatchingFileForChanges())
|
464
|
+
{
|
465
|
+
$watchedFile->AddItem($extension, $itemString);
|
466
|
+
|
467
|
+
if ($extensionUsesDefinitionObjects[$extension])
|
468
|
+
{ $watchedFileDefinitions->AddDefinition($extension, $itemString, $definition); };
|
469
|
+
};
|
470
|
+
|
471
|
+
|
472
|
+
return $result;
|
473
|
+
};
|
474
|
+
|
475
|
+
|
476
|
+
#
|
477
|
+
# Function: ChangeDefinition
|
478
|
+
#
|
479
|
+
# Changes the definition of an item. This function is only used for extensions that use custom
|
480
|
+
# <NaturalDocs::SourceDB::ItemDefinition>-derived classes.
|
481
|
+
#
|
482
|
+
# Parameters:
|
483
|
+
#
|
484
|
+
# extension - The <ExtensionID>.
|
485
|
+
# itemString - The item string.
|
486
|
+
# file - The <FileName> the definition is in.
|
487
|
+
# definition - The definition, which must be an object derived from <NaturalDocs::SourceDB::ItemDefinition>.
|
488
|
+
#
|
489
|
+
sub ChangeDefinition #(ExtensionID extension, string itemString, FileName file, NaturalDocs::SourceDB::ItemDefinition definition)
|
490
|
+
{
|
491
|
+
my ($self, $extension, $itemString, $file, $definition) = @_;
|
492
|
+
|
493
|
+
my $item = $self->GetItem($extension, $itemString);
|
494
|
+
|
495
|
+
if (!defined $item)
|
496
|
+
{ die "Tried to change the definition of an undefined item in SourceDB."; };
|
497
|
+
|
498
|
+
if (!$extensionUsesDefinitionObjects[$extension])
|
499
|
+
{ die "Tried to change the definition of an item in an extension that doesn't use definition objects in SourceDB."; };
|
500
|
+
|
501
|
+
if (!$item->HasDefinition($file))
|
502
|
+
{ die "Tried to change a definition that doesn't exist in SourceDB."; };
|
503
|
+
|
504
|
+
$item->ChangeDefinition($file, $definition);
|
505
|
+
$extensions[$extension]->OnChangedDefinition($itemString, $file);
|
506
|
+
};
|
507
|
+
|
508
|
+
|
509
|
+
#
|
510
|
+
# Function: GetDefinition
|
511
|
+
#
|
512
|
+
# If the extension uses custom <NaturalDocs::SourceDB::ItemDefinition> classes, returns it for the passed definition or undef
|
513
|
+
# if it doesn't exist. Otherwise returns whether it exists.
|
514
|
+
#
|
515
|
+
sub GetDefinition #(ExtensionID extension, string itemString, FileName file) => NaturalDocs::SourceDB::ItemDefinition or bool
|
516
|
+
{
|
517
|
+
my ($self, $extension, $itemString, $file) = @_;
|
518
|
+
|
519
|
+
my $item = $self->GetItem($extension, $itemString);
|
520
|
+
|
521
|
+
if (!defined $item)
|
522
|
+
{ return undef; };
|
523
|
+
|
524
|
+
return $item->GetDefinition($file);
|
525
|
+
};
|
526
|
+
|
527
|
+
|
528
|
+
#
|
529
|
+
# Function: DeleteDefinition
|
530
|
+
#
|
531
|
+
# Removes the definition for the passed item. Returns whether it was successful, meaning whether a definition existed for that
|
532
|
+
# file.
|
533
|
+
#
|
534
|
+
sub DeleteDefinition #(ExtensionID extension, string itemString, FileName file) => bool
|
535
|
+
{
|
536
|
+
my ($self, $extension, $itemString, $file) = @_;
|
537
|
+
|
538
|
+
my $item = $self->GetItem($extension, $itemString);
|
539
|
+
|
540
|
+
if (!defined $item)
|
541
|
+
{ return 0; };
|
542
|
+
|
543
|
+
my $result = $item->DeleteDefinition($file);
|
544
|
+
|
545
|
+
if ($result)
|
546
|
+
{
|
547
|
+
$files{$file}->DeleteItem($extension, $itemString);
|
548
|
+
$extensions[$extension]->OnDeletedDefinition($itemString, $file, !$item->HasDefinitions());
|
549
|
+
};
|
550
|
+
|
551
|
+
return $result;
|
552
|
+
};
|
553
|
+
|
554
|
+
|
555
|
+
#
|
556
|
+
# Function: HasDefinitions
|
557
|
+
#
|
558
|
+
# Returns whether there are any definitions for this item.
|
559
|
+
#
|
560
|
+
sub HasDefinitions #(ExtensionID extension, string itemString) => bool
|
561
|
+
{
|
562
|
+
my ($self, $extension, $itemString) = @_;
|
563
|
+
|
564
|
+
my $item = $self->GetItem($extension, $itemString);
|
565
|
+
|
566
|
+
if (!defined $item)
|
567
|
+
{ return 0; };
|
568
|
+
|
569
|
+
return $item->HasDefinitions();
|
570
|
+
};
|
571
|
+
|
572
|
+
|
573
|
+
#
|
574
|
+
# Function: HasDefinition
|
575
|
+
#
|
576
|
+
# Returns whether there is a definition for the passed <FileName>.
|
577
|
+
#
|
578
|
+
sub HasDefinition #(ExtensionID extension, string itemString, FileName file) => bool
|
579
|
+
{
|
580
|
+
my ($self, $extension, $itemString, $file) = @_;
|
581
|
+
|
582
|
+
my $item = $self->GetItem($extension, $itemString);
|
583
|
+
|
584
|
+
if (!defined $item)
|
585
|
+
{ return 0; };
|
586
|
+
|
587
|
+
return $item->HasDefinition($file);
|
588
|
+
};
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
###############################################################################
|
593
|
+
# Group: Watched File Functions
|
594
|
+
|
595
|
+
|
596
|
+
#
|
597
|
+
# Function: WatchFileForChanges
|
598
|
+
#
|
599
|
+
# Begins watching a file for changes. Only one file at a time can be watched.
|
600
|
+
#
|
601
|
+
# This should be called before a file is parsed so the file info goes both into the main database and the watched file info.
|
602
|
+
# Afterwards you call <AnalyzeWatchedFileChanges()> so item deletions and definition changes can be detected.
|
603
|
+
#
|
604
|
+
# Parameters:
|
605
|
+
#
|
606
|
+
# filename - The <FileName> to watch.
|
607
|
+
#
|
608
|
+
sub WatchFileForChanges #(FileName filename)
|
609
|
+
{
|
610
|
+
my ($self, $filename) = @_;
|
611
|
+
|
612
|
+
$watchedFileName = $filename;
|
613
|
+
$watchedFile = NaturalDocs::SourceDB::File->New();
|
614
|
+
$watchedFileDefinitions = NaturalDocs::SourceDB::WatchedFileDefinitions->New();
|
615
|
+
};
|
616
|
+
|
617
|
+
|
618
|
+
#
|
619
|
+
# Function: WatchingFileForChanges
|
620
|
+
#
|
621
|
+
# Returns whether we're currently watching a file for changes or not.
|
622
|
+
#
|
623
|
+
sub WatchingFileForChanges # => bool
|
624
|
+
{
|
625
|
+
my $self = shift;
|
626
|
+
return defined $watchedFileName;
|
627
|
+
};
|
628
|
+
|
629
|
+
|
630
|
+
#
|
631
|
+
# Function: AnalyzeWatchedFileChanges
|
632
|
+
#
|
633
|
+
# Analyzes the watched file for changes. Will delete and change definitions as necessary.
|
634
|
+
#
|
635
|
+
sub AnalyzeWatchedFileChanges
|
636
|
+
{
|
637
|
+
my $self = shift;
|
638
|
+
|
639
|
+
if (!$self->WatchingFileForChanges())
|
640
|
+
{ die "Tried to analyze watched file for changes in SourceDB when no file was being watched."; };
|
641
|
+
if (!$files{$watchedFileName})
|
642
|
+
{ return; };
|
643
|
+
|
644
|
+
|
645
|
+
# Process extensions last registered to first.
|
646
|
+
|
647
|
+
for (my $extension = scalar @extensions - 1; $extension >= 0; $extension--)
|
648
|
+
{
|
649
|
+
my @items = $files{$watchedFileName}->ListItems($extension);
|
650
|
+
|
651
|
+
foreach my $item (@items)
|
652
|
+
{
|
653
|
+
if ($watchedFile->HasItem($extension, $item))
|
654
|
+
{
|
655
|
+
if ($extensionUsesDefinitionObjects[$extension])
|
656
|
+
{
|
657
|
+
my $originalDefinition = $items[$extension]->GetDefinition($watchedFileName);
|
658
|
+
my $watchedDefinition = $watchedFileDefinitions->GetDefinition($extension, $item);
|
659
|
+
|
660
|
+
if (!$originalDefinition->Compare($watchedDefinition))
|
661
|
+
{ $self->ChangeDefinition($extension, $item, $watchedFileName, $watchedDefinition); };
|
662
|
+
}
|
663
|
+
}
|
664
|
+
else # !$watchedFile->HasItem($item)
|
665
|
+
{
|
666
|
+
$self->DeleteDefinition($extension, $item, $watchedFileName);
|
667
|
+
};
|
668
|
+
};
|
669
|
+
};
|
670
|
+
|
671
|
+
|
672
|
+
$watchedFile = undef;
|
673
|
+
$watchedFileName = undef;
|
674
|
+
$watchedFileDefinitions = undef;
|
675
|
+
};
|
676
|
+
|
677
|
+
|
678
|
+
1;
|