watchdocs-rails 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -6
- data/lib/generators/watchdocs/install_generator.rb +29 -6
- data/lib/watchdocs/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c9fb1e8ab7a57922c4fe9a91887f91fcb6a823d
|
4
|
+
data.tar.gz: dff08d2ed4c6fcbf6074125bed97330208824c96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b2d9370b160061c26ddd88b8e72072732fdee4ecf9b5c11f12e1c707b1251739b3f6535da05057736c6e2a77cf9da2c9ed96c23a94754cf36cb9cc4be99d6c7
|
7
|
+
data.tar.gz: 387cea833226ed95d6419bfa8e0231cc255fa69b543b301ec949876277b3b2b487acd0be379aaa48267770fdb3c47e495fa0b61bff2c53333e055c6ef09f2fb9
|
data/README.md
CHANGED
@@ -18,19 +18,27 @@ and run
|
|
18
18
|
bundle
|
19
19
|
```
|
20
20
|
|
21
|
+
and then fire the installation script
|
22
|
+
|
23
|
+
```
|
24
|
+
rails g watchdocs:install --app_id your_app_id --app_secret your_app_secret
|
25
|
+
```
|
26
|
+
|
27
|
+
and your are good to go! Go to the usage section to for details.
|
28
|
+
|
29
|
+
|
21
30
|
## Configuration
|
22
31
|
|
23
|
-
|
32
|
+
After running installation script you can change the configuration in `config/initializers/watchdocs.rb` which looks like that:
|
24
33
|
|
25
34
|
```ruby
|
26
35
|
Watchdocs::Rails.configure do |c|
|
27
|
-
c.app_id = '
|
28
|
-
c.app_secret = '
|
36
|
+
c.app_id = 'your_app_id'
|
37
|
+
c.app_secret = 'your_app_secret'
|
29
38
|
end
|
30
39
|
```
|
31
40
|
|
32
|
-
|
33
|
-
All configuration settings are listed below.
|
41
|
+
All configuration options are listed below.
|
34
42
|
|
35
43
|
### buffer_size
|
36
44
|
|
@@ -68,7 +76,9 @@ App Secret key which you can get for your Watchdocs project in settings section.
|
|
68
76
|
|
69
77
|
You can enable Watchdocs to record request while executing specs or making manual tests. You can of course do both at the same time if you want.
|
70
78
|
|
71
|
-
|
79
|
+
**NOTE:**: If you've fired installation script, you don't have to copy any code from this section as the script gracefully did it for you.
|
80
|
+
|
81
|
+
### Specs
|
72
82
|
|
73
83
|
If you have some requests specs or features specs that call JSON API then add this line to your `config/environments/test.rb`.
|
74
84
|
|
@@ -128,6 +138,13 @@ VCR.configure do |c|
|
|
128
138
|
end
|
129
139
|
```
|
130
140
|
|
141
|
+
#### Running specs
|
142
|
+
|
143
|
+
Run your specs as usual. Watchdocs will let you know about recorderd API calls.
|
144
|
+
|
145
|
+
**NOTE:** Watchdocs doesn't work with controller specs as they don't actually make full reqests (that's why we don't recommend them). If you have controllers specs only don't worry and go to the next section to see how you can use Watchdocs in your project.
|
146
|
+
|
147
|
+
|
131
148
|
### Development (manual tests)
|
132
149
|
|
133
150
|
If you don't have any request specs yet, you can add the following line to `config/environments/development.rb`.
|
@@ -30,8 +30,8 @@ module Watchdocs
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def install_with_specs
|
33
|
-
if yes?('Do you
|
34
|
-
|
33
|
+
if yes?('Do you want to generate docs on your test run? (requires feature/request specs) [y,n]')
|
34
|
+
environment(nil, env: 'test') do
|
35
35
|
'config.middleware.insert(0, Watchdocs::Rails::Middleware)'
|
36
36
|
end
|
37
37
|
if yes?(' Do you test with RSpec? [y,n]')
|
@@ -78,8 +78,8 @@ module Watchdocs
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def install_with_runtime
|
81
|
-
if yes?('Do you want to
|
82
|
-
|
81
|
+
if yes?('Do you want to generate docs from your local API calls? (in development env) [y,n]')
|
82
|
+
environment(nil, env: 'development') do
|
83
83
|
'config.middleware.insert(0, Watchdocs::Rails::Middleware)'
|
84
84
|
end
|
85
85
|
if yes?(' Do you use Procfile to run your app? [y,n]')
|
@@ -104,8 +104,31 @@ module Watchdocs
|
|
104
104
|
END
|
105
105
|
puts info.light_blue
|
106
106
|
end
|
107
|
-
puts 'Setup is completed. Now run your app and make some requests!
|
108
|
-
|
107
|
+
puts 'Setup is completed. Now run your app and make some requests! Check app.watchdocs.io after a minute or so.'.green
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def environment(data = nil, options = {})
|
113
|
+
sentinel = /class [a-z_:]+ < Rails::Application/i
|
114
|
+
env_file_sentinel = /\.configure do/
|
115
|
+
data = yield if !data && block_given?
|
116
|
+
|
117
|
+
in_root do
|
118
|
+
if options[:env].nil?
|
119
|
+
inject_into_file 'config/application.rb',
|
120
|
+
"\n #{data}",
|
121
|
+
after: sentinel,
|
122
|
+
verbose: false
|
123
|
+
else
|
124
|
+
Array(options[:env]).each do |env|
|
125
|
+
inject_into_file "config/environments/#{env}.rb",
|
126
|
+
"\n #{data}",
|
127
|
+
after: env_file_sentinel,
|
128
|
+
verbose: false
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
109
132
|
end
|
110
133
|
end
|
111
134
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watchdocs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mazikwyry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|