fdoc 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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", ">= 1.0.1")
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 = File.join(options[:template_directory], erb_name)
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
@@ -2,7 +2,7 @@ require 'json'
2
2
 
3
3
  module Fdoc
4
4
  module SpecWatcher
5
- VERBS = [:get, :post, :put, :delete]
5
+ VERBS = [:get, :post, :put, :patch, :delete]
6
6
 
7
7
  VERBS.each do |verb|
8
8
  define_method(verb) do |*params|
@@ -4,7 +4,7 @@
4
4
  <title>
5
5
  <%= title %>
6
6
  </title>
7
-
7
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
8
8
  <link rel="stylesheet" type="text/css" href="<%= css_path %>" />
9
9
  </head>
10
10
  <body>
@@ -4,7 +4,7 @@
4
4
  <title>
5
5
  <%= @meta_service.name %>
6
6
  </title>
7
-
7
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
8
8
  <link rel="stylesheet" type="text/css" href="<%= css_path %>" />
9
9
  </head>
10
10
  <body>
@@ -4,7 +4,7 @@
4
4
  <title>
5
5
  <%= @service.name %>
6
6
  </title>
7
-
7
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
8
8
  <link rel="stylesheet" type="text/css" href="<%= css_path %>" />
9
9
  </head>
10
10
  <body>
@@ -9,7 +9,7 @@ describe Fdoc::BasePresenter do
9
9
  end
10
10
 
11
11
  subject {
12
- Fdoc::SamplePresenter.new template_directory: 'templates'
12
+ Fdoc::SamplePresenter.new :template_directory => 'templates'
13
13
  }
14
14
 
15
15
  context "#render_erb" do
@@ -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.1
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.0.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.0.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