lurker 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.hound.yml +3 -0
- data/.rubocop.yml +3 -0
- data/.travis.yml +15 -5
- data/Appraisals +20 -0
- data/Gemfile +11 -7
- data/README.md +46 -19
- data/features/atom_persistent_within_the_same_type.feature +3 -2
- data/features/controller_nested_schema_scaffolding.feature +2 -1
- data/features/controller_schema_scaffolding.feature +2 -1
- data/features/dereferencing_through_inlining.feature +2 -1
- data/features/html_generation.feature +5 -4
- data/features/minitest.feature +3 -2
- data/features/multidomain_support.feature +5 -5
- data/features/multitype_request_support.feature +3 -2
- data/features/partials.feature +6 -5
- data/features/request_nested_schema_scaffolding.feature +3 -3
- data/features/request_schema_scaffolding.feature +3 -2
- data/features/schema_suffixes.feature +2 -2
- data/features/schema_updating_within_test_suite.feature +3 -2
- data/features/step_definitions/additional_cli_steps.rb +7 -1
- data/features/support/env.rb +13 -6
- data/features/test_endpoint.feature +2 -30
- data/gemfiles/rails_32.gemfile +27 -0
- data/gemfiles/rails_40.gemfile +27 -0
- data/gemfiles/rails_41.gemfile +27 -0
- data/gemfiles/rails_42.gemfile +27 -0
- data/lib/lurker.rb +1 -1
- data/lib/lurker/cli.rb +29 -31
- data/lib/lurker/server.rb +7 -6
- data/lib/lurker/spec_helper/rails.rb +2 -0
- data/lib/lurker/spy.rb +16 -2
- data/lib/lurker/templates/public/application.css +1 -5
- data/lib/lurker/templates/public/application.js +12 -12
- data/lib/lurker/version.rb +1 -1
- data/lurker-bw.svg +19 -0
- data/lurker.gemspec +12 -6
- data/tasks/deploy.rake +1 -1
- data/tasks/generate.rake +13 -6
- data/templates/generate_stuff.rb +15 -9
- data/templates/lurker_app.rb +3 -0
- metadata +35 -18
- metadata.gz.sig +0 -0
- data/gemfiles/Gemfile32.ci +0 -6
- data/gemfiles/Gemfile40.ci +0 -6
- data/gemfiles/Gemfile41.ci +0 -6
- data/lib/lurker/engine.rb +0 -14
- data/lib/lurker/templates/stylesheets/bootstrap.css +0 -5831
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d59b249020776fa68c56ed09e6d31ee12d44f3c
|
4
|
+
data.tar.gz: 4bc610bcda4d312275c33559b30dd4ad0267a84a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f4e3f2d653e5bed9e1b1a5e6b25d9fa77ae8c254463535c9849215a4364bb07cd60a80b743e5071f17f44e17eb5ce73dec2b5577aa58ce6917827e7a84076d5
|
7
|
+
data.tar.gz: e342b5e839388820f982e664f24b3602f8f20efb9ba2011f6e4f2640224a84efd61dbd749371ab63a20184e787f819fd4bd0c87139ea04501c9c76ac9717bf98
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
language: ruby
|
2
|
+
sudo: false
|
3
|
+
before_install: gem install bundler
|
2
4
|
gemfile:
|
3
|
-
- gemfiles/
|
4
|
-
- gemfiles/
|
5
|
-
- gemfiles/
|
6
|
-
|
5
|
+
- gemfiles/rails_32.gemfile
|
6
|
+
- gemfiles/rails_40.gemfile
|
7
|
+
- gemfiles/rails_41.gemfile
|
8
|
+
- gemfiles/rails_42.gemfile
|
7
9
|
rvm:
|
8
10
|
- 1.9.3
|
9
11
|
- 2.0.0
|
10
|
-
- 2.1.
|
12
|
+
- 2.1.5
|
13
|
+
- 2.2.0
|
14
|
+
matrix:
|
15
|
+
exclude:
|
16
|
+
# NOTE : incompatible
|
17
|
+
- rvm: 2.2.0
|
18
|
+
gemfile: gemfiles/rails_32.gemfile
|
19
|
+
install: bundle install -j4 --path vendor/bundle
|
20
|
+
|
data/Appraisals
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
appraise 'rails-32' do
|
2
|
+
gem 'rails', '~> 3.2.21'
|
3
|
+
eval ::File.read('Gemfile')
|
4
|
+
end
|
5
|
+
|
6
|
+
appraise 'rails-40' do
|
7
|
+
gem 'rails', '~> 4.0.13'
|
8
|
+
eval ::File.read('Gemfile')
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise 'rails-41' do
|
12
|
+
gem 'rails', '~> 4.1.9'
|
13
|
+
eval ::File.read('Gemfile')
|
14
|
+
end
|
15
|
+
|
16
|
+
appraise 'rails-42' do
|
17
|
+
gem 'rails', '~> 4.2.0'
|
18
|
+
eval ::File.read('Gemfile')
|
19
|
+
end
|
20
|
+
|
data/Gemfile
CHANGED
@@ -1,22 +1,25 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
# Add any gems and groups that you don't want to keep local
|
5
4
|
group :development do
|
6
5
|
# tools
|
7
|
-
gem 'pry-byebug'
|
8
|
-
gem 'pry-
|
9
|
-
gem 'pry-
|
6
|
+
gem 'pry-byebug', platforms: [:mri_20, :mri_21, :mri_22]
|
7
|
+
gem 'pry-debugger', platforms: :mri_19
|
8
|
+
gem 'pry-stack_explorer', platform: :mri
|
9
|
+
gem 'pry-session', platform: :mri
|
10
10
|
# rspec --format fuubar
|
11
11
|
gem 'fuubar'
|
12
12
|
# cucumber --format fuubar
|
13
|
-
gem 'fuubar-cucumber'
|
13
|
+
gem 'fuubar-cucumber'
|
14
14
|
gem 'selenium-webdriver'
|
15
15
|
|
16
16
|
# deploy site
|
17
17
|
gem 'highline'
|
18
18
|
# gem 'coderay', path: '../coderay'
|
19
19
|
|
20
|
+
# multiple rails versions support
|
21
|
+
gem 'appraisal', github: 'razum2um/appraisal', branch: 'master'
|
22
|
+
|
20
23
|
# build template static
|
21
24
|
# run `rake assets:precompile`
|
22
25
|
# to get bundled application.(js|css)
|
@@ -24,8 +27,9 @@ group :development do
|
|
24
27
|
gem 'uglifier'
|
25
28
|
gem 'sass-rails'
|
26
29
|
gem 'coffee-rails'
|
27
|
-
gem 'bootstrap-sass', '~> 3.
|
30
|
+
gem 'bootstrap-sass', '~> 3.3.3'
|
28
31
|
gem 'jquery-rails'
|
29
32
|
gem 'remotipart'
|
30
|
-
gem
|
33
|
+
gem 'launchy'
|
31
34
|
end
|
35
|
+
|
data/README.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
# Lurker
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
<img align="right" width="94" height="71" src="https://cdn.rawgit.com/razum2um/lurker/master/lurker-bw.svg">
|
4
|
+
|
5
|
+
Generates API schemas, validates code against them and creates a handy web interface for testing the API.
|
6
|
+
Works on Rails 3.2, 4.0, 4.1, 4.2 & Ruby 1.9.3, 2.0.0, 2.1.5, 2.2.0
|
5
7
|
|
6
8
|
[![Gem Version][GV img]][Gem Version]
|
7
9
|
[![Build Status][BS img]][Build Status]
|
8
10
|
[![Dependency Status][DS img]][Dependency Status]
|
9
|
-
[![githalytics.com alpha](https://cruel-carlota.pagodabox.com/87ced56265849ad6386c2ba0a78f8038 "githalytics.com")](http://githalytics.com/razum2um/lurker)
|
10
11
|
|
11
12
|
## Installation
|
12
13
|
|
@@ -86,9 +87,10 @@ and it fails if your code changes the api!
|
|
86
87
|
|
87
88
|
The generation of live-documentation is pretty simple:
|
88
89
|
|
89
|
-
bin/lurker convert
|
90
|
-
bin/lurker convert -
|
91
|
-
|
90
|
+
bin/lurker convert # builds html under `Rails.root/public/lurker` to be served under `/lurker` url
|
91
|
+
bin/lurker convert -f pdf # builds `Rails.root/public/lurker/snake_cased_name.pdf`
|
92
|
+
|
93
|
+
For different document root or serving url prefix use `-o` and `-u` options accordingly.
|
92
94
|
|
93
95
|
Let's run your `rails s` and visit [http://localhost:3000/lurker/](http://localhost:3000/lurker/)
|
94
96
|
(or see [demo][demo_app2] for example)
|
@@ -97,8 +99,14 @@ Now, you can test your API on-line (for real)
|
|
97
99
|
|
98
100
|
## [Demo application][demo_app3]
|
99
101
|
|
100
|
-
You can
|
101
|
-
|
102
|
+
You can run this to get the demo running locally:
|
103
|
+
|
104
|
+
git clone https://github.com/razum2um/lurker.git
|
105
|
+
cd lurker
|
106
|
+
bundle exec appraisal rails-42 bundle install
|
107
|
+
bundle exec appraisal rails-42 rake build_example_docs
|
108
|
+
cd tmp/lurker_app_rails_42
|
109
|
+
bin/rails s
|
102
110
|
|
103
111
|
Lurker supports multiple domains (usually `staging` and `production`) and can be deployed
|
104
112
|
statically everywhere as well as be served by current `Rails` instance.
|
@@ -117,12 +125,11 @@ For example:
|
|
117
125
|
- [Pretty submit form to test API endpoints (live) based on schemas][demo_live] (enter a name & press "Submit")
|
118
126
|
- [Handling URLs with dynamic segments][nested_controller_spec_example] (such as `api/v1/:user_id/repos`)
|
119
127
|
- [JSON-Schema partials][partial_example], also in YAML format ([demo][partial_example_demo])
|
120
|
-
- [Generation PDF documentation][pdf_example] (add `gem 'pdfkit'` to Gemfile)
|
128
|
+
- [Generation PDF documentation][pdf_example] (*NOTE*: add `gem 'pdfkit'` to Gemfile)
|
121
129
|
- [Multiple docs for many usecases][suffixes_example] (e.g `:lurker => '...'`)
|
122
130
|
- ERB support inside `.json.yml.erb`
|
123
|
-
- Insert custom content in Markdown into `index.html` (add `gem 'kramdown'` to Gemfile)
|
131
|
+
- Insert custom content in Markdown into `index.html` (*NOTE*: add `gem 'kramdown'` to Gemfile)
|
124
132
|
- Syntax highlighting for sample response (add `gem 'execjs'` to Gemfile)
|
125
|
-
- HTTP-Auth authorization for docs (`mount Lurker::Server.to_rack username: '...', password: '...'`)
|
126
133
|
- Separate API-services generated within one test suite
|
127
134
|
- Capistrano integration
|
128
135
|
- JSON-Schema draft-v4 support
|
@@ -164,7 +171,7 @@ I try to use [Waffle][waffle] to develop this gem, if you want to help:
|
|
164
171
|
don't touch files under `lib/lurker/templates/public` - they are autogenerated
|
165
172
|
and copied to static generated site while `bin/lurker convert`
|
166
173
|
|
167
|
-
rake assets:precompile # to build them
|
174
|
+
bundle exec appraisal rails-42 rake assets:precompile # to build them
|
168
175
|
|
169
176
|
Don't commit `lib/lurker/templates/public/**/*` to avoid conflicts.
|
170
177
|
|
@@ -172,20 +179,40 @@ Don't commit `lib/lurker/templates/public/**/*` to avoid conflicts.
|
|
172
179
|
because they are kept in `lurker_app` directory to be deployed as a demo. Please, write
|
173
180
|
features in a way to generate **new** relevant `lurker/**/*.json.yml` files
|
174
181
|
|
175
|
-
To run cucumber in a clean `lurker` & `html` directories run:
|
176
|
-
|
177
|
-
CLEAN=1 cucumber features
|
178
|
-
|
179
182
|
**NOTE:** template partial `submit_form.html.erb` and it's partials is a big `jsx` script for `React`
|
180
183
|
so there are `<label htmlFor` instead of `<label for>` and `<div className` instead of `<div class`
|
181
184
|
|
185
|
+
### Different Rails versions
|
186
|
+
|
187
|
+
We use [`appraisal`](https://github.com/thoughtbot/appraisal) to test the lib with different Rails versions (from 3.2 up to 4.2):
|
188
|
+
|
189
|
+
# run this to install all gems for all the supported rails versions:
|
190
|
+
bundle exec appraisal install
|
191
|
+
|
192
|
+
# then prefix any rake command with `bundle exec appraisal` and rails version
|
193
|
+
bundle exec appraisal rails-42 rake build_example_docs
|
194
|
+
|
195
|
+
Test apps are getting generated into their's own directory under `tmp/lurker_app...` prefix. They also use
|
196
|
+
separate databases for each rails version both for dev & test env - all prefixed with `lurker_app`
|
197
|
+
|
198
|
+
### Demo app == Testing app
|
199
|
+
|
200
|
+
Currently testing application is using postgresql, because **the same** testing app is deployed to serve demo purposes.
|
201
|
+
|
202
|
+
This is also the reason not to delete anything under `lurker` directory between feature tests
|
203
|
+
and using **different** API endpoints of the testing app. To run cucumber with clean `lurker` & `public/lurker` directories run:
|
204
|
+
|
205
|
+
CLEAN=1 bundle exec appraisal rails-42 cucumber features
|
206
|
+
|
207
|
+
Beware while writing your feature tests for PRs.
|
208
|
+
|
182
209
|
## Acknoledgements
|
183
210
|
|
184
|
-
Sponsored by
|
211
|
+
[![Sponsored by Evil Martians](https://evilmartians.com/badges/sponsored-by-evil-martians.svg)](http://evilmartians.com/)
|
185
212
|
|
186
213
|
This gem is quite opinionated and relies on rails - if you're
|
187
214
|
interested in anything else, please take a look at [api_taster][api_taster] or [fdoc][fdoc],
|
188
|
-
This gem is heavily
|
215
|
+
This gem is heavily inspired by them. Thanks, @square & @fredwu
|
189
216
|
|
190
217
|
Also thanks to
|
191
218
|
|
@@ -221,7 +248,7 @@ Also thanks to
|
|
221
248
|
[demo_app2]: http://lurker.razum2um.me
|
222
249
|
[demo_app3]: http://razum2um.github.io/lurker/
|
223
250
|
[demo_live]: http://lurker.razum2um.me/lurker/api/v1/users-POST.html
|
224
|
-
[pdf_example]: http://razum2um.github.io/lurker/
|
251
|
+
[pdf_example]: http://razum2um.github.io/lurker/lurker_demo_application.pdf
|
225
252
|
[partial_example_demo]: http://razum2um.github.io/lurker/api/v1/users/__user_id/repos-POST.html
|
226
253
|
|
227
254
|
[Gem Version]: https://rubygems.org/gems/lurker
|
@@ -51,9 +51,9 @@ Feature: atom persistent within test suite
|
|
51
51
|
method: PATCH
|
52
52
|
path_info: "/api/v2/users/100"
|
53
53
|
path_params:
|
54
|
-
id: '100'
|
55
54
|
controller: api/v2/users
|
56
55
|
action: update
|
56
|
+
id: '100'
|
57
57
|
"""
|
58
58
|
|
59
59
|
Scenario: json schema tests response parameters and keep atom unchanged using "users/update"
|
@@ -129,8 +129,9 @@ Feature: atom persistent within test suite
|
|
129
129
|
method: PATCH
|
130
130
|
path_info: "/api/v2/users/100"
|
131
131
|
path_params:
|
132
|
-
id: '100'
|
133
132
|
controller: api/v2/users
|
134
133
|
action: update
|
134
|
+
id: '100'
|
135
135
|
|
136
136
|
"""
|
137
|
+
|
@@ -23,9 +23,9 @@ Feature: $ref defererencing through inlining
|
|
23
23
|
method: PATCH
|
24
24
|
path_info: "/api/v3/users/1"
|
25
25
|
path_params:
|
26
|
-
id: '1'
|
27
26
|
controller: api/v3/users
|
28
27
|
action: update
|
28
|
+
id: '1'
|
29
29
|
|
30
30
|
"""
|
31
31
|
And a file named "lurker/definitions/user_request_parameters.json" with:
|
@@ -100,3 +100,4 @@ Feature: $ref defererencing through inlining
|
|
100
100
|
]
|
101
101
|
}
|
102
102
|
"""
|
103
|
+
|
@@ -7,7 +7,7 @@ Feature: html generation
|
|
7
7
|
|
8
8
|
@javascript
|
9
9
|
Scenario: json schema gets generated into html preview using "users/create"
|
10
|
-
Given an empty directory named "
|
10
|
+
Given an empty directory named "public/lurker"
|
11
11
|
And a file named "lurker/api/v1/users-POST.json.yml" with:
|
12
12
|
"""yml
|
13
13
|
---
|
@@ -38,8 +38,8 @@ Feature: html generation
|
|
38
38
|
method: POST
|
39
39
|
path_info: "/api/v1/users.json"
|
40
40
|
path_params:
|
41
|
-
action: create
|
42
41
|
controller: api/v1/users
|
42
|
+
action: create
|
43
43
|
"""
|
44
44
|
|
45
45
|
When I successfully run `bin/lurker convert`
|
@@ -48,8 +48,8 @@ Feature: html generation
|
|
48
48
|
Converting lurker to html
|
49
49
|
using lurker
|
50
50
|
|
51
|
-
create index.html
|
52
|
-
create api/v1/users-POST.html
|
51
|
+
create public/lurker/index.html
|
52
|
+
create public/lurker/api/v1/users-POST.html
|
53
53
|
"""
|
54
54
|
|
55
55
|
When I go to "/lurker"
|
@@ -73,3 +73,4 @@ Feature: html generation
|
|
73
73
|
And I submit it
|
74
74
|
|
75
75
|
Then I should see JSON response with "can't be blank"
|
76
|
+
|
data/features/minitest.feature
CHANGED
@@ -57,8 +57,8 @@ Feature: minitest
|
|
57
57
|
method: DELETE
|
58
58
|
path_info: "/api/v1/users/1/repos/1.json"
|
59
59
|
path_params:
|
60
|
-
action: destroy
|
61
60
|
controller: api/v1/repos
|
61
|
+
action: destroy
|
62
62
|
user_id: '1'
|
63
63
|
id: '1'
|
64
64
|
|
@@ -100,8 +100,8 @@ Feature: minitest
|
|
100
100
|
path_info: "/api/v1/users/1"
|
101
101
|
method: PATCH
|
102
102
|
path_params:
|
103
|
-
action: update
|
104
103
|
controller: api/v1/users
|
104
|
+
action: update
|
105
105
|
id: 1
|
106
106
|
"""
|
107
107
|
|
@@ -136,3 +136,4 @@ Feature: minitest
|
|
136
136
|
"""
|
137
137
|
1 (runs|tests), 1 assertions, 0 failures, 1 errors, 0 skips
|
138
138
|
"""
|
139
|
+
|
@@ -15,8 +15,8 @@ Feature: mutidomain support
|
|
15
15
|
|
16
16
|
@javascript
|
17
17
|
Scenario: json schema gets generated into html preview using "users/destroy"
|
18
|
-
Given an empty directory named "
|
19
|
-
And a file
|
18
|
+
Given an empty directory named "public/lurker"
|
19
|
+
And a service file with:
|
20
20
|
"""yml
|
21
21
|
---
|
22
22
|
basePath: ''
|
@@ -47,8 +47,8 @@ Feature: mutidomain support
|
|
47
47
|
method: DELETE
|
48
48
|
path_info: "/api/v1/users/1.json"
|
49
49
|
path_params:
|
50
|
-
action: destroy
|
51
50
|
controller: api/v1/users
|
51
|
+
action: destroy
|
52
52
|
id: 1
|
53
53
|
"""
|
54
54
|
|
@@ -58,8 +58,8 @@ Feature: mutidomain support
|
|
58
58
|
Converting lurker to html
|
59
59
|
using lurker
|
60
60
|
|
61
|
-
create index.html
|
62
|
-
create api/v1/users/__id-DELETE.html
|
61
|
+
create public/lurker/index.html
|
62
|
+
create public/lurker/api/v1/users/__id-DELETE.html
|
63
63
|
"""
|
64
64
|
|
65
65
|
When I go to "/lurker/api/v1/users/__id-DELETE.html"
|
@@ -52,9 +52,9 @@ Feature: multitype request support
|
|
52
52
|
method: PATCH
|
53
53
|
path_info: "/api/v2/users/1"
|
54
54
|
path_params:
|
55
|
-
id: '1'
|
56
55
|
controller: api/v2/users
|
57
56
|
action: update
|
57
|
+
id: '1'
|
58
58
|
"""
|
59
59
|
|
60
60
|
Scenario: json schema tests response parameters and update request parameters using "users/update"
|
@@ -130,8 +130,9 @@ Feature: multitype request support
|
|
130
130
|
method: PATCH
|
131
131
|
path_info: "/api/v2/users/1"
|
132
132
|
path_params:
|
133
|
-
id: '1'
|
134
133
|
controller: api/v2/users
|
135
134
|
action: update
|
135
|
+
id: '1'
|
136
136
|
|
137
137
|
"""
|
138
|
+
|
data/features/partials.feature
CHANGED
@@ -9,7 +9,7 @@ Feature: partials
|
|
9
9
|
All YAML preprocessing happens behind the scene.
|
10
10
|
|
11
11
|
Scenario: builds html for "repos/create" in request spec with nested partials
|
12
|
-
Given an empty directory named "
|
12
|
+
Given an empty directory named "public/lurker"
|
13
13
|
And a file named "lurker/definitions/user.json.yml" with:
|
14
14
|
"""yml
|
15
15
|
---
|
@@ -61,8 +61,8 @@ Feature: partials
|
|
61
61
|
method: POST
|
62
62
|
path_info: "/api/v1/users/1/repos.json"
|
63
63
|
path_params:
|
64
|
-
action: create
|
65
64
|
controller: api/v1/repos
|
65
|
+
action: create
|
66
66
|
user_id: '1'
|
67
67
|
"""
|
68
68
|
|
@@ -77,7 +77,7 @@ Feature: partials
|
|
77
77
|
|
78
78
|
it "creates a new repo" do
|
79
79
|
expect {
|
80
|
-
post "api/v1/users/#{user.id}/repos.json", repo: { name: 'new-gem' }
|
80
|
+
post "/api/v1/users/#{user.id}/repos.json", repo: { name: 'new-gem' }
|
81
81
|
expect(response).to be_success
|
82
82
|
expect(JSON.parse(response.body)['user']).to eq JSON.parse(user.to_json)
|
83
83
|
}.to change { Repo.count } .by(1)
|
@@ -94,6 +94,7 @@ Feature: partials
|
|
94
94
|
Converting lurker to html
|
95
95
|
using lurker
|
96
96
|
|
97
|
-
create index.html
|
98
|
-
create api/v1/users/__user_id/repos-POST.html
|
97
|
+
create public/lurker/index.html
|
98
|
+
create public/lurker/api/v1/users/__user_id/repos-POST.html
|
99
99
|
"""
|
100
|
+
|