appledoc now embeds the default templates, installing them on demand only! The CLI is completely self contained #252

Merged
merged 1 commit into from Sep 25, 2012

Projects

None yet

2 participants

@Daij-Djan
Contributor

appledoc now embeds the default templates, installing them on demand only! The CLI is completely self contained! YAY

no more install needed.. BUT of course all is still there AND all the command line switches override this

anyway: its great that now I don't need any installation. Actually the appledoc binary (small as it is) is INSIDE our main repo and when the Xcode project is built it's just used ...

@Daij-Djan Daij-Djan appledoc now embeds the default templates, installing them on demand …
…only! The CLI is completely self contained

Signed-off-by: Dominik Pich <Dominik@pich.info>
03adcda
@Daij-Djan
Contributor

btw: I would increase the version number a tad

@tomaz
Owner
tomaz commented Sep 12, 2012

Wow, this one was on my internal todo list (or rather wishlist :) for a while now. I have few questions, hope you can clarify them for me:

  • I checked your commits and noticed AppledocSettings.plist now contains the main template file for html, but it's missing project settings that were used for compiling the documentation. I couldn't find this info elsewhere.
  • Could you explain how it works? From what I saw in the diff, the key is a shell script that zips templates and moves zip to some folder, but I couldn't figure out how they get embedded into the executable.

It's larger change, so forgive me for being a bit more cautious on it...

@Daij-Djan
Contributor

hehe sure no prob! I'd be hesitant to pull in such a big and fundamental change myself. Also I have tested it and we use it productively but you should also test and verify it :)

it all comes down to a flag you can pass to the linker (ld)
it can be ANYTHING and he links it in.

-seccreate NAME NAME fileToPutIntoExe

In this case, we link in a zip file when we build: templates.zip

  1. this zip is created from the current Templates folder (upon build time)
  2. linked in (during build)
  3. and removed (after build)

At runtime I check if I have been given a templatedir and if not I try the fallbacks (as before)
but if ALL that fails, I extract the zip to ~/Library/AppSupport/...
=> I use DDEmbeddedDataReader from my utilities to read the linked in data
=> I unzip it using DDMiniZip (not ideal)


then I went and modified the README and the install script.


I did not (or only by Accident) touch AppledocSettings.plist
I dont need/use it at all

@Daij-Djan Daij-Djan commented on the diff Sep 16, 2012
Application/GBAppledocApplication.m
@@ -538,6 +586,18 @@ - (void)injectGlobalSettingsFromArguments:(NSArray *)arguments {
return;
}
#endif
+
+ //if we got here, there is NO templates installed which we can find.
+ //IF we have embedded data though, we can get THAT and install it
+ path = @"~/.appledoc";
+ [self extractShippedTemplatesToPath:path];
+ if ([self validateTemplatesPath:path error:nil]) {
+ [self overrideSettingsWithGlobalSettingsFromPath:path];
+ self.settings.templatesPath = path;
+ self.templatesFound = YES;
+ return;
+ }
+
@Daij-Djan
Daij-Djan Sep 16, 2012 Contributor

this is key to runtime support

@Daij-Djan Daij-Djan commented on the diff Sep 16, 2012
install-appledoc.sh
BINARY_DIR=$OPTARG;;
- t)
- TEMPLATES_DIR=$OPTARG;;
+ t)
+ INSTALL_TEMPLATES="YES"
+ echo "arg is = $OPTARG"
+ if [ $OPTARG != "default" ]; then
+ TEMPLATES_DIR=$OPTARG
+ fi
+ ;;
@Daij-Djan
Daij-Djan Sep 16, 2012 Contributor

only copy the templates if really requested with -t

@Daij-Djan Daij-Djan commented on the diff Sep 16, 2012
Common/ThirdParty/DDUtils/DDXcodeProjectFile.m
@@ -98,19 +98,22 @@ - (BOOL)parse:(NSError**)pError {
if(self.path.length) {
self.dictionary = [NSDictionary dictionaryWithContentsOfFile:self.path];
if(!self.dictionary) {
- *pError = [NSError errorWithDomain:@"DDXcodeProjectFile" code:0 userInfo:@{NSLocalizedDescriptionKey:@"cannot make plist from file contents"}];
+ if(pError)
+ *pError = [NSError errorWithDomain:@"DDXcodeProjectFile" code:0 userInfo:@{NSLocalizedDescriptionKey:@"cannot make plist from file contents"}];
return NO;
@Daij-Djan
Daij-Djan Sep 16, 2012 Contributor

potential null dereference

@tomaz tomaz merged commit 23e98f6 into tomaz:master Sep 25, 2012
@tomaz
Owner
tomaz commented Sep 25, 2012

finally came to this, sorry it took so long :)

@Daij-Djan
Contributor

hehe no prob!
thanks for making appledoc!
On 25.09.2012, at 11:30, tomaz notifications@github.com wrote:

finally came to this, sorry it took so long :)


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment