Merge pull request #3397 from ButterflyNetwork/swift-podspec

[Swift] Fix pod authors in podspec
This commit is contained in:
wing328 2016-07-19 23:00:52 +08:00 committed by GitHub
commit ef857176a6
6 changed files with 35 additions and 4 deletions

View File

@ -38,6 +38,7 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
public static final String POD_SCREENSHOTS = "podScreenshots";
public static final String POD_DOCUMENTATION_URL = "podDocumentationURL";
public static final String SWIFT_USE_API_NAMESPACE = "swiftUseApiNamespace";
public static final String DEFAULT_POD_AUTHORS = "Swagger Codegen";
protected static final String LIBRARY_PROMISE_KIT = "PromiseKit";
protected static final String[] RESPONSE_LIBRARIES = { LIBRARY_PROMISE_KIT };
protected String projectName = "SwaggerClient";
@ -193,6 +194,10 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
}
additionalProperties.put(SWIFT_USE_API_NAMESPACE, swiftUseApiNamespace);
if (!additionalProperties.containsKey(POD_AUTHORS)) {
additionalProperties.put(POD_AUTHORS, DEFAULT_POD_AUTHORS);
}
supportingFiles.add(new SupportingFile("Podspec.mustache", "", projectName + ".podspec"));
supportingFiles.add(new SupportingFile("Cartfile.mustache", "", "Cartfile"));
supportingFiles.add(new SupportingFile("APIHelper.mustache", sourceFolder, "APIHelper.swift"));

View File

@ -5,7 +5,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
s.version = '{{#podVersion}}{{podVersion}}{{/podVersion}}{{^podVersion}}0.0.1{{/podVersion}}'
s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }{{/podSource}}{{#podAuthors}}
s.authors = {{& podAuthors}}{{/podAuthors}}{{#podSocialMediaURL}}
s.authors = '{{podAuthors}}'{{/podAuthors}}{{#podSocialMediaURL}}
s.social_media_url = '{{podSocialMediaURL}}'{{/podSocialMediaURL}}{{#podDocsetURL}}
s.docset_url = '{{podDocsetURL}}'{{/podDocsetURL}}
s.license = {{#podLicense}}{{& podLicense}}{{/podLicense}}{{^podLicense}}'Apache License, Version 2.0'{{/podLicense}}{{#podHomepage}}

View File

@ -42,4 +42,30 @@ public class SwiftCodegenTest {
Assert.assertEquals(swiftCodegen.toSwiftyEnumName("entry_name"), "EntryName");
}
@Test
public void testDefaultPodAuthors() throws Exception {
// Given
// When
swiftCodegen.processOpts();
// Then
final String podAuthors = (String) swiftCodegen.additionalProperties().get(SwiftCodegen.POD_AUTHORS);
Assert.assertEquals(podAuthors, SwiftCodegen.DEFAULT_POD_AUTHORS);
}
@Test
public void testPodAuthors() throws Exception {
// Given
final String swaggerDevs = "Swagger Devs";
swiftCodegen.additionalProperties().put(SwiftCodegen.POD_AUTHORS, swaggerDevs);
// When
swiftCodegen.processOpts();
// Then
final String podAuthors = (String) swiftCodegen.additionalProperties().get(SwiftCodegen.POD_AUTHORS);
Assert.assertEquals(podAuthors, swaggerDevs);
}
}

View File

@ -4,7 +4,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
s.version = '0.0.1'
s.source = { :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' }
s.authors =
s.authors = ''
s.license = 'Apache License, Version 2.0'
s.homepage = 'https://github.com/swagger-api/swagger-codegen'
s.summary = 'PetstoreClient'

View File

@ -9,8 +9,8 @@
"git": "git@github.com:swagger-api/swagger-mustache.git",
"tag": "v1.0.0"
},
"authors": "",
"license": "Apache License, Version 2.0",
"authors": "Apache License, Version 2.0",
"homepage": "https://github.com/swagger-api/swagger-codegen",
"summary": "PetstoreClient",
"source_files": "PetstoreClient/Classes/Swaggers/**/*.swift",

View File

@ -12,7 +12,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Alamofire: 5f730ba29fd113b7ddd71c1e65d0c630acf5d7b0
PetstoreClient: 65dabd411c65d965d5b4c3d5decb909323d1363b
PetstoreClient: 575f4a5776e6a693e70f9d14bae0aabd8c467111
PODFILE CHECKSUM: 84472aca2a88b7f7ed9fcd63e9f5fdb5ad4aab94