swagger_coverage 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c16b008d455268e65116b5c770e2c92eb6db0071
4
- data.tar.gz: f30a035f4dbb0e2cb97635bd34bd487fb95dcf5a
3
+ metadata.gz: c985edef988e05d377a87ad0cb79c56a4dfe1145
4
+ data.tar.gz: 23bb02c5fa6d764765e33a65799616c3ca462419
5
5
  SHA512:
6
- metadata.gz: a327a1370417816a148c426f17515d05bfc1b9f280d0ac4686fda215267603681de9ad4f60a08c817cef1b3685ac92078e1284d4d7dd41c91eef41098fb6b977
7
- data.tar.gz: 1e41d85847bb796a62f5c002e1c3299a78d7400624d1bd80f1133c56e848cb6988c3ea947b14ca8fc43e0b91787f189ebfde61ea57e35126b4bb0a2102fd2f3a
6
+ metadata.gz: 66f40c56458c050b56be2239085f7a0b187001a5c7e71eccf6728addd64500e34bf3aec7fba93a733ac49a398fb01321da909fe9d7195756a929e60db4b6b3fc
7
+ data.tar.gz: 361ee33f820bb435b409aa004ac209deb90e0b324869a90a51ed10f841e13332617a5f4395d27e4bf87abc8f828ac550aedb7910d5bf4b6ace7b2e3331d36238
data/.gitlab-ci.yml CHANGED
@@ -1,18 +1,38 @@
1
- before_script:
2
- ["bundle install --jobs $(nproc) --path=/cache/bundler"]
3
-
4
1
  stages:
5
2
  - test
3
+ # - deploy
6
4
 
7
5
  unit_tests:
8
6
  stage: test
7
+ image: gitlab.spice.spiceworks.com:4567/base-images/ruby:2.2.5
9
8
  tags:
10
9
  - docker
11
10
  script:
12
- - bundle exec rspec spec\unit_tests
11
+ - gem install rspec
12
+ - rspec spec/unit_tests
13
+
13
14
  functional_tests:
14
15
  stage: test
16
+ image: gitlab.spice.spiceworks.com:4567/base-images/ruby:2.2.5
15
17
  tags:
16
18
  - docker
17
19
  script:
18
- - bundle exec rspec spec\functional_tests
20
+ - gem install rspec
21
+ - rspec spec/functional_tests
22
+
23
+ # deploy:
24
+ # stage: deploy
25
+ # image: ruby:2.1.9-alpine
26
+ # tags:
27
+ # - docker
28
+ # only:
29
+ # - master
30
+ # script:
31
+ # # - docker build -t expect/ruby:2.1.9-alpine .
32
+ # # - docker run expect/ruby:2.1.9-alpine /bin/echo
33
+ # # - docker bundle install --jobs $(nproc) --path=/cache/bundler
34
+ # - bundle install
35
+ # - gem build swagger_coverage.gemspec
36
+ # - chmod +x build.exp
37
+ # - expect build.exp
38
+ # - gem push swagger_coverage-0.0.1.pre.gem -k rubygems
data/Dockerfile ADDED
@@ -0,0 +1,3 @@
1
+ FROM ruby:2.1.9-alpine
2
+
3
+ RUN apk add --update expect
data/build.exp ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/expect
2
+
3
+ spawn bash
4
+ send "curl -u andrewhart https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials\r"
5
+ expect "Enter host password for user 'andrewhart':" { send "AnHa001!\r" }
6
+
7
+ interact
data/lib/code_parser.rb CHANGED
@@ -22,11 +22,11 @@ class CodeParser
22
22
  parsed_routes(output).each do |route|
23
23
  if route[:request_type] =~ /[\/]/
24
24
  request_type << route[:type]
25
- else
25
+ elsif route[:route].include?('/api')
26
26
  request_type << route[:request_type]
27
27
  end
28
28
  end
29
- request_type
29
+ request_type.sort
30
30
  end
31
31
 
32
32
  def parsed_routes(output = raw_routes_output)
@@ -1,3 +1,3 @@
1
1
  module SwaggerCoverage
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -33,7 +33,7 @@ class SwaggerParser
33
33
  request_types_arr << result
34
34
  end
35
35
  end
36
- request_types_arr
36
+ request_types_arr.sort
37
37
  end
38
38
 
39
39
  end
data/swagger.json ADDED
@@ -0,0 +1,177 @@
1
+ {
2
+ "swagger": "2.0",
3
+ "info": {
4
+ "title": "Stratocumulus API",
5
+ "description": "Finally you can use the cloud with Stratocumulus",
6
+ "version": "1.0.0"
7
+ },
8
+ "schemes": [
9
+ "https"
10
+ ],
11
+ "basePath": "/api",
12
+ "produces": [
13
+ "application/json"
14
+ ],
15
+ "paths": {
16
+ "/status": {
17
+ "get": {
18
+ "summary": "Statuses",
19
+ "description": "The Status endpoint returns the currently stored statuses.\n",
20
+ "tags": [
21
+ "Statuses"
22
+ ],
23
+ "responses": {
24
+ "200": {
25
+ "description": "An array of Statuses",
26
+ "schema": {
27
+ "type": "array",
28
+ "items": {
29
+ "$ref": "#/definitions/Status"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ },
35
+ "post": {
36
+ "summary": "Create new Statuses",
37
+ "description": "This endpoint allows the user to create a new status.\n",
38
+ "tags": [
39
+ "Statuses"
40
+ ],
41
+ "responses": {
42
+ "200": {
43
+ "description": "Returns the ID and name of the new status",
44
+ "schema": {
45
+ "$ref": "#/definitions/Status"
46
+ }
47
+ }
48
+ }
49
+ }
50
+ },
51
+ "/status/{id}": {
52
+ "get": {
53
+ "summary": "Get specific Status",
54
+ "description": "This endpoint returns a specific status.\n",
55
+ "tags": [
56
+ "Statuses"
57
+ ],
58
+ "parameters": [
59
+ {
60
+ "name": "id",
61
+ "in": "path",
62
+ "description": "ID of status to fetch",
63
+ "required": true,
64
+ "type": "integer",
65
+ "format": "int64"
66
+ }
67
+ ],
68
+ "responses": {
69
+ "200": {
70
+ "description": "Returns the ID and name of the requested status",
71
+ "schema": {
72
+ "$ref": "#/definitions/Status"
73
+ }
74
+ }
75
+ }
76
+ },
77
+ "patch": {
78
+ "summary": "Update specific Status",
79
+ "description": "This endpoint allws the user to update a specific status.\n",
80
+ "tags": [
81
+ "Statuses"
82
+ ],
83
+ "parameters": [
84
+ {
85
+ "name": "id",
86
+ "in": "path",
87
+ "description": "ID of status to update",
88
+ "required": true,
89
+ "type": "integer"
90
+ },
91
+ {
92
+ "name": "status",
93
+ "in": "formData",
94
+ "description": "Updated status",
95
+ "required": false,
96
+ "type": "string"
97
+ }
98
+ ],
99
+ "responses": {
100
+ "200": {
101
+ "description": "Returns the ID and name of the updated status",
102
+ "schema": {
103
+ "$ref": "#/definitions/Status"
104
+ }
105
+ }
106
+ }
107
+ },
108
+ "put": {
109
+ "summary": "Replace existing Status",
110
+ "description": "This endpoint allws the user to replace an existing status.\n",
111
+ "tags": [
112
+ "Statuses"
113
+ ],
114
+ "parameters": [
115
+ {
116
+ "name": "id",
117
+ "in": "path",
118
+ "description": "ID of status to update",
119
+ "required": true,
120
+ "type": "integer"
121
+ },
122
+ {
123
+ "name": "status",
124
+ "in": "formData",
125
+ "description": "New status",
126
+ "required": true,
127
+ "type": "string"
128
+ }
129
+ ],
130
+ "responses": {
131
+ "200": {
132
+ "description": "Returns the ID and name of the patched status",
133
+ "schema": {
134
+ "$ref": "#/definitions/Status"
135
+ }
136
+ }
137
+ }
138
+ },
139
+ "delete": {
140
+ "summary": "Delete existing Status",
141
+ "description": "This endpoint allws the user to delete an existing status.\n",
142
+ "tags": [
143
+ "Statuses"
144
+ ],
145
+ "parameters": [
146
+ {
147
+ "name": "id",
148
+ "in": "path",
149
+ "description": "ID of status to delete",
150
+ "required": true,
151
+ "type": "integer"
152
+ }
153
+ ],
154
+ "responses": {
155
+ "200": {
156
+ "description": "Not sure what this returns currently"
157
+ }
158
+ }
159
+ }
160
+ }
161
+ },
162
+ "definitions": {
163
+ "Status": {
164
+ "type": "object",
165
+ "properties": {
166
+ "id": {
167
+ "type": "string",
168
+ "description": "Unique identifier representing a status."
169
+ },
170
+ "status": {
171
+ "type": "string",
172
+ "description": "The name of the status."
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "swagger_coverage"
8
8
  spec.version = SwaggerCoverage::VERSION
9
9
  spec.authors = ["Andrew Harthcock"]
10
- spec.email = ["andrewharthcock1@gmail.com"]
10
+ spec.email = ["andrewh@spiceworks.com"]
11
11
 
12
12
  spec.summary = "A tool designed to report on swagger documentation coverage for phoenix and rails APIs."
13
13
  spec.description = "swagger_coverage programmatically compares Swagger API routes to existing routes from the source code and reports the difference(s)"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swagger_coverage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Harthcock
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-07 00:00:00.000000000 Z
11
+ date: 2016-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -27,7 +27,7 @@ dependencies:
27
27
  description: swagger_coverage programmatically compares Swagger API routes to existing
28
28
  routes from the source code and reports the difference(s)
29
29
  email:
30
- - andrewharthcock1@gmail.com
30
+ - andrewh@spiceworks.com
31
31
  executables: []
32
32
  extensions: []
33
33
  extra_rdoc_files: []
@@ -37,16 +37,19 @@ files:
37
37
  - ".rspec"
38
38
  - ".travis.yml"
39
39
  - CODE_OF_CONDUCT.md
40
+ - Dockerfile
40
41
  - Gemfile
41
42
  - LICENSE.txt
42
43
  - README.md
43
44
  - Rakefile
44
45
  - bin/console
45
46
  - bin/setup
47
+ - build.exp
46
48
  - lib/code_parser.rb
47
49
  - lib/swagger_cov.rb
48
50
  - lib/swagger_coverage/version.rb
49
51
  - lib/swagger_parser.rb
52
+ - swagger.json
50
53
  - swagger_coverage.gemspec
51
54
  homepage: https://gitlab.spice.spiceworks.com/spiceworks/swagger-cov.git
52
55
  licenses: