swagger-api / swagger-api/swagger-codegen-generators

Add support for generating then gem on a windows platform

Open
#886 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Description

Currently the template for generating the swagger_client_gemspec assums that it is executing in a linuz based platform and utilized the find command to gather all necessary files to include in the gem file. This fails if executing in a windows platform.

Swagger-codegen version

Swagger Codegen 3.0.0

Swagger declaration file content or url
# -*- encoding: utf-8 -*-

=begin
{{> api_info}}
=end

$:.push File.expand_path("../lib", __FILE__)
require "{{gemName}}/version"

Gem::Specification.new do |s|
  s.name        = "{{gemName}}{{^gemName}}{{{appName}}}{{/gemName}}"
  s.version     = {{moduleName}}::VERSION
  s.platform    = Gem::Platform::RUBY
  s.authors     = ["{{gemAuthor}}{{^gemAuthor}}Swagger-Codegen{{/gemAuthor}}"]
  s.email       = ["{{gemAuthorEmail}}{{^gemAuthorEmail}}{{infoEmail}}{{/gemAuthorEmail}}"]
  s.homepage    = "{{gemHomepage}}{{^gemHomepage}}https://github.com/swagger-api/swagger-codegen{{/gemHomepage}}"
  s.summary     = "{{gemSummary}}{{^gemSummary}}{{{appName}}} Ruby Gem{{/gemSummary}}"
  s.description = "{{gemDescription}}{{^gemDescription}}{{{appDescription}}}{{^appDescription}}{{{appName}}} Ruby Gem{{/appDescription}}{{/gemDescription}}"
  {{#gemLicense}}
  s.license     = '{{{gemLicense}}}'
  {{/gemLicense}}
  {{^gemLicense}}
  s.license     = "Unlicense"
  {{/gemLicense}}
  s.required_ruby_version = "{{{gemRequiredRubyVersion}}}{{^gemRequiredRubyVersion}}>= 1.9{{/gemRequiredRubyVersion}}"

  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
  s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'

  s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'

  s.files         = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
  s.test_files    = `find spec/*`.split("\n")
  s.files = Dir.glob('lib/**/*') + %w{Rakefile README.md}  
  s.executables   = []
  s.require_paths = ["lib"]
end
Suggest a fix/enhancement
# -*- encoding: utf-8 -*-

=begin
{{> api_info}}
=end

$:.push File.expand_path("../lib", __FILE__)
require "{{gemName}}/version"

Gem::Specification.new do |s|
  s.name        = "{{gemName}}{{^gemName}}{{{appName}}}{{/gemName}}"
  s.version     = {{moduleName}}::VERSION
  s.platform    = Gem::Platform::RUBY
  s.authors     = ["{{gemAuthor}}{{^gemAuthor}}Swagger-Codegen{{/gemAuthor}}"]
  s.email       = ["{{gemAuthorEmail}}{{^gemAuthorEmail}}{{infoEmail}}{{/gemAuthorEmail}}"]
  s.homepage    = "{{gemHomepage}}{{^gemHomepage}}https://github.com/swagger-api/swagger-codegen{{/gemHomepage}}"
  s.summary     = "{{gemSummary}}{{^gemSummary}}{{{appName}}} Ruby Gem{{/gemSummary}}"
  s.description = "{{gemDescription}}{{^gemDescription}}{{{appDescription}}}{{^appDescription}}{{{appName}}} Ruby Gem{{/appDescription}}{{/gemDescription}}"
  {{#gemLicense}}
  s.license     = '{{{gemLicense}}}'
  {{/gemLicense}}
  {{^gemLicense}}
  s.license     = "Unlicense"
  {{/gemLicense}}
  s.required_ruby_version = "{{{gemRequiredRubyVersion}}}{{^gemRequiredRubyVersion}}>= 1.9{{/gemRequiredRubyVersion}}"

  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
  s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'

  s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
  s.files = Dir.glob('lib/**/*') + %w{Rakefile README.md}  
  s.executables   = []
  s.require_paths = ["lib"]
end

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the generator templates for the shown swagger_client_gemspec content and inspect how generated Ruby gemspec files are assembled. Replace the platform-dependent file discovery behavior with a cross-platform approach, then verify that generated gemspecs include the intended files on Windows as well as Unix-like systems.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.