Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed published atom file handling. Closes #45.

The problem was with using the value of `--docset-feed-url` as `-download-url` for docsetutil when generating package. That parameter expected the URL of the xar, not of the feed itself. By adding additional command line switch `--docset-package-url`, we can now distinguish between the two!

With this commit, packaging docset should become usable. However I haven't tested it myself.

Also added command line switched for changing docset bundle, atom and package filenames. Although this isn't necessary for publishing (default values should work just fine), it adds options for power users. And these options were available in GBApplicationSettingsProvider anyway.
  • Loading branch information...
commit 895b881c48fbd5b35640d7dc5c0b14a7629c3bcc 1 parent 45159f0
@tomaz authored
View
40 Application/GBAppledocApplication.m
@@ -54,6 +54,7 @@
static NSString *kGBArgDocSetCopyrightMessage = @"docset-copyright";
static NSString *kGBArgDocSetFeedName = @"docset-feed-name";
static NSString *kGBArgDocSetFeedURL = @"docset-feed-url";
+static NSString *kGBArgDocSetPackageURL = @"docset-package-url";
static NSString *kGBArgDocSetFallbackURL = @"docset-fallback-url";
static NSString *kGBArgDocSetPublisherIdentifier = @"docset-publisher-id";
static NSString *kGBArgDocSetPublisherName = @"docset-publisher-name";
@@ -62,6 +63,10 @@
static NSString *kGBArgDocSetCertificateIssuer = @"docset-cert-issuer";
static NSString *kGBArgDocSetCertificateSigner = @"docset-cert-signer";
+static NSString *kGBArgDocSetBundleFilename = @"docset-bundle-filename";
+static NSString *kGBArgDocSetAtomFilename = @"docset-atom-filename";
+static NSString *kGBArgDocSetPackageFilename = @"docset-package-filename";
+
static NSString *kGBArgLogFormat = @"logformat";
static NSString *kGBArgVerbose = @"verbose";
static NSString *kGBArgPrintSettings = @"print-settings";
@@ -199,12 +204,17 @@ - (void)application:(DDCliApplication *)app willParseOptions:(DDGetoptLongParser
{ kGBArgDocSetFallbackURL, 0, DDGetoptRequiredArgument },
{ kGBArgDocSetFeedName, 0, DDGetoptRequiredArgument },
{ kGBArgDocSetFeedURL, 0, DDGetoptRequiredArgument },
+ { kGBArgDocSetPackageURL, 0, DDGetoptRequiredArgument },
{ kGBArgDocSetMinimumXcodeVersion, 0, DDGetoptRequiredArgument },
{ kGBArgDocSetPlatformFamily, 0, DDGetoptRequiredArgument },
{ kGBArgDocSetPublisherIdentifier, 0, DDGetoptRequiredArgument },
{ kGBArgDocSetPublisherName, 0, DDGetoptRequiredArgument },
{ kGBArgDocSetCopyrightMessage, 0, DDGetoptRequiredArgument },
+ { kGBArgDocSetBundleFilename, 0, DDGetoptRequiredArgument },
+ { kGBArgDocSetAtomFilename, 0, DDGetoptRequiredArgument },
+ { kGBArgDocSetPackageFilename, 0, DDGetoptRequiredArgument },
+
{ kGBArgCreateHTML, 'h', DDGetoptNoArgument },
{ kGBArgCreateDocSet, 'd', DDGetoptNoArgument },
{ kGBArgInstallDocSet, 'n', DDGetoptNoArgument },
@@ -475,6 +485,7 @@ - (void)setDocsetDesc:(NSString *)value { self.settings.docsetDescription = valu
- (void)setDocsetCopyright:(NSString *)value { self.settings.docsetCopyrightMessage = value; }
- (void)setDocsetFeedName:(NSString *)value { self.settings.docsetFeedName = value; }
- (void)setDocsetFeedUrl:(NSString *)value { self.settings.docsetFeedURL = value; }
+- (void)setDocsetPackageUrl:(NSString *)value { self.settings.docsetPackageURL = value; }
- (void)setDocsetFallbackUrl:(NSString *)value { self.settings.docsetFallbackURL = value; }
- (void)setDocsetPublisherId:(NSString *)value { self.settings.docsetPublisherIdentifier = value; }
- (void)setDocsetPublisherName:(NSString *)value { self.settings.docsetPublisherName = value; }
@@ -483,6 +494,10 @@ - (void)setDocsetPlatformFamily:(NSString *)value { self.settings.docsetPlatform
- (void)setDocsetCertIssuer:(NSString *)value { self.settings.docsetCertificateIssuer = value; }
- (void)setDocsetCertSigner:(NSString *)value { self.settings.docsetCertificateSigner = value; }
+- (void)setDocsetBundleFilename:(NSString *)value { self.settings.docsetBundleFilename = value; }
+- (void)setDocsetAtomFilename:(NSString *)value { self.settings.docsetAtomFilename = value; }
+- (void)setDocsetPackageFilename:(NSString *)value { self.settings.docsetPackageFilename = value; }
+
@synthesize logformat;
@synthesize verbose;
@synthesize printSettings;
@@ -527,6 +542,7 @@ - (void)printSettingsAndArguments:(NSArray *)arguments {
ddprintf(@"--%@ = %@\n", kGBArgDocSetCopyrightMessage, self.settings.docsetCopyrightMessage);
ddprintf(@"--%@ = %@\n", kGBArgDocSetFeedName, self.settings.docsetFeedName);
ddprintf(@"--%@ = %@\n", kGBArgDocSetFeedURL, self.settings.docsetFeedURL);
+ ddprintf(@"--%@ = %@\n", kGBArgDocSetPackageURL, self.settings.docsetPackageURL);
ddprintf(@"--%@ = %@\n", kGBArgDocSetFallbackURL, self.settings.docsetFallbackURL);
ddprintf(@"--%@ = %@\n", kGBArgDocSetPublisherIdentifier, self.settings.docsetPublisherIdentifier);
ddprintf(@"--%@ = %@\n", kGBArgDocSetPublisherName, self.settings.docsetPublisherName);
@@ -534,6 +550,9 @@ - (void)printSettingsAndArguments:(NSArray *)arguments {
ddprintf(@"--%@ = %@\n", kGBArgDocSetPlatformFamily, self.settings.docsetPlatformFamily);
ddprintf(@"--%@ = %@\n", kGBArgDocSetCertificateIssuer, self.settings.docsetCertificateIssuer);
ddprintf(@"--%@ = %@\n", kGBArgDocSetCertificateSigner, self.settings.docsetCertificateSigner);
+ ddprintf(@"--%@ = %@\n", kGBArgDocSetBundleFilename, self.settings.docsetBundleFilename);
+ ddprintf(@"--%@ = %@\n", kGBArgDocSetAtomFilename, self.settings.docsetAtomFilename);
+ ddprintf(@"--%@ = %@\n", kGBArgDocSetPackageFilename, self.settings.docsetPackageFilename);
ddprintf(@"\n");
ddprintf(@"--%@ = %@\n", kGBArgCreateHTML, PRINT_BOOL(self.settings.createHTML));
@@ -616,6 +635,7 @@ - (void)printHelp {
PRINT_USAGE(@" ", kGBArgDocSetCopyrightMessage, @"<string>", @"[*] DocSet copyright message");
PRINT_USAGE(@" ", kGBArgDocSetFeedName, @"<string>", @"[*] DocSet feed name");
PRINT_USAGE(@" ", kGBArgDocSetFeedURL, @"<string>", @"[*] DocSet feed URL");
+ PRINT_USAGE(@" ", kGBArgDocSetPackageURL, @"<string>", @"[*] DocSet package (.xar) URL");
PRINT_USAGE(@" ", kGBArgDocSetFallbackURL, @"<string>", @"[*] DocSet fallback URL");
PRINT_USAGE(@" ", kGBArgDocSetPublisherIdentifier, @"<string>", @"[*] DocSet publisher identifier");
PRINT_USAGE(@" ", kGBArgDocSetPublisherName, @"<string>", @"[*] DocSet publisher name");
@@ -623,6 +643,9 @@ - (void)printHelp {
PRINT_USAGE(@" ", kGBArgDocSetPlatformFamily, @"<string>", @"[*] DocSet platform familiy");
PRINT_USAGE(@" ", kGBArgDocSetCertificateIssuer, @"<string>", @"[*] DocSet certificate issuer");
PRINT_USAGE(@" ", kGBArgDocSetCertificateSigner, @"<string>", @"[*] DocSet certificate signer");
+ PRINT_USAGE(@" ", kGBArgDocSetBundleFilename, @"<string>", @"[*] DocSet bundle filename");
+ PRINT_USAGE(@" ", kGBArgDocSetAtomFilename, @"<string>", @"[*] DocSet atom feed filename");
+ PRINT_USAGE(@" ", kGBArgDocSetPackageFilename, @"<string>", @"[*] DocSet package (.xar) filename");
ddprintf(@"\n");
ddprintf(@"MISCELLANEOUS\n");
PRINT_USAGE(@" ", kGBArgLogFormat, @"<number>", @"Log format [0-3]");
@@ -633,12 +656,17 @@ - (void)printHelp {
ddprintf(@"\n[b] boolean parameter, uses no value, use --no- prefix to negate.\n");
ddprintf(@"\n");
ddprintf(@"[*] indicates parameters accepting placeholder strings:\n");
- ddprintf(@"- $PROJECT replaced with --project-name\n");
- ddprintf(@"- $VERSION replaced with --project-version\n");
- ddprintf(@"- $COMPANY replaced with --project-company\n");
- ddprintf(@"- $COMPANYID replaced with --company-id\n");
- ddprintf(@"- $YEAR replaced with current year (format yyyy)\n");
- ddprintf(@"- $UPDATEDATE replaced with current date (format yyyy-MM-dd)\n");
+ ddprintf(@"- %PROJECT replaced with --project-name\n");
+ ddprintf(@"- %PROJECTID replaced with normalized --project-name\n");
+ ddprintf(@"- %VERSION replaced with --project-version\n");
+ ddprintf(@"- %VERSIONID replaced with normalized --project-version\n");
+ ddprintf(@"- %COMPANY replaced with --project-company\n");
+ ddprintf(@"- %COMPANYID replaced with --company-id\n");
+ ddprintf(@"- %YEAR replaced with current year (format yyyy)\n");
+ ddprintf(@"- %UPDATEDATE replaced with current date (format yyyy-MM-dd)\n");
+ ddprintf(@"- %DOCSETBUNDLEFILENAME replaced with --docset-bundle-filename\n");
+ ddprintf(@"- %DOCSETATOMFILENAME replaced with --docset-atom-filename\n");
+ ddprintf(@"- %DOCSETPACKAGEFILENAME replaced with --docset-package-filename\n");
ddprintf(@"\n");
ddprintf(@"%@ uses the following open source components, fully or partially:\n", name);
ddprintf(@"\n");
View
3  Application/GBApplicationSettingsProvider.h
@@ -75,6 +75,9 @@
/** Documentation set feed URL. */
@property (copy) NSString *docsetFeedURL;
+/** Documentation set package URL. */
+@property (copy) NSString *docsetPackageURL;
+
/** Documentation set minimum Xcode version. */
@property (copy) NSString *docsetMinimumXcodeVersion;
View
4 Application/GBApplicationSettingsProvider.m
@@ -81,6 +81,7 @@ - (id)init {
self.docsetFallbackURL = @"";
self.docsetFeedName = self.docsetBundleName;
self.docsetFeedURL = @"";
+ self.docsetPackageURL = @"";
self.docsetMinimumXcodeVersion = @"3.0";
self.docsetPlatformFamily = @"";
self.docsetPublisherIdentifier = @"%COMPANYID.documentation";
@@ -113,6 +114,7 @@ - (void)replaceAllOccurencesOfPlaceholderStringsInSettingsValues {
self.docsetFallbackURL = [self stringByReplacingOccurencesOfPlaceholdersInString:self.docsetFallbackURL];
self.docsetFeedName = [self stringByReplacingOccurencesOfPlaceholdersInString:self.docsetFeedName];
self.docsetFeedURL = [self stringByReplacingOccurencesOfPlaceholdersInString:self.docsetFeedURL];
+ self.docsetPackageURL = [self stringByReplacingOccurencesOfPlaceholdersInString:self.docsetPackageURL];
self.docsetMinimumXcodeVersion = [self stringByReplacingOccurencesOfPlaceholdersInString:self.docsetMinimumXcodeVersion];
self.docsetPlatformFamily = [self stringByReplacingOccurencesOfPlaceholdersInString:self.docsetPlatformFamily];
self.docsetPublisherIdentifier = [self stringByReplacingOccurencesOfPlaceholdersInString:self.docsetPublisherIdentifier];
@@ -335,11 +337,13 @@ - (NSString *)versionIdentifier {
@synthesize docsetFallbackURL;
@synthesize docsetFeedName;
@synthesize docsetFeedURL;
+@synthesize docsetPackageURL;
@synthesize docsetMinimumXcodeVersion;
@synthesize docsetPlatformFamily;
@synthesize docsetPublisherIdentifier;
@synthesize docsetPublisherName;
@synthesize docsetCopyrightMessage;
+
@synthesize docsetBundleFilename;
@synthesize docsetAtomFilename;
@synthesize docsetPackageFilename;
View
4 Generating/GBDocSetOutputGenerator.m
@@ -265,8 +265,8 @@ - (BOOL)publishDocSet:(NSError **)error {
NSString *outputDocSetPath = [outputDir stringByAppendingPathComponent:packageName];
NSString *outputAtomPath = [outputDir stringByAppendingPathComponent:atomName];
NSString *signer = self.settings.docsetCertificateSigner;
- NSString *url = self.settings.docsetFeedURL;
- if ([url length] == 0) GBLogWarn(@"--docset-feed-url is required for publishing DocSet; placeholder will be used in '%@'!", outputAtomPath);
+ NSString *url = self.settings.docsetPackageURL;
+ if ([url length] == 0) GBLogWarn(@"--docset-package-url is required for publishing DocSet; placeholder will be used in '%@'!", outputAtomPath);
// Create destination directory.
if (![self initializeDirectoryAtPath:outputDir preserve:[NSArray arrayWithObject:atomName] error:error]) {
View
4 Testing/GBApplicationSettingsProviderTesting.m
@@ -36,6 +36,7 @@ - (void)testPlaceholderReplacements_shouldReplacePlaceholderStringsInAllSupporte
settings.docsetFallbackURL = template;
settings.docsetFeedName = template;
settings.docsetFeedURL = template;
+ settings.docsetPackageURL = template;
settings.docsetMinimumXcodeVersion = template;
settings.docsetPlatformFamily = template;
settings.docsetPublisherIdentifier = template;
@@ -60,6 +61,7 @@ - (void)testPlaceholderReplacements_shouldReplacePlaceholderStringsInAllSupporte
assertThat(settings.docsetFallbackURL, is(expected));
assertThat(settings.docsetFeedName, is(expected));
assertThat(settings.docsetFeedURL, is(expected));
+ assertThat(settings.docsetPackageURL, is(expected));
assertThat(settings.docsetMinimumXcodeVersion, is(expected));
assertThat(settings.docsetPlatformFamily, is(expected));
assertThat(settings.docsetPublisherIdentifier, is(expected));
@@ -89,6 +91,7 @@ - (void)testPlaceholderReplacements_shouldReplaceDocSetFilenames {
settings.docsetFallbackURL = template;
settings.docsetFeedName = template;
settings.docsetFeedURL = template;
+ settings.docsetPackageURL = template;
settings.docsetMinimumXcodeVersion = template;
settings.docsetPlatformFamily = template;
settings.docsetPublisherIdentifier = template;
@@ -106,6 +109,7 @@ - (void)testPlaceholderReplacements_shouldReplaceDocSetFilenames {
assertThat(settings.docsetFallbackURL, is(expected));
assertThat(settings.docsetFeedName, is(expected));
assertThat(settings.docsetFeedURL, is(expected));
+ assertThat(settings.docsetPackageURL, is(expected));
assertThat(settings.docsetMinimumXcodeVersion, is(expected));
assertThat(settings.docsetPlatformFamily, is(expected));
assertThat(settings.docsetPublisherIdentifier, is(expected));
View
28 Testing/GBApplicationTesting.m
@@ -334,6 +334,13 @@ - (void)testDocSetFeedURL_shouldAssignValueToSettings {
assertThat(settings.docsetFeedURL, is(@"value"));
}
+- (void)testDocSetPackageURL_shouldAssignValueToSettings {
+ // setup & execute
+ GBApplicationSettingsProvider *settings = [self settingsByRunningWithArgs:@"--docset-package-url", @"value", nil];
+ // verify
+ assertThat(settings.docsetPackageURL, is(@"value"));
+}
+
- (void)testDocSetFallbackURL_shouldAssignValueToSettings {
// setup & execute
GBApplicationSettingsProvider *settings = [self settingsByRunningWithArgs:@"--docset-fallback-url", @"value", nil];
@@ -383,6 +390,27 @@ - (void)testDocSetCertificateSigner_shouldAssignValueToSettings {
assertThat(settings.docsetCertificateSigner, is(@"value"));
}
+- (void)testDocSetBundleFilename_shouldAssignValueToSettings {
+ // setup & execute
+ GBApplicationSettingsProvider *settings = [self settingsByRunningWithArgs:@"--docset-bundle-filename", @"value", nil];
+ // verify
+ assertThat(settings.docsetBundleFilename, is(@"value"));
+}
+
+- (void)testDocSetAtomFilename_shouldAssignValueToSettings {
+ // setup & execute
+ GBApplicationSettingsProvider *settings = [self settingsByRunningWithArgs:@"--docset-atom-filename", @"value", nil];
+ // verify
+ assertThat(settings.docsetAtomFilename, is(@"value"));
+}
+
+- (void)testDocSetPackageFilename_shouldAssignValueToSettings {
+ // setup & execute
+ GBApplicationSettingsProvider *settings = [self settingsByRunningWithArgs:@"--docset-package-filename", @"value", nil];
+ // verify
+ assertThat(settings.docsetPackageFilename, is(@"value"));
+}
+
#pragma mark Creation methods
- (GBApplicationSettingsProvider *)settingsByRunningWithArgs:(NSString *)first, ... {
Please sign in to comment.
Something went wrong with that request. Please try again.