apipie-rails 0.5.18 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +50 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +24 -1
- data/Gemfile +1 -1
- data/README.rst +5 -5
- data/apipie-rails.gemspec +2 -1
- data/app/controllers/apipie/apipies_controller.rb +1 -1
- data/config/locales/pt-BR.yml +1 -1
- data/{Gemfile.rails42 → gemfiles/Gemfile.rails42} +4 -3
- data/gemfiles/Gemfile.rails42.lock +122 -0
- data/gemfiles/Gemfile.rails52 +10 -0
- data/gemfiles/Gemfile.rails60 +17 -0
- data/gemfiles/Gemfile.rails61 +17 -0
- data/lib/apipie/extractor/recorder.rb +3 -2
- data/lib/apipie/validator.rb +1 -1
- data/lib/apipie/version.rb +1 -1
- data/lib/apipie-rails.rb +0 -4
- data/lib/tasks/apipie.rake +14 -9
- data/rel-eng/gem_release.ipynb +398 -0
- data/spec/controllers/apipies_controller_spec.rb +25 -0
- data/spec/dummy/config/application.rb +0 -3
- data/spec/dummy/config/environments/development.rb +0 -3
- data/spec/dummy/config/environments/production.rb +0 -3
- data/spec/dummy/config/environments/test.rb +0 -5
- data/spec/lib/swagger/response_validation_spec.rb +17 -17
- data/spec/spec_helper.rb +7 -1
- data/spec/support/rails-42-ruby-26.rb +15 -0
- metadata +27 -92
- data/.travis.yml +0 -33
- data/Gemfile.rails41 +0 -7
- data/Gemfile.rails50 +0 -9
- data/Gemfile.rails51 +0 -9
- data/Gemfile.rails60 +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94b525fc29d73244428ef1e25397219f80e703701497ad82c507e9fe0c321300
|
4
|
+
data.tar.gz: 7ba3ffeceb46eb8115d1733820e87bef5a1c1be64bc19a5225c20eae430a476c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eab6988a8d9bebb72a66096e2dbe22f04f83ab5e25070e1cb2b6176c13153b23e3499829af1f378ece9d07abfad18756ce845632ecf9711b6108fab1b8335a4
|
7
|
+
data.tar.gz: 8efcdcbf133414f77cb1cf9c15f34162ad395d42117275b74a68c9b4848723174dc4d79cf1b4c6739fe775324aa94da6d16b38f5fd62b33e0577539483fe8ea4
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: build
|
9
|
+
|
10
|
+
on: [push, pull_request]
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
runs-on: ubuntu-20.04
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
ruby:
|
19
|
+
- 2.6
|
20
|
+
- 2.7
|
21
|
+
- '3.0'
|
22
|
+
- 3.1
|
23
|
+
gemfile:
|
24
|
+
- Gemfile.rails42
|
25
|
+
- Gemfile.rails52 # Min ruby 2.2.2
|
26
|
+
- Gemfile.rails60 # Min ruby 2.5.0
|
27
|
+
- Gemfile.rails61 # Min ruby 2.5.0
|
28
|
+
exclude:
|
29
|
+
- gemfile: Gemfile.rails42
|
30
|
+
ruby: 2.7
|
31
|
+
- gemfile: Gemfile.rails42
|
32
|
+
ruby: '3.0'
|
33
|
+
- gemfile: Gemfile.rails42
|
34
|
+
ruby: 3.1
|
35
|
+
- gemfile: Gemfile.rails52
|
36
|
+
ruby: 2.7
|
37
|
+
- gemfile: Gemfile.rails52
|
38
|
+
ruby: '3.0'
|
39
|
+
- gemfile: Gemfile.rails52
|
40
|
+
ruby: 3.1
|
41
|
+
|
42
|
+
env:
|
43
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}
|
44
|
+
steps:
|
45
|
+
- uses: actions/checkout@v2
|
46
|
+
- uses: ruby/setup-ruby@v1
|
47
|
+
with:
|
48
|
+
ruby-version: ${{ matrix.ruby }}
|
49
|
+
bundler-cache: true
|
50
|
+
- run: bundle exec rspec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,30 @@
|
|
1
1
|
Changelog
|
2
2
|
===========
|
3
3
|
|
4
|
-
[v0.
|
4
|
+
## [v0.6.0](https://github.com/Apipie/apipie-rails/tree/v0.6.0) (2022-03-29)
|
5
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.20...v0.6.0)
|
6
|
+
* Ruby 3.0 fixes [#716](https://github.com/Apipie/apipie-rails/pull/716) (hank-spokeo)
|
7
|
+
* only depends on actionpack and activesupport [#741](https://github.com/Apipie/apipie-rails/pull/741) (Mathieu Jobin)
|
8
|
+
* language fix, fallback to default locale [#726](https://github.com/Apipie/apipie-rails/pull/726) (Alex Coomans)
|
9
|
+
|
10
|
+
## [v0.5.20](https://github.com/Apipie/apipie-rails/tree/v0.5.20) (2022-03-16)
|
11
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.19...v0.5.20)
|
12
|
+
* Update rel-eng (Oleh Fedorenko)
|
13
|
+
* Deprecate travis, run tests on github actions [#740](https://github.com/Apipie/apipie-rails/pull/740) (Mathieu Jobin)
|
14
|
+
* Update validator.rb [#739](https://github.com/Apipie/apipie-rails/pull/739) (Dmytro Budnyk)
|
15
|
+
* Fix wrong number of arguments for recorder#process [#725](https://github.com/Apipie/apipie-rails/pull/725) (rob mathews)
|
16
|
+
* Change "an" to "a" [#723](https://github.com/Apipie/apipie-rails/pull/723) (Naokimi)
|
17
|
+
|
18
|
+
## [v0.5.19](https://github.com/Apipie/apipie-rails/tree/v0.5.19) (2021-07-25)
|
19
|
+
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.18...v0.5.19)
|
20
|
+
* Add rel-eng notebook (Oleh Fedorenko)
|
21
|
+
* Correct the word parâmentros for brazilian portuguese [#687](https://github.com/Apipie/apipie-rails/pull/687) (Diego Noronha)
|
22
|
+
* Fix depreciated file.exists. [#721](https://github.com/Apipie/apipie-rails/pull/721) (Diane Delallée)
|
23
|
+
* Fix typo in changelog [#703](https://github.com/Apipie/apipie-rails/pull/703) (Pavel Rodionov)
|
24
|
+
* Add rails 6.1 support in doc generation [#702](https://github.com/Apipie/apipie-rails/pull/702) (andrew-newell)
|
25
|
+
|
26
|
+
|
27
|
+
[v0.5.18](https://github.com/Apipie/apipie-rails/tree/v0.5.18) (2020-05-20)
|
5
28
|
--------
|
6
29
|
|
7
30
|
[Full Changelog](https://github.com/Apipie/apipie-rails/compare/v0.5.17...v0.5.18)
|
data/Gemfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Gemfile.rails61
|
data/README.rst
CHANGED
@@ -387,20 +387,20 @@ Example:
|
|
387
387
|
end
|
388
388
|
end
|
389
389
|
|
390
|
-
api :POST, "/users", "Create
|
390
|
+
api :POST, "/users", "Create a user"
|
391
391
|
param_group :user
|
392
392
|
def create
|
393
393
|
# ...
|
394
394
|
end
|
395
395
|
|
396
|
-
api :PUT, "/users/:id", "Update
|
396
|
+
api :PUT, "/users/:id", "Update a user"
|
397
397
|
param_group :user
|
398
398
|
def update
|
399
399
|
# ...
|
400
400
|
end
|
401
401
|
|
402
402
|
# v2/users_controller.rb
|
403
|
-
api :POST, "/users", "Create
|
403
|
+
api :POST, "/users", "Create a user"
|
404
404
|
param_group :user, V1::UsersController
|
405
405
|
def create
|
406
406
|
# ...
|
@@ -434,7 +434,7 @@ Example
|
|
434
434
|
end
|
435
435
|
end
|
436
436
|
|
437
|
-
api :POST, "/users", "Create
|
437
|
+
api :POST, "/users", "Create a user"
|
438
438
|
param_group :user
|
439
439
|
def create
|
440
440
|
# ...
|
@@ -446,7 +446,7 @@ Example
|
|
446
446
|
# ...
|
447
447
|
end
|
448
448
|
|
449
|
-
api :PUT, "/users/:id", "Update
|
449
|
+
api :PUT, "/users/:id", "Update a user"
|
450
450
|
param_group :user
|
451
451
|
def update
|
452
452
|
# ...
|
data/apipie-rails.gemspec
CHANGED
@@ -16,7 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_dependency "
|
19
|
+
s.add_dependency "actionpack", ">= 4.1"
|
20
|
+
s.add_dependency "activesupport", ">= 4.1"
|
20
21
|
s.add_development_dependency "rspec-rails", "~> 3.0"
|
21
22
|
s.add_development_dependency "sqlite3"
|
22
23
|
s.add_development_dependency "minitest"
|
@@ -100,7 +100,7 @@ module Apipie
|
|
100
100
|
[:resource, :method, :version].each do |par|
|
101
101
|
if params[par]
|
102
102
|
splitted = params[par].split('.')
|
103
|
-
if splitted.length > 1 && Apipie.configuration.languages.include?(splitted.last)
|
103
|
+
if splitted.length > 1 && (Apipie.configuration.languages.include?(splitted.last) || Apipie.configuration.default_locale == splitted.last)
|
104
104
|
lang = splitted.last
|
105
105
|
params[par].sub!(".#{lang}", '')
|
106
106
|
end
|
data/config/locales/pt-BR.yml
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gemspec
|
3
|
+
gemspec path: '..'
|
4
4
|
|
5
|
-
gem '
|
5
|
+
gem 'actionpack', '~> 4.2.5'
|
6
|
+
gem 'activesupport', '~> 4.2.5'
|
6
7
|
gem 'mime-types', '~> 2.99.3'
|
7
8
|
gem 'sqlite3', '~> 1.3.6'
|
8
9
|
|
@@ -11,4 +12,4 @@ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1.0')
|
|
11
12
|
gem 'rdoc', '~> 4.2.2'
|
12
13
|
end
|
13
14
|
|
14
|
-
gem 'test_engine', path: 'spec/dummy/components/test_engine', group: :test
|
15
|
+
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
@@ -0,0 +1,122 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../spec/dummy/components/test_engine
|
3
|
+
specs:
|
4
|
+
test_engine (0.0.1)
|
5
|
+
|
6
|
+
PATH
|
7
|
+
remote: ..
|
8
|
+
specs:
|
9
|
+
apipie-rails (0.5.20)
|
10
|
+
actionpack (>= 4.1)
|
11
|
+
activesupport (>= 4.1)
|
12
|
+
|
13
|
+
GEM
|
14
|
+
remote: https://rubygems.org/
|
15
|
+
specs:
|
16
|
+
RedCloth (4.3.2)
|
17
|
+
actionpack (4.2.11.3)
|
18
|
+
actionview (= 4.2.11.3)
|
19
|
+
activesupport (= 4.2.11.3)
|
20
|
+
rack (~> 1.6)
|
21
|
+
rack-test (~> 0.6.2)
|
22
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
+
actionview (4.2.11.3)
|
25
|
+
activesupport (= 4.2.11.3)
|
26
|
+
builder (~> 3.1)
|
27
|
+
erubis (~> 2.7.0)
|
28
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
29
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
30
|
+
activesupport (4.2.11.3)
|
31
|
+
i18n (~> 0.7)
|
32
|
+
minitest (~> 5.1)
|
33
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
34
|
+
tzinfo (~> 1.1)
|
35
|
+
addressable (2.8.0)
|
36
|
+
public_suffix (>= 2.0.2, < 5.0)
|
37
|
+
builder (3.2.4)
|
38
|
+
concurrent-ruby (1.1.10)
|
39
|
+
crass (1.0.6)
|
40
|
+
diff-lcs (1.5.0)
|
41
|
+
erubis (2.7.0)
|
42
|
+
i18n (0.9.5)
|
43
|
+
concurrent-ruby (~> 1.0)
|
44
|
+
json-schema (2.8.1)
|
45
|
+
addressable (>= 2.4)
|
46
|
+
loofah (2.15.0)
|
47
|
+
crass (~> 1.0.2)
|
48
|
+
nokogiri (>= 1.5.9)
|
49
|
+
maruku (0.7.3)
|
50
|
+
mime-types (2.99.3)
|
51
|
+
mini_portile2 (2.8.0)
|
52
|
+
minitest (5.15.0)
|
53
|
+
nokogiri (1.13.3)
|
54
|
+
mini_portile2 (~> 2.8.0)
|
55
|
+
racc (~> 1.4)
|
56
|
+
psych (4.0.3)
|
57
|
+
stringio
|
58
|
+
public_suffix (4.0.6)
|
59
|
+
racc (1.6.0)
|
60
|
+
rack (1.6.13)
|
61
|
+
rack-test (0.6.3)
|
62
|
+
rack (>= 1.0)
|
63
|
+
rails-deprecated_sanitizer (1.0.4)
|
64
|
+
activesupport (>= 4.2.0.alpha)
|
65
|
+
rails-dom-testing (1.0.9)
|
66
|
+
activesupport (>= 4.2.0, < 5.0)
|
67
|
+
nokogiri (~> 1.6)
|
68
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
69
|
+
rails-html-sanitizer (1.4.2)
|
70
|
+
loofah (~> 2.3)
|
71
|
+
railties (4.2.11.3)
|
72
|
+
actionpack (= 4.2.11.3)
|
73
|
+
activesupport (= 4.2.11.3)
|
74
|
+
rake (>= 0.8.7)
|
75
|
+
thor (>= 0.18.1, < 2.0)
|
76
|
+
rake (13.0.6)
|
77
|
+
rdoc (6.4.0)
|
78
|
+
psych (>= 4.0.0)
|
79
|
+
rspec-core (3.9.3)
|
80
|
+
rspec-support (~> 3.9.3)
|
81
|
+
rspec-expectations (3.9.4)
|
82
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
+
rspec-support (~> 3.9.0)
|
84
|
+
rspec-mocks (3.9.1)
|
85
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
+
rspec-support (~> 3.9.0)
|
87
|
+
rspec-rails (3.9.1)
|
88
|
+
actionpack (>= 3.0)
|
89
|
+
activesupport (>= 3.0)
|
90
|
+
railties (>= 3.0)
|
91
|
+
rspec-core (~> 3.9.0)
|
92
|
+
rspec-expectations (~> 3.9.0)
|
93
|
+
rspec-mocks (~> 3.9.0)
|
94
|
+
rspec-support (~> 3.9.0)
|
95
|
+
rspec-support (3.9.4)
|
96
|
+
sqlite3 (1.3.13)
|
97
|
+
stringio (3.0.1)
|
98
|
+
thor (1.2.1)
|
99
|
+
thread_safe (0.3.6)
|
100
|
+
tzinfo (1.2.9)
|
101
|
+
thread_safe (~> 0.1)
|
102
|
+
|
103
|
+
PLATFORMS
|
104
|
+
ruby
|
105
|
+
|
106
|
+
DEPENDENCIES
|
107
|
+
RedCloth
|
108
|
+
actionpack (~> 4.2.5)
|
109
|
+
activesupport (~> 4.2.5)
|
110
|
+
apipie-rails!
|
111
|
+
json-schema (~> 2.8)
|
112
|
+
maruku
|
113
|
+
mime-types (~> 2.99.3)
|
114
|
+
minitest
|
115
|
+
rake
|
116
|
+
rdoc
|
117
|
+
rspec-rails (~> 3.0)
|
118
|
+
sqlite3 (~> 1.3.6)
|
119
|
+
test_engine!
|
120
|
+
|
121
|
+
BUNDLED WITH
|
122
|
+
1.17.3
|
@@ -0,0 +1,10 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: '..'
|
4
|
+
|
5
|
+
gem 'actionpack', '~> 5.2.6'
|
6
|
+
gem 'activesupport', '~> 5.2.6'
|
7
|
+
gem 'mime-types', '~> 2.99.3'
|
8
|
+
gem 'rails-controller-testing'
|
9
|
+
|
10
|
+
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
@@ -0,0 +1,17 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: '..'
|
4
|
+
|
5
|
+
gem 'actionpack', '~> 6.0.4'
|
6
|
+
gem 'activesupport', '~> 6.0.4'
|
7
|
+
gem 'mime-types', '~> 3.0'
|
8
|
+
gem 'rails-controller-testing'
|
9
|
+
gem 'rspec-rails', '~> 5.0'
|
10
|
+
|
11
|
+
# net-smtp not included by default in Ruby 3.1
|
12
|
+
# Will be fixed by https://github.com/mikel/mail/pull/1439
|
13
|
+
if Gem.ruby_version >= Gem::Version.new("3.1.0")
|
14
|
+
gem 'net-smtp', require: false
|
15
|
+
end
|
16
|
+
|
17
|
+
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
@@ -0,0 +1,17 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec path: '..'
|
4
|
+
|
5
|
+
gem 'actionpack', '~> 6.1.5'
|
6
|
+
gem 'activesupport', '~> 6.1.5'
|
7
|
+
gem 'mime-types', '~> 3.0'
|
8
|
+
gem 'rails-controller-testing'
|
9
|
+
gem 'rspec-rails', '~> 5.0'
|
10
|
+
|
11
|
+
# net-smtp not included by default in Ruby 3.1
|
12
|
+
# Will be fixed by https://github.com/mikel/mail/pull/1439
|
13
|
+
if Gem.ruby_version >= Gem::Version.new("3.1.0")
|
14
|
+
gem 'net-smtp', require: false
|
15
|
+
end
|
16
|
+
|
17
|
+
gem 'test_engine', path: '../spec/dummy/components/test_engine', group: :test
|
@@ -150,8 +150,8 @@ module Apipie
|
|
150
150
|
end
|
151
151
|
|
152
152
|
module FunctionalTestRecording
|
153
|
-
def process(
|
154
|
-
ret = super
|
153
|
+
def process(*, **) # action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
|
154
|
+
ret = super
|
155
155
|
if Apipie.configuration.record
|
156
156
|
Apipie::Extractor.call_recorder.analyze_functional_test(self)
|
157
157
|
Apipie::Extractor.call_finished
|
@@ -160,6 +160,7 @@ module Apipie
|
|
160
160
|
ensure
|
161
161
|
Apipie::Extractor.clean_call_recorder
|
162
162
|
end
|
163
|
+
ruby2_keywords :process if respond_to?(:ruby2_keywords, true)
|
163
164
|
end
|
164
165
|
end
|
165
166
|
end
|
data/lib/apipie/validator.rb
CHANGED
data/lib/apipie/version.rb
CHANGED
data/lib/apipie-rails.rb
CHANGED
data/lib/tasks/apipie.rake
CHANGED
@@ -172,7 +172,12 @@ namespace :apipie do
|
|
172
172
|
layouts_paths = [File.expand_path("../../../app/views/layouts", __FILE__)]
|
173
173
|
layouts_paths.unshift("#{Rails.root}/app/views/layouts") if File.directory?("#{Rails.root}/app/views/layouts/apipie")
|
174
174
|
|
175
|
-
|
175
|
+
if ActionView::Base.respond_to?(:with_empty_template_cache) && ActionView::Base.respond_to?(:with_view_paths)
|
176
|
+
@apipie_renderer = ActionView::Base.with_empty_template_cache.with_view_paths(base_paths + layouts_paths)
|
177
|
+
else
|
178
|
+
@apipie_renderer = ActionView::Base.new(base_paths + layouts_paths)
|
179
|
+
end
|
180
|
+
|
176
181
|
@apipie_renderer.singleton_class.send(:include, ApipieHelper)
|
177
182
|
return @apipie_renderer
|
178
183
|
end
|
@@ -210,14 +215,14 @@ namespace :apipie do
|
|
210
215
|
end
|
211
216
|
|
212
217
|
def generate_json_page(file_base, doc, lang = nil)
|
213
|
-
FileUtils.mkdir_p(file_base) unless File.
|
218
|
+
FileUtils.mkdir_p(file_base) unless File.exist?(file_base)
|
214
219
|
|
215
220
|
filename = "schema_apipie#{lang_ext(lang)}.json"
|
216
221
|
File.open("#{file_base}/#{filename}", 'w') { |file| file.write(JSON.pretty_generate(doc)) }
|
217
222
|
end
|
218
223
|
|
219
224
|
def generate_swagger_json_page(file_base, doc, sfx="", lang = nil)
|
220
|
-
FileUtils.mkdir_p(file_base) unless File.
|
225
|
+
FileUtils.mkdir_p(file_base) unless File.exist?(file_base)
|
221
226
|
|
222
227
|
path = Pathname.new("#{file_base}/schema_swagger#{sfx}#{lang_ext(lang)}.json")
|
223
228
|
File.open(path, 'w') { |file| file.write(JSON.pretty_generate(doc)) }
|
@@ -226,21 +231,21 @@ namespace :apipie do
|
|
226
231
|
end
|
227
232
|
|
228
233
|
def generate_one_page(file_base, doc, lang = nil)
|
229
|
-
FileUtils.mkdir_p(File.dirname(file_base)) unless File.
|
234
|
+
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))
|
230
235
|
|
231
236
|
render_page("#{file_base}-onepage#{lang_ext(lang)}.html", "static", {:doc => doc[:docs],
|
232
237
|
:language => lang, :languages => Apipie.configuration.languages})
|
233
238
|
end
|
234
239
|
|
235
240
|
def generate_plain_page(file_base, doc, lang = nil)
|
236
|
-
FileUtils.mkdir_p(File.dirname(file_base)) unless File.
|
241
|
+
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))
|
237
242
|
|
238
243
|
render_page("#{file_base}-plain#{lang_ext(lang)}.html", "plain", {:doc => doc[:docs],
|
239
244
|
:language => lang, :languages => Apipie.configuration.languages}, nil)
|
240
245
|
end
|
241
246
|
|
242
247
|
def generate_index_page(file_base, doc, include_json = false, show_versions = false, lang = nil)
|
243
|
-
FileUtils.mkdir_p(File.dirname(file_base)) unless File.
|
248
|
+
FileUtils.mkdir_p(File.dirname(file_base)) unless File.exist?(File.dirname(file_base))
|
244
249
|
versions = show_versions && Apipie.available_versions
|
245
250
|
render_page("#{file_base}#{lang_ext(lang)}.html", "index", {:doc => doc[:docs],
|
246
251
|
:versions => versions, :language => lang, :languages => Apipie.configuration.languages})
|
@@ -251,7 +256,7 @@ namespace :apipie do
|
|
251
256
|
def generate_resource_pages(version, file_base, doc, include_json = false, lang = nil)
|
252
257
|
doc[:docs][:resources].each do |resource_name, _|
|
253
258
|
resource_file_base = File.join(file_base, resource_name.to_s)
|
254
|
-
FileUtils.mkdir_p(File.dirname(resource_file_base)) unless File.
|
259
|
+
FileUtils.mkdir_p(File.dirname(resource_file_base)) unless File.exist?(File.dirname(resource_file_base))
|
255
260
|
|
256
261
|
doc = Apipie.to_json(version, resource_name, nil, lang)
|
257
262
|
doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
|
@@ -265,7 +270,7 @@ namespace :apipie do
|
|
265
270
|
doc[:docs][:resources].each do |resource_name, resource_params|
|
266
271
|
resource_params[:methods].each do |method|
|
267
272
|
method_file_base = File.join(file_base, resource_name.to_s, method[:name].to_s)
|
268
|
-
FileUtils.mkdir_p(File.dirname(method_file_base)) unless File.
|
273
|
+
FileUtils.mkdir_p(File.dirname(method_file_base)) unless File.exist?(File.dirname(method_file_base))
|
269
274
|
|
270
275
|
doc = Apipie.to_json(version, resource_name, method[:name], lang)
|
271
276
|
doc[:docs][:link_extension] = (lang ? ".#{lang}.html" : ".html")
|
@@ -329,7 +334,7 @@ MESSAGE
|
|
329
334
|
desc "Convert your examples from the old yaml into the new json format"
|
330
335
|
task :convert_examples => :environment do
|
331
336
|
yaml_examples_file = File.join(Rails.root, Apipie.configuration.doc_path, "apipie_examples.yml")
|
332
|
-
if File.
|
337
|
+
if File.exist?(yaml_examples_file)
|
333
338
|
#if SafeYAML gem is enabled, it will load examples as an array of Hash, instead of hash
|
334
339
|
if defined? SafeYAML
|
335
340
|
examples = YAML.load_file(yaml_examples_file, :safe=>false)
|