mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
Rename swagger-client to swagger_client
according to guides from rubygems: http://guides.rubygems.org/name-your-gem/
This commit is contained in:
parent
b140f1f152
commit
fcf1327c1f
@ -8,7 +8,7 @@ import java.util.*;
|
||||
import java.io.File;
|
||||
|
||||
public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected String gemName = "swagger-client";
|
||||
protected String gemName = "swagger_client";
|
||||
protected String moduleName = null;
|
||||
protected String libFolder = "lib";
|
||||
|
||||
@ -25,7 +25,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Ruby module name from the gem name, e.g. use "SwaggerClient" for "swagger-client".
|
||||
* Generate Ruby module name from the gem name, e.g. use "SwaggerClient" for "swagger_client".
|
||||
*/
|
||||
public String generateModuleName() {
|
||||
return camelize(gemName.replaceAll("[^\\w]+", "_"));
|
||||
@ -72,8 +72,8 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
String baseFolder = "lib/" + gemName;
|
||||
String swaggerFolder = baseFolder + "/swagger";
|
||||
String modelFolder = baseFolder + "/models";
|
||||
supportingFiles.add(new SupportingFile("swagger-client.gemspec.mustache", "", gemName + ".gemspec"));
|
||||
supportingFiles.add(new SupportingFile("swagger-client.mustache", "lib", gemName + ".rb"));
|
||||
supportingFiles.add(new SupportingFile("swagger_client.gemspec.mustache", "", gemName + ".gemspec"));
|
||||
supportingFiles.add(new SupportingFile("swagger_client.mustache", "lib", gemName + ".rb"));
|
||||
supportingFiles.add(new SupportingFile("monkey.mustache", baseFolder, "monkey.rb"));
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache", baseFolder, "swagger.rb"));
|
||||
supportingFiles.add(new SupportingFile("swagger/request.mustache", swaggerFolder, "request.rb"));
|
||||
|
@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
swagger-client (1.0.0)
|
||||
swagger_client (1.0.0)
|
||||
addressable (>= 2.2.4)
|
||||
json (>= 1.4.6)
|
||||
typhoeus (>= 0.2.1)
|
||||
@ -56,6 +56,6 @@ DEPENDENCIES
|
||||
autotest-growl
|
||||
autotest-rails-pure
|
||||
rspec (>= 2.5.0)
|
||||
swagger-client!
|
||||
swagger_client!
|
||||
vcr (>= 1.5.1)
|
||||
webmock (>= 1.6.2)
|
||||
|
@ -5,20 +5,20 @@
|
||||
You can build the generated client into a gem:
|
||||
|
||||
```shell
|
||||
gem build swagger-client.gemspec
|
||||
gem build swagger_client.gemspec
|
||||
```
|
||||
|
||||
Then you can either install the gem:
|
||||
|
||||
```shell
|
||||
gem install ./swagger-client-1.0.0.gem
|
||||
gem install ./swagger_client-1.0.0.gem
|
||||
```
|
||||
|
||||
or publish the gem to a gem server like [RubyGems](https://rubygems.org/).
|
||||
|
||||
Finally add this to your Gemfile:
|
||||
|
||||
gem 'swagger-client', '~> 1.0.0'
|
||||
gem 'swagger_client', '~> 1.0.0'
|
||||
|
||||
### Host as a git repository
|
||||
|
||||
@ -27,7 +27,7 @@ https://github.com/xhh/swagger-petstore-ruby
|
||||
|
||||
Then you can reference it in Gemfile:
|
||||
|
||||
gem 'swagger-client', :git => 'https://github.com/xhh/swagger-petstore-ruby.git'
|
||||
gem 'swagger_client', :git => 'https://github.com/xhh/swagger-petstore-ruby.git'
|
||||
|
||||
### Use without installation
|
||||
|
||||
@ -40,7 +40,7 @@ ruby -Ilib script.rb
|
||||
## Configuration
|
||||
|
||||
```ruby
|
||||
require 'swagger-client'
|
||||
require 'swagger_client'
|
||||
|
||||
SwaggerClient::Swagger.configure do |config|
|
||||
config.api_key = 'special-key'
|
||||
|
@ -1,24 +0,0 @@
|
||||
# Swagger common files
|
||||
require 'swagger-client/monkey'
|
||||
require 'swagger-client/swagger'
|
||||
require 'swagger-client/swagger/configuration'
|
||||
require 'swagger-client/swagger/request'
|
||||
require 'swagger-client/swagger/response'
|
||||
require 'swagger-client/swagger/version'
|
||||
|
||||
# Models
|
||||
require 'swagger-client/models/user'
|
||||
require 'swagger-client/models/category'
|
||||
require 'swagger-client/models/pet'
|
||||
require 'swagger-client/models/tag'
|
||||
require 'swagger-client/models/order'
|
||||
|
||||
# APIs
|
||||
require 'swagger-client/api/user_api'
|
||||
require 'swagger-client/api/pet_api'
|
||||
require 'swagger-client/api/store_api'
|
||||
|
||||
module SwaggerClient
|
||||
# Initialize the default configuration
|
||||
Swagger.configuration ||= Swagger::Configuration.new
|
||||
end
|
24
samples/client/petstore/ruby/lib/swagger_client.rb
Normal file
24
samples/client/petstore/ruby/lib/swagger_client.rb
Normal file
@ -0,0 +1,24 @@
|
||||
# Swagger common files
|
||||
require 'swagger_client/monkey'
|
||||
require 'swagger_client/swagger'
|
||||
require 'swagger_client/swagger/configuration'
|
||||
require 'swagger_client/swagger/request'
|
||||
require 'swagger_client/swagger/response'
|
||||
require 'swagger_client/swagger/version'
|
||||
|
||||
# Models
|
||||
require 'swagger_client/models/user'
|
||||
require 'swagger_client/models/category'
|
||||
require 'swagger_client/models/pet'
|
||||
require 'swagger_client/models/tag'
|
||||
require 'swagger_client/models/order'
|
||||
|
||||
# APIs
|
||||
require 'swagger_client/api/user_api'
|
||||
require 'swagger_client/api/pet_api'
|
||||
require 'swagger_client/api/store_api'
|
||||
|
||||
module SwaggerClient
|
||||
# Initialize the default configuration
|
||||
Swagger.configuration ||= Swagger::Configuration.new
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
require 'swagger-client'
|
||||
require 'swagger_client'
|
||||
require 'vcr'
|
||||
require 'typhoeus'
|
||||
require 'json'
|
||||
|
@ -1,9 +1,9 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
$:.push File.expand_path("../lib", __FILE__)
|
||||
require "swagger-client/swagger/version"
|
||||
require "swagger_client/swagger/version"
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "swagger-client"
|
||||
s.name = "swagger_client"
|
||||
s.version = SwaggerClient::Swagger::VERSION
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.authors = ["Zeke Sikelianos", "Tony Tam"]
|
Loading…
Reference in New Issue
Block a user