skip overwriting ruby spec files

This commit is contained in:
wing328 2016-04-29 11:10:52 +08:00
parent 6b3735e58d
commit 90442db86d
6 changed files with 29 additions and 5 deletions

View File

@ -264,6 +264,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
String suffix = config.modelTemplateFiles().get(templateName);
String filename = config.modelFileFolder() + File.separator + config.toModelFilename(name) + suffix;
if (!config.shouldOverwrite(filename)) {
LOGGER.info("Skipped overwriting " + filename);
continue;
}
String templateFile = getFullTemplateFile(config, templateName);
@ -286,6 +287,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
String suffix = config.modelTestTemplateFiles().get(templateName);
String filename = config.modelTestFileFolder() + File.separator + config.toModelTestFilename(name) + suffix;
if (!config.shouldOverwrite(filename)) {
LOGGER.info("Skipped overwriting " + filename);
continue;
}
String templateFile = getFullTemplateFile(config, templateName);
@ -308,6 +310,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
String suffix = config.modelDocTemplateFiles().get(templateName);
String filename = config.modelDocFileFolder() + File.separator + config.toModelDocFilename(name) + suffix;
if (!config.shouldOverwrite(filename)) {
LOGGER.info("Skipped overwriting " + filename);
continue;
}
String templateFile = getFullTemplateFile(config, templateName);
@ -393,6 +396,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
for (String templateName : config.apiTemplateFiles().keySet()) {
String filename = config.apiFilename(templateName, tag);
if (!config.shouldOverwrite(filename) && new File(filename).exists()) {
LOGGER.info("Skipped overwriting " + filename);
continue;
}
@ -416,6 +420,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
for (String templateName : config.apiTestTemplateFiles().keySet()) {
String filename = config.apiTestFilename(templateName, tag);
if (!config.shouldOverwrite(filename) && new File(filename).exists()) {
LOGGER.info("Skipped overwriting " + filename);
continue;
}
@ -439,6 +444,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
for (String templateName : config.apiDocTemplateFiles().keySet()) {
String filename = config.apiDocFilename(templateName, tag);
if (!config.shouldOverwrite(filename) && new File(filename).exists()) {
LOGGER.info("Skipped overwriting " + filename);
continue;
}
@ -521,6 +527,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
}
String outputFilename = outputFolder + File.separator + support.destinationFilename;
if (!config.shouldOverwrite(outputFilename)) {
LOGGER.info("Skipped overwriting " + outputFilename);
continue;
}

View File

@ -642,4 +642,11 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
public void setGemAuthorEmail(String gemAuthorEmail) {
this.gemAuthorEmail = gemAuthorEmail;
}
@Override
public boolean shouldOverwrite(String filename) {
// skip spec file as the file might have been updated with new test cases
return super.shouldOverwrite(filename) && !filename.endsWith("_spec.rb");
}
}

View File

@ -8,7 +8,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-04-26T10:05:22.048-07:00
- Build date: 2016-04-29T11:03:36.514+08:00
- Build package: class io.swagger.codegen.languages.RubyClientCodegen
## Installation
@ -57,7 +57,7 @@ require 'petstore'
api_instance = Petstore::FakeApi.new
number = "number_example" # String | None
number = 3.4 # Float | None
double = 1.2 # Float | None

View File

@ -21,7 +21,7 @@ require 'petstore'
api_instance = Petstore::FakeApi.new
number = "number_example" # String | None
number = 3.4 # Float | None
double = 1.2 # Float | None
@ -52,7 +52,7 @@ end
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**number** | **String**| None |
**number** | **Float**| None |
**double** | **Float**| None |
**string** | **String**| None |
**byte** | **String**| None |

View File

@ -14,6 +14,7 @@ Name | Type | Description | Notes
**binary** | **String** | | [optional]
**date** | **Date** | |
**date_time** | **DateTime** | | [optional]
**uuid** | [**UUID**](UUID.md) | | [optional]
**password** | **String** | |

View File

@ -40,6 +40,8 @@ module Petstore
attr_accessor :date_time
attr_accessor :uuid
attr_accessor :password
# Attribute mapping from ruby-style variable name to JSON key.
@ -56,6 +58,7 @@ module Petstore
:'binary' => :'binary',
:'date' => :'date',
:'date_time' => :'dateTime',
:'uuid' => :'uuid',
:'password' => :'password'
}
end
@ -74,6 +77,7 @@ module Petstore
:'binary' => :'String',
:'date' => :'Date',
:'date_time' => :'DateTime',
:'uuid' => :'UUID',
:'password' => :'String'
}
end
@ -130,6 +134,10 @@ module Petstore
self.date_time = attributes[:'dateTime']
end
if attributes.has_key?(:'uuid')
self.uuid = attributes[:'uuid']
end
if attributes.has_key?(:'password')
self.password = attributes[:'password']
end
@ -354,6 +362,7 @@ module Petstore
binary == o.binary &&
date == o.date &&
date_time == o.date_time &&
uuid == o.uuid &&
password == o.password
end
@ -366,7 +375,7 @@ module Petstore
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
def hash
[integer, int32, int64, number, float, double, string, byte, binary, date, date_time, password].hash
[integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password].hash
end
# Builds the object from hash