swagger_yard-rails 0.3.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 282e5f9bbc7d5b2c59bdfdf2240c48b70912bb6a
4
- data.tar.gz: ed70441ac1bf98a36b0005bd0ace4bc622847b16
3
+ metadata.gz: 13516255456149e613e10bd2f7c28b59f1b85f73
4
+ data.tar.gz: bdf748d685a604b9e5757e8ab0ab2fede35d847e
5
5
  SHA512:
6
- metadata.gz: e605ac864174175af0a3c40a57720baae8a6d710756bb0faa6281112090ade40fc7351cc8e0cd94afe96616f6c4e8b515f7e4b32aec151095fd274a52b3164b8
7
- data.tar.gz: e0745dcda80f5dc9dfbe04708d139d4efa7dc9f7f036873f62f9d39425b9b5a8be50560cda6c2baa7fa3edb89dd6756889d0dd7529c10e5496779ca256e5f028
6
+ metadata.gz: 0eb473661774dde968477c926bdff169b657efb48bfcb8b86f5a65888a80f695f1bf4d3ba77ffc2425b082b7558c3bc153a4050171b47ddef4ecbdf23823a60f
7
+ data.tar.gz: dd72f714272a6e1e84234e80d736a39135a87b705cda25bf2cc48ef375cd23352e8700ca7e9ab01f620a1e26fb6a93a7c79c18902ed4dc976ee4491983c3c87e
@@ -1,5 +1,9 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.2.2
5
- before_install: gem install bundler -v 1.10.6
4
+ - 2.2.7
5
+
6
+ env:
7
+ - RAILS_VERSION='~>4.2' # 4.2 series
8
+ - RAILS_VERSION='~>5.0.0' # 5.0 series
9
+ - RAILS_VERSION='>=5.0.0' # latest 5.x series
@@ -1,5 +1,11 @@
1
1
  # SwaggerYard-Rails Changelog
2
2
 
3
+ ## 1.0.0 28-06-2018 ##
4
+
5
+ * Add OpenAPI stuff -- `/swagger/openapi.json` route and `openapi:json` task
6
+ * Bump dependency on swagger_yard to >= 1.0.0
7
+ * Test on Rails 4.2, Rails 5.0, and latest Rails release
8
+
3
9
  ## 0.3.3 25-07-2016 ##
4
10
 
5
11
  * Descend into engine routes when searching for matches. This allows documented
data/Gemfile CHANGED
@@ -2,3 +2,13 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in swagger_yard-rails.gemspec
4
4
  gemspec
5
+
6
+ if ENV['RAILS_VERSION']
7
+ gem 'rails', ENV['RAILS_VERSION']
8
+ elsif File.exist?('Gemfile.lock')
9
+ # use whatever version is currently installed
10
+ version = File.read('Gemfile.lock').scan(/DEPENDENCIES.*/m).first[/rails \((.*?)\)/m, 1]
11
+ gem 'rails', version
12
+ else
13
+ gem 'rails', '~> 4.2'
14
+ end
@@ -9,6 +9,10 @@ module SwaggerYard
9
9
  def index
10
10
  render :json => Swagger.new.to_h
11
11
  end
12
+
13
+ def openapi
14
+ render :json => OpenAPI.new.to_h
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "swagger_yard/rails"
3
+ require File.expand_path('../../spec/spec_helper', __FILE__)
5
4
 
6
5
  # You can add fixtures and/or initialization code here to make experimenting
7
6
  # with your gem easier. You can also use a different console, if you like.
@@ -3,6 +3,7 @@ SwaggerYard::Rails::Engine.routes.draw do
3
3
 
4
4
  scope default: {format: 'json'} do
5
5
  get '/swagger', to: 'swagger#index'
6
+ get '/openapi', to: 'swagger#openapi'
6
7
  get '/api', to: 'swagger#index'
7
8
  end
8
9
  end
@@ -19,7 +19,8 @@ module SwaggerYard
19
19
  info = yard_info(yard_obj)
20
20
  route_arr = find_route(info)
21
21
  route = route_arr.last
22
- method = route.verb.source.gsub(/[$^]/, '')
22
+ method = route.verb
23
+ method = method.source.gsub(/[$^]/, '') if method.respond_to?(:source)
23
24
 
24
25
  raise Error, "no http method: #{info.inspect}" if method.empty?
25
26
 
@@ -5,3 +5,11 @@ namespace :swagger do
5
5
  end
6
6
  end
7
7
  end
8
+
9
+ namespace :openapi do
10
+ task :json, [:filename] => :environment do |t, args|
11
+ File.open(args[:filename] || "openapi.json", "w") do |f|
12
+ f.puts JSON.pretty_generate(SwaggerYard::OpenAPI.new.to_h)
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module SwaggerYard
2
2
  module Rails
3
- VERSION = "0.3.3"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  spec.add_dependency "rails", ">= 3.2.8"
31
- spec.add_dependency "swagger_yard", "~> 0.2"
31
+ spec.add_dependency "swagger_yard", ">= 1.0.0"
32
32
 
33
33
  spec.add_development_dependency "bundler", "~> 1.10"
34
34
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagger_yard-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2018-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: swagger_yard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.2'
33
+ version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.2'
40
+ version: 1.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  requirements: []
187
187
  rubyforge_project:
188
- rubygems_version: 2.4.8
188
+ rubygems_version: 2.4.5.1
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Rails engine to parse and render json for Swagger UI