swagger_roar 0.0.1.pre.alpha.pre.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzhiYzNlMTMxNjVhZjg2OWZlMDY0MzJiMDMyNzQ4ZDhkNTgzYjUwZg==
5
+ data.tar.gz: !binary |-
6
+ ZDFmOWMyODVmYTE1YzU2ZDc3NzlkNWYxZmNlNDE3ODkwZjQxOGZjYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YjAyNjRjODM5YjAxYjAxNThkYTI5N2YzY2RkZTQxYjI5OTVmNmY3YjY5MjM2
10
+ MjJhZjYxYzI2NDE1ODViMjIxNjgyNGM5NGQ0OGY2ZDhkZGM2NjJjYjM2MTk2
11
+ ZjRmYzc2NWE5OTZjZGRlNTQ4MjNlYzUxZWEzNWQwNTBjN2NjNzE=
12
+ data.tar.gz: !binary |-
13
+ NTYwZjkwOTdjNWNlNmU1NjhlOWQ3YWYwMTU4ZjZiMjYzYjdjNzczZDY2M2Q1
14
+ MDc3NDVhMzBmMzY5ZmY2MzgxYTE2NmU1MTQwMTRlOGIwOGViMTYwMjhiMzZh
15
+ ZDA4MDRkNzM5YzlhNTI5MzM2MzZjNzRhYTcyYjkwYTViMmVmOGE=
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .ruby-gemset
19
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.1.1
5
+ - 2.0.0
6
+ deploy:
7
+ provider: rubygems
8
+ api_key:
9
+ secure: fccKfNOKwv/CErzezggpOGhnZ1Cz/B8EL8jp6kBilfDKsyoL+gzmp+Z187feLQlJpVmV/JS3beGGC47Ih61FwmxlsPFv19hQuMp8K5AXuJCUQc8RqdaSl6FP0FbeqWjNgzm2HxgBukvJpyX/2XhtzREvTXKRcTu5vF6IkahJN8U=
10
+ gem: swagger_roar
11
+ on:
12
+ repo: ytaras/swagger_roar
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in swagger_roar.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara features specs
18
+ watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
24
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Yura Taras
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ [![Build Status](https://travis-ci.org/ytaras/swagger_roar.svg?branch=master)](https://travis-ci.org/ytaras/swagger_roar)
2
+ # SwaggerRoar
3
+
4
+ TODO: Write a gem description
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'swagger_roar'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install swagger_roar
19
+
20
+ ## Usage
21
+
22
+ TODO: Write usage instructions here
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "rspec/core/rake_task"
2
+ require "bundler/gem_tasks"
3
+
4
+ desc "Build"
5
+ task :default => :spec
6
+
7
+ desc "Run tests"
8
+ RSpec::Core::RakeTask.new(:spec) do |task|
9
+ task.rspec_opts = %w(--color --format documentation)
10
+ end
@@ -0,0 +1,23 @@
1
+ require "swagger_roar/version"
2
+
3
+ module SwaggerRoar
4
+ def documentation
5
+ Hash[
6
+ attrs_hash.map { |k, v|
7
+ [k.to_sym, v[:documentation]]
8
+ }
9
+ ]
10
+ end
11
+
12
+ private
13
+
14
+ def attrs_hash
15
+ a = representable_attrs
16
+ return a.to_h if a.respond_to? :to_h
17
+ Hash[
18
+ a.keys.map { |k|
19
+ [k.to_sym, a[k]]
20
+ }
21
+ ]
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module SwaggerRoar
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,12 @@
1
+ module SinglePropertyMapping
2
+ class GrapeEntity < Grape::Entity
3
+ expose :title, documentation: {type: "String", desc: "Status update text"}
4
+ end
5
+
6
+ class RoarRepresenter
7
+ include Roar::Representer::JSON
8
+ extend SwaggerRoar
9
+
10
+ property :title, documentation: {type: "String", desc: "Status update text"}
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ require "sample_mappings/single_propery_mapping"
@@ -0,0 +1,12 @@
1
+ module SinglePropertyMapping
2
+ class GrapeEntity < Grape::Entity
3
+ expose :title, documentation: {type: "String", desc: "Status update text"}
4
+ end
5
+
6
+ class RoarRepresenter
7
+ include Roar::Representer::JSON
8
+ extend SwaggerRoar
9
+
10
+ property :title, documentation: {type: "String", desc: "Status update text"}
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ require "pry"
2
+ require "swagger_roar"
3
+
4
+ RSpec::Matchers.define :generate_swagger_documentation do
5
+ match do |m|
6
+
7
+ grape_doc(m) == roar_doc(m)
8
+ end
9
+
10
+ def grape_doc(m)
11
+ "#{m}::GrapeEntity".constantize.documentation
12
+ end
13
+
14
+ def roar_doc(m)
15
+ "#{m}::RoarRepresenter".constantize.documentation
16
+ end
17
+
18
+ failure_message do |m|
19
+ "expected that Roar doc would be #{roar_doc(m)}, but was #{grape_doc(m)}"
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ require "spec_helper"
2
+ require "grape-entity"
3
+ require "roar/representer/json"
4
+ require "sample_mappings"
5
+
6
+ describe SwaggerRoar do
7
+ describe 'should generate documentation' do
8
+ it 'for single property mapping' do
9
+ expect(SinglePropertyMapping).to generate_swagger_documentation
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ require "spec_helper"
2
+
3
+ describe SwaggerRoar do
4
+ it 'is defined' do
5
+ expect(SwaggerRoar::VERSION).to eq('0.0.1')
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'swagger_roar/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "swagger_roar"
8
+ gem.version = SwaggerRoar::VERSION
9
+ gem.version = "#{gem.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
10
+ gem.authors = ["Yura Taras"]
11
+ gem.email = ["yura.taras@gmail.com"]
12
+ gem.description = %q{DRY in swagger and roar scenario, generate documentation from roar modelss}
13
+ gem.summary = %q{Generate swagger model from roar specification}
14
+ gem.homepage = ""
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ gem.add_development_dependency 'rspec'
21
+ gem.add_development_dependency 'guard'
22
+ gem.add_development_dependency 'guard-rspec'
23
+ gem.add_development_dependency 'rake'
24
+ gem.add_development_dependency 'grape-entity'
25
+ gem.add_development_dependency 'roar'
26
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: swagger_roar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre.alpha.pre.8
5
+ platform: ruby
6
+ authors:
7
+ - Yura Taras
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard-rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: grape-entity
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: roar
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: DRY in swagger and roar scenario, generate documentation from roar modelss
98
+ email:
99
+ - yura.taras@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .rspec
106
+ - .travis.yml
107
+ - Gemfile
108
+ - Guardfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - lib/swagger_roar.rb
113
+ - lib/swagger_roar/version.rb
114
+ - spec/sample_entities/single_propery_mapping.rb
115
+ - spec/sample_mappings.rb
116
+ - spec/sample_mappings/single_propery_mapping.rb
117
+ - spec/spec_helper.rb
118
+ - spec/swagger_roar_spec.rb
119
+ - spec/version_spec.rb
120
+ - swagger_roar.gemspec
121
+ homepage: ''
122
+ licenses: []
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ! '>'
136
+ - !ruby/object:Gem::Version
137
+ version: 1.3.1
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.2.2
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Generate swagger model from roar specification
144
+ test_files:
145
+ - spec/sample_entities/single_propery_mapping.rb
146
+ - spec/sample_mappings.rb
147
+ - spec/sample_mappings/single_propery_mapping.rb
148
+ - spec/spec_helper.rb
149
+ - spec/swagger_roar_spec.rb
150
+ - spec/version_spec.rb