fdoc 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/fdoc.gemspec +3 -1
- data/lib/fdoc/presenters/base_presenter.rb +12 -4
- data/lib/fdoc/spec_watcher.rb +1 -1
- data/lib/fdoc/templates/endpoint.html.erb +1 -1
- data/lib/fdoc/templates/meta_service.html.erb +1 -1
- data/lib/fdoc/templates/service.html.erb +1 -1
- data/spec/fdoc/presenters/base_presenter_spec.rb +1 -1
- data/spec/fdoc/spec_watcher_spec.rb +9 -0
- metadata +7 -6
data/fdoc.gemspec
CHANGED
@@ -15,6 +15,8 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.summary = "A tool for documenting API endpoints."
|
16
16
|
s.homepage = "http://github.com/square/fdoc"
|
17
17
|
|
18
|
+
s.license = "Apache 2.0"
|
19
|
+
|
18
20
|
s.rdoc_options = ["--charset=UTF-8"]
|
19
21
|
s.extra_rdoc_files = [
|
20
22
|
"README.md"
|
@@ -26,7 +28,7 @@ Gem::Specification.new do |s|
|
|
26
28
|
s.executables << "fdoc"
|
27
29
|
|
28
30
|
s.add_dependency("json")
|
29
|
-
s.add_dependency("json-schema", "
|
31
|
+
s.add_dependency("json-schema", "~> 1.1")
|
30
32
|
s.add_dependency("kramdown")
|
31
33
|
s.add_dependency("thor")
|
32
34
|
|
@@ -15,10 +15,7 @@ class Fdoc::BasePresenter
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def render_erb(erb_name, binding = get_binding)
|
18
|
-
template_path =
|
19
|
-
if !File.exists? template_path
|
20
|
-
template_path = File.join(File.dirname(__FILE__), "../templates", erb_name)
|
21
|
-
end
|
18
|
+
template_path = path_for_template(erb_name)
|
22
19
|
template = ERB.new(File.read(template_path), nil, '-')
|
23
20
|
template.result(binding)
|
24
21
|
end
|
@@ -62,4 +59,15 @@ class Fdoc::BasePresenter
|
|
62
59
|
</#{tag}>
|
63
60
|
EOS
|
64
61
|
end
|
62
|
+
|
63
|
+
protected
|
64
|
+
|
65
|
+
def path_for_template(filename)
|
66
|
+
template_dir = options[:template_directory]
|
67
|
+
template_path = File.join(template_dir, filename) if template_dir
|
68
|
+
if template_path.nil? || !File.exists?(template_path)
|
69
|
+
template_path = File.join(File.dirname(__FILE__), "../templates", filename)
|
70
|
+
end
|
71
|
+
template_path
|
72
|
+
end
|
65
73
|
end
|
data/lib/fdoc/spec_watcher.rb
CHANGED
@@ -74,4 +74,13 @@ describe Fdoc::SpecWatcher do
|
|
74
74
|
@klass.get("/", {:id => 1}.to_json)
|
75
75
|
end
|
76
76
|
end
|
77
|
+
|
78
|
+
it 'should override the existing HTTP verb methods' do
|
79
|
+
klass = Class.new do
|
80
|
+
include Fdoc::SpecWatcher
|
81
|
+
end.new
|
82
|
+
[:get, :post, :put, :patch, :delete].each do |verb|
|
83
|
+
klass.method(verb).owner.should be Fdoc::SpecWatcher
|
84
|
+
end
|
85
|
+
end
|
77
86
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -34,17 +34,17 @@ dependencies:
|
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
none: false
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 1.
|
39
|
+
version: '1.1'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
none: false
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: '1.1'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: kramdown
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,7 +214,8 @@ files:
|
|
214
214
|
- Gemfile
|
215
215
|
- bin/fdoc
|
216
216
|
homepage: http://github.com/square/fdoc
|
217
|
-
licenses:
|
217
|
+
licenses:
|
218
|
+
- Apache 2.0
|
218
219
|
post_install_message:
|
219
220
|
rdoc_options:
|
220
221
|
- --charset=UTF-8
|