grape_documenter 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.cane +1 -0
- data/.rspec +1 -0
- data/Fudgefile +17 -0
- data/LICENSE +2 -2
- data/README.md +9 -5
- data/RELEASE_NOTES.md +5 -0
- data/Rakefile +10 -1
- data/grape_documenter.gemspec +13 -4
- data/lib/grape_documenter/formatters/textile.rb +20 -19
- data/lib/grape_documenter/generator.rb +1 -0
- data/lib/grape_documenter/namespace_doc.rb +1 -0
- data/lib/grape_documenter/route_doc.rb +61 -1
- data/lib/grape_documenter/version.rb +1 -1
- data/lib/grape_documenter/writer.rb +1 -0
- data/spec/formatters/textile_spec.rb +23 -11
- data/spec/route_doc_spec.rb +189 -0
- data/spec/spec_helper.rb +4 -0
- metadata +162 -9
data/.cane
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--abc-exclude GrapeDocumenter::Formatters::Textile#format
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Fudgefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
exclude = '^\.\/(spec|db)\/'
|
2
|
+
|
3
|
+
task_group :analysis do
|
4
|
+
yard 'stats --list-undoc --readme README.md', :coverage => 41
|
5
|
+
cane :max_width => 147
|
6
|
+
task :flay, :exclude => exclude, :max => 38
|
7
|
+
task :flog, :exclude => exclude, :methods => true, :average => 8, :max => 78.2
|
8
|
+
end
|
9
|
+
|
10
|
+
task_group :standard do
|
11
|
+
rspec :coverage => 91
|
12
|
+
end
|
13
|
+
|
14
|
+
build :default do
|
15
|
+
task_group :analysis
|
16
|
+
task_group :standard
|
17
|
+
end
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2012
|
1
|
+
Copyright (c) 2012 Sage Group Ltd
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# GrapeDocumenter
|
2
|
+
[](http://travis-ci.org/#!/Sage/grape_documenter)
|
3
|
+
[](https://gemnasium.com/Sage/grape_documenter)
|
4
|
+
[](https://codeclimate.com/github/Sage/grape_documenter)
|
2
5
|
|
3
|
-
This adds a task to Rails Applications to generate documentation for Grape APIs.
|
6
|
+
This adds a task to Rails Applications to generate documentation for [Grape](https://github.com/intridea/grape) APIs.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
@@ -20,18 +23,19 @@ Or install it yourself as:
|
|
20
23
|
|
21
24
|
Within the root of you Rails Application run the following rake task...
|
22
25
|
|
23
|
-
|
26
|
+
$ bundle exec grape_documenter 'MyApp::Api' '/path/to/docs' --format='html' --mounted-path='/api'
|
24
27
|
|
25
28
|
The first argument is the a string of the class of Grape::API. If you have multiple APIs within the same application you can run the task as many times as you like with different output paths.
|
26
29
|
|
27
30
|
### Specifying output format
|
28
31
|
|
29
|
-
Currently 2 formats are supported: 'html'; 'textile'. The default is html. You can change the format as shown
|
32
|
+
Currently 2 formats are supported: 'html'; 'textile'. The default is html. You can change the format as shown above.
|
30
33
|
|
31
34
|
## Contributing
|
32
35
|
|
33
36
|
1. Fork it
|
34
37
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
38
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
36
|
-
4.
|
37
|
-
5.
|
39
|
+
4. Verify that all tests pass (`bundle exec fudge build`)
|
40
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
6. Create new Pull Request
|
data/RELEASE_NOTES.md
ADDED
data/Rakefile
CHANGED
@@ -1,2 +1,11 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
|
-
require
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :fudge
|
7
|
+
|
8
|
+
# Test Fudge using Fudge
|
9
|
+
task :fudge do
|
10
|
+
exec 'fudge build 2> /dev/null'
|
11
|
+
end
|
data/grape_documenter.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require File.expand_path('../lib/grape_documenter/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["
|
6
|
-
gem.email = ["
|
5
|
+
gem.authors = ["Sage"]
|
6
|
+
gem.email = ["platform@sage.com"]
|
7
7
|
gem.description = "This adds a task to Rails Applications to generate documentation for Grape APIs."
|
8
8
|
gem.summary = "This adds a task to Rails Applications to generate documentation for Grape APIs."
|
9
9
|
gem.homepage = ""
|
@@ -15,11 +15,20 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = GrapeDocumenter::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency 'grape', '0.2.1'
|
18
|
+
gem.add_dependency 'grape', '>= 0.2.1'
|
19
19
|
gem.add_dependency 'RedCloth'
|
20
20
|
gem.add_dependency 'activesupport'
|
21
21
|
|
22
|
-
gem.add_development_dependency '
|
22
|
+
gem.add_development_dependency 'cane'
|
23
|
+
gem.add_development_dependency 'flay'
|
24
|
+
gem.add_development_dependency 'flog'
|
25
|
+
gem.add_development_dependency 'fudge'
|
23
26
|
gem.add_development_dependency 'guard-rspec'
|
24
27
|
gem.add_development_dependency 'pry'
|
28
|
+
gem.add_development_dependency 'rake'
|
29
|
+
gem.add_development_dependency 'redcarpet'
|
30
|
+
gem.add_development_dependency 'rspec'
|
31
|
+
gem.add_development_dependency 'ruby2ruby'
|
32
|
+
gem.add_development_dependency 'simplecov'
|
33
|
+
gem.add_development_dependency 'yard'
|
25
34
|
end
|
@@ -2,6 +2,7 @@ require 'active_support/core_ext/object/blank'
|
|
2
2
|
|
3
3
|
module GrapeDocumenter
|
4
4
|
module Formatters
|
5
|
+
# Textile
|
5
6
|
class Textile
|
6
7
|
def initialize(structure)
|
7
8
|
@structure = structure
|
@@ -12,58 +13,58 @@ module GrapeDocumenter
|
|
12
13
|
|
13
14
|
output = "h1. #{doc.title}"
|
14
15
|
output << "\n\n"
|
15
|
-
output << resource_navigation
|
16
16
|
output << "\n\n"
|
17
17
|
|
18
18
|
doc.routes.each do |route|
|
19
19
|
output << "\n\n"
|
20
|
-
output << "h2. #{route.
|
20
|
+
output << "h2. #{route.inferred_title}"
|
21
|
+
output << "\n\n"
|
22
|
+
|
23
|
+
output << "\n\n"
|
24
|
+
output << "h3. #{route.http_method}: #{route.path.gsub(':version', doc.version)}"
|
21
25
|
output << "\n\n"
|
22
26
|
|
23
27
|
if route.description.present?
|
24
|
-
output << "h3. Description"
|
25
28
|
output << "\n\n"
|
26
29
|
output << route.description
|
27
30
|
output << "\n\n"
|
28
31
|
end
|
29
32
|
|
30
33
|
if route.params.present?
|
31
|
-
output << "
|
34
|
+
output << "h4. Required Parameters"
|
32
35
|
output << "\n\n"
|
33
36
|
output << tabulate_params(route.params)
|
34
37
|
output << "\n\n"
|
35
38
|
end
|
36
39
|
|
37
40
|
if route.optional_params.present?
|
38
|
-
output << "
|
41
|
+
output << "h4. Optional Parameters"
|
39
42
|
output << "\n\n"
|
40
43
|
output << tabulate_params(route.optional_params)
|
41
44
|
output << "\n\n"
|
42
45
|
end
|
43
|
-
end
|
44
|
-
|
45
|
-
output
|
46
|
-
end
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
navigation = ''
|
47
|
+
output << 'h4. Example Request'
|
48
|
+
output << "\n\n"
|
49
|
+
output << "#{doc.root_path}__request__#{route.http_method.downcase}__#{route.inferred_rails_action}"
|
50
|
+
output << "\n\n"
|
53
51
|
|
54
|
-
|
55
|
-
|
52
|
+
output << 'h4. Example Response'
|
53
|
+
output << "\n\n"
|
54
|
+
output << "#{doc.root_path}__response__#{route.http_method.downcase}__#{route.inferred_rails_action}"
|
55
|
+
output << "\n\n"
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
output
|
59
59
|
end
|
60
60
|
|
61
61
|
def tabulate_params(params)
|
62
|
-
string = "
|
62
|
+
string = "table(parameters).\n"
|
63
|
+
string += "|_.Name|_.Type|_.Description|\n"
|
63
64
|
|
64
65
|
params.each do |k,v|
|
65
66
|
v = {:desc => v} unless v.is_a?(Hash)
|
66
|
-
string << "
|
67
|
+
string << "|\\3. #{k}|\n||#{v[:type]}|#{v[:desc]}|\n"
|
67
68
|
end
|
68
69
|
|
69
70
|
string
|
@@ -1,5 +1,9 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
|
1
3
|
module GrapeDocumenter
|
4
|
+
# Route Doc
|
2
5
|
class RouteDoc
|
6
|
+
include ActiveSupport::Inflector
|
3
7
|
def initialize(route, options = {})
|
4
8
|
@route = route
|
5
9
|
@mounted_path = options[:mounted_path] || ''
|
@@ -10,7 +14,7 @@ module GrapeDocumenter
|
|
10
14
|
end
|
11
15
|
|
12
16
|
def path
|
13
|
-
@mounted_path +
|
17
|
+
@mounted_path + path_without_format
|
14
18
|
end
|
15
19
|
|
16
20
|
def description
|
@@ -24,5 +28,61 @@ module GrapeDocumenter
|
|
24
28
|
def optional_params
|
25
29
|
@route.route_optional_params
|
26
30
|
end
|
31
|
+
|
32
|
+
def inferred_title
|
33
|
+
"To #{inferred_action} #{inferred_resource}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def inferred_rails_action
|
37
|
+
case http_method
|
38
|
+
when 'GET'
|
39
|
+
inferred_singular? ? 'show' : 'index'
|
40
|
+
when 'PUT'
|
41
|
+
'update'
|
42
|
+
when 'POST'
|
43
|
+
'create'
|
44
|
+
when 'DELETE'
|
45
|
+
'destroy'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# get / create / delete /update
|
52
|
+
def inferred_action
|
53
|
+
case http_method
|
54
|
+
when 'GET'
|
55
|
+
'get'
|
56
|
+
when 'PUT'
|
57
|
+
'update'
|
58
|
+
when 'DELETE'
|
59
|
+
'delete'
|
60
|
+
when 'POST'
|
61
|
+
'create'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def inferred_resource
|
66
|
+
items = path_without_format.split('/')
|
67
|
+
resource = items.reject{|i| i.blank? }.reject{|j| j.start_with?(':') }.last
|
68
|
+
|
69
|
+
if inferred_singular?
|
70
|
+
indefinite_articlerize(humanize(resource.singularize))
|
71
|
+
else
|
72
|
+
"a list of #{humanize(resource.pluralize)}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def inferred_singular?
|
77
|
+
path.include?(':id') || http_method == 'POST'
|
78
|
+
end
|
79
|
+
|
80
|
+
def path_without_format
|
81
|
+
@route.route_path.gsub('(.:format)', '')
|
82
|
+
end
|
83
|
+
|
84
|
+
def indefinite_articlerize(word)
|
85
|
+
%w(a e i).include?(word[0].downcase) ? "an #{word}" : "a #{word}"
|
86
|
+
end
|
27
87
|
end
|
28
88
|
end
|
@@ -5,7 +5,10 @@ describe GrapeDocumenter::Formatters::Textile do
|
|
5
5
|
mock('route', :route_method => 'GET',
|
6
6
|
:route_path => '/users',
|
7
7
|
:route_description => 'users description goes here',
|
8
|
-
:route_params => {
|
8
|
+
:route_params => {
|
9
|
+
'id' => {:type => 'integer', :desc => 'user id'},
|
10
|
+
'parameter[with][sub][elements]' => {:type => 'thing', :desc => 'stuff'}
|
11
|
+
},
|
9
12
|
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
10
13
|
end
|
11
14
|
|
@@ -23,24 +26,33 @@ describe GrapeDocumenter::Formatters::Textile do
|
|
23
26
|
subject.format.should include('h1. Users')
|
24
27
|
end
|
25
28
|
|
26
|
-
it 'has an
|
27
|
-
subject.format.should include('
|
29
|
+
it 'has an h3 with method and path' do
|
30
|
+
subject.format.should include('h3. GET: /users')
|
28
31
|
end
|
29
32
|
|
30
|
-
it 'has
|
31
|
-
subject.format.should include('h3. Description')
|
33
|
+
it 'has the description' do
|
32
34
|
subject.format.should include('users description goes here')
|
33
35
|
end
|
34
36
|
|
35
|
-
it 'has an
|
36
|
-
subject.format.should include('
|
37
|
+
it 'has an h4 and the params in a table' do
|
38
|
+
subject.format.should include('h4. Required Parameters')
|
37
39
|
subject.format.should include('|_.Name|_.Type|_.Description|')
|
38
|
-
subject.format.should include(
|
40
|
+
subject.format.should include("|\\3. id|\n||integer|user id|")
|
39
41
|
end
|
40
42
|
|
41
|
-
it 'has an
|
42
|
-
subject.format.should include('
|
43
|
+
it 'has an h4 and the optional_params in a table' do
|
44
|
+
subject.format.should include('h4. Optional Parameters')
|
43
45
|
subject.format.should include('|_.Name|_.Type|_.Description|')
|
44
|
-
subject.format.should include(
|
46
|
+
subject.format.should include("|\\3. foo|\n||string|fooness|")
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'has placeholder for example requests' do
|
50
|
+
subject.format.should include 'h4. Example Request'
|
51
|
+
subject.format.should include 'users__request__get__index'
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'has placeholder for example responses' do
|
55
|
+
subject.format.should include 'h4. Example Response'
|
56
|
+
subject.format.should include 'users__response__get__index'
|
45
57
|
end
|
46
58
|
end
|
data/spec/route_doc_spec.rb
CHANGED
@@ -41,4 +41,193 @@ describe GrapeDocumenter::RouteDoc do
|
|
41
41
|
subject.path.should == '/foo/users'
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe :inferred_title do
|
46
|
+
context 'when it is an index action' do
|
47
|
+
let(:mock_route) do
|
48
|
+
mock('route', :route_method => 'GET',
|
49
|
+
:route_path => '/users',
|
50
|
+
:route_description => 'users description goes here',
|
51
|
+
:route_params => {'id' => {:type => 'integer', :desc => 'user id'}},
|
52
|
+
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
53
|
+
end
|
54
|
+
|
55
|
+
subject { described_class.new mock_route }
|
56
|
+
|
57
|
+
it 'is To get a list of all Users' do
|
58
|
+
subject.inferred_title.should == 'To get a list of Users'
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'when nested' do
|
62
|
+
it 'is To get a list of all Users' do
|
63
|
+
subject.inferred_title.should == 'To get a list of Users'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'when it is an show action' do
|
69
|
+
let(:mock_route) do
|
70
|
+
mock('route', :route_method => 'GET',
|
71
|
+
:route_path => '/users/:id',
|
72
|
+
:route_description => 'users description goes here',
|
73
|
+
:route_params => {'id' => {:type => 'integer', :desc => 'user id'}},
|
74
|
+
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
75
|
+
end
|
76
|
+
|
77
|
+
subject { described_class.new mock_route }
|
78
|
+
|
79
|
+
it 'is To get a User' do
|
80
|
+
subject.inferred_title.should == 'To get a User'
|
81
|
+
end
|
82
|
+
|
83
|
+
context 'when nested' do
|
84
|
+
let(:mock_route) do
|
85
|
+
mock('route', :route_method => 'GET',
|
86
|
+
:route_path => '/some_resource/:their_id/users/:id',
|
87
|
+
:route_description => 'users description goes here',
|
88
|
+
:route_params => {'id' => {:type => 'integer', :desc => 'user id'}},
|
89
|
+
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
90
|
+
end
|
91
|
+
|
92
|
+
subject { described_class.new mock_route }
|
93
|
+
|
94
|
+
it 'is To get a User' do
|
95
|
+
subject.inferred_title.should == 'To get a User'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when resource begins with harsh vowel' do
|
100
|
+
let(:mock_route) do
|
101
|
+
mock('route', :route_method => 'GET',
|
102
|
+
:route_path => '/some_resource/:their_id/account/:id',
|
103
|
+
:route_description => 'users description goes here',
|
104
|
+
:route_params => {'id' => {:type => 'integer', :desc => 'user id'}},
|
105
|
+
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
106
|
+
end
|
107
|
+
|
108
|
+
subject { described_class.new mock_route }
|
109
|
+
|
110
|
+
it 'is To get a User' do
|
111
|
+
subject.inferred_title.should == 'To get an Account'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context 'when resource contains an underscore' do
|
116
|
+
let(:mock_route) do
|
117
|
+
mock('route', :route_method => 'GET',
|
118
|
+
:route_path => '/some_resource/:their_id/user_type/:id',
|
119
|
+
:route_description => 'users description goes here',
|
120
|
+
:route_params => {'id' => {:type => 'integer', :desc => 'user id'}},
|
121
|
+
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
122
|
+
end
|
123
|
+
|
124
|
+
subject { described_class.new mock_route }
|
125
|
+
|
126
|
+
it 'is To get a User' do
|
127
|
+
subject.inferred_title.should == 'To get a User type'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'when it is a create action' do
|
133
|
+
let(:mock_route) do
|
134
|
+
mock('route', :route_method => 'POST',
|
135
|
+
:route_path => '/users',
|
136
|
+
:route_description => 'users description goes here',
|
137
|
+
:route_params => {'id' => {:type => 'integer', :desc => 'user id'}},
|
138
|
+
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
139
|
+
end
|
140
|
+
|
141
|
+
subject { described_class.new mock_route }
|
142
|
+
|
143
|
+
it 'is To create a User' do
|
144
|
+
subject.inferred_title.should == 'To create a User'
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'when it is an update action' do
|
149
|
+
let(:mock_route) do
|
150
|
+
mock('route', :route_method => 'PUT',
|
151
|
+
:route_path => '/users/:id',
|
152
|
+
:route_description => 'users description goes here',
|
153
|
+
:route_params => {'id' => {:type => 'integer', :desc => 'user id'}},
|
154
|
+
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
155
|
+
end
|
156
|
+
|
157
|
+
subject { described_class.new mock_route }
|
158
|
+
|
159
|
+
it 'is To get a User' do
|
160
|
+
subject.inferred_title.should == 'To update a User'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
context 'when it is an destroy action' do
|
165
|
+
let(:mock_route) do
|
166
|
+
mock('route', :route_method => 'DELETE',
|
167
|
+
:route_path => '/users/:id',
|
168
|
+
:route_description => 'users description goes here',
|
169
|
+
:route_params => {'id' => {:type => 'integer', :desc => 'user id'}},
|
170
|
+
:route_optional_params => {'foo' => {:type => 'string', :desc => 'fooness'}})
|
171
|
+
end
|
172
|
+
|
173
|
+
subject { described_class.new mock_route }
|
174
|
+
|
175
|
+
it 'is To delete a User' do
|
176
|
+
subject.inferred_title.should == 'To delete a User'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
describe :inferred_rails_action do
|
182
|
+
context 'when index' do
|
183
|
+
before :each do
|
184
|
+
mock_route.stub(:route_method).and_return('GET')
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'returns index' do
|
188
|
+
subject.inferred_rails_action.should == 'index'
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
context 'when show' do
|
193
|
+
before :each do
|
194
|
+
mock_route.stub(:route_method).and_return('GET')
|
195
|
+
mock_route.stub(:route_path).and_return('/users/:id')
|
196
|
+
end
|
197
|
+
|
198
|
+
it 'returns show' do
|
199
|
+
subject.inferred_rails_action.should == 'show'
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
context 'when create' do
|
204
|
+
before :each do
|
205
|
+
mock_route.stub(:route_method).and_return('POST')
|
206
|
+
end
|
207
|
+
|
208
|
+
it 'returns create' do
|
209
|
+
subject.inferred_rails_action.should == 'create'
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
context 'when update' do
|
214
|
+
before :each do
|
215
|
+
mock_route.stub(:route_method).and_return('PUT')
|
216
|
+
end
|
217
|
+
|
218
|
+
it 'returns update' do
|
219
|
+
subject.inferred_rails_action.should == 'update'
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
context 'when destroy' do
|
224
|
+
before :each do
|
225
|
+
mock_route.stub(:route_method).and_return('DELETE')
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'returns destroy' do
|
229
|
+
subject.inferred_rails_action.should == 'destroy'
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
44
233
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,23 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape_documenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
9
|
-
- Steven Anderson
|
8
|
+
- Sage
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: grape
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
|
-
- - '
|
19
|
+
- - ! '>='
|
21
20
|
- !ruby/object:Gem::Version
|
22
21
|
version: 0.2.1
|
23
22
|
type: :runtime
|
@@ -25,7 +24,7 @@ dependencies:
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
26
25
|
none: false
|
27
26
|
requirements:
|
28
|
-
- - '
|
27
|
+
- - ! '>='
|
29
28
|
- !ruby/object:Gem::Version
|
30
29
|
version: 0.2.1
|
31
30
|
- !ruby/object:Gem::Dependency
|
@@ -61,7 +60,55 @@ dependencies:
|
|
61
60
|
- !ruby/object:Gem::Version
|
62
61
|
version: '0'
|
63
62
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
63
|
+
name: cane
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: flay
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: flog
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: fudge
|
65
112
|
requirement: !ruby/object:Gem::Requirement
|
66
113
|
none: false
|
67
114
|
requirements:
|
@@ -108,20 +155,120 @@ dependencies:
|
|
108
155
|
- - ! '>='
|
109
156
|
- !ruby/object:Gem::Version
|
110
157
|
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: rake
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: redcarpet
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: rspec
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
- !ruby/object:Gem::Dependency
|
207
|
+
name: ruby2ruby
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
210
|
+
requirements:
|
211
|
+
- - ! '>='
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
- !ruby/object:Gem::Dependency
|
223
|
+
name: simplecov
|
224
|
+
requirement: !ruby/object:Gem::Requirement
|
225
|
+
none: false
|
226
|
+
requirements:
|
227
|
+
- - ! '>='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ! '>='
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
238
|
+
- !ruby/object:Gem::Dependency
|
239
|
+
name: yard
|
240
|
+
requirement: !ruby/object:Gem::Requirement
|
241
|
+
none: false
|
242
|
+
requirements:
|
243
|
+
- - ! '>='
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: '0'
|
246
|
+
type: :development
|
247
|
+
prerelease: false
|
248
|
+
version_requirements: !ruby/object:Gem::Requirement
|
249
|
+
none: false
|
250
|
+
requirements:
|
251
|
+
- - ! '>='
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '0'
|
111
254
|
description: This adds a task to Rails Applications to generate documentation for
|
112
255
|
Grape APIs.
|
113
256
|
email:
|
114
|
-
-
|
257
|
+
- platform@sage.com
|
115
258
|
executables:
|
116
259
|
- grape_documenter
|
117
260
|
extensions: []
|
118
261
|
extra_rdoc_files: []
|
119
262
|
files:
|
263
|
+
- .cane
|
120
264
|
- .gitignore
|
265
|
+
- .rspec
|
266
|
+
- Fudgefile
|
121
267
|
- Gemfile
|
122
268
|
- Guardfile
|
123
269
|
- LICENSE
|
124
270
|
- README.md
|
271
|
+
- RELEASE_NOTES.md
|
125
272
|
- Rakefile
|
126
273
|
- bin/grape_documenter
|
127
274
|
- grape_documenter.gemspec
|
@@ -153,15 +300,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
300
|
- - ! '>='
|
154
301
|
- !ruby/object:Gem::Version
|
155
302
|
version: '0'
|
303
|
+
segments:
|
304
|
+
- 0
|
305
|
+
hash: 3847590277066262470
|
156
306
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
307
|
none: false
|
158
308
|
requirements:
|
159
309
|
- - ! '>='
|
160
310
|
- !ruby/object:Gem::Version
|
161
311
|
version: '0'
|
312
|
+
segments:
|
313
|
+
- 0
|
314
|
+
hash: 3847590277066262470
|
162
315
|
requirements: []
|
163
316
|
rubyforge_project:
|
164
|
-
rubygems_version: 1.8.
|
317
|
+
rubygems_version: 1.8.23
|
165
318
|
signing_key:
|
166
319
|
specification_version: 3
|
167
320
|
summary: This adds a task to Rails Applications to generate documentation for Grape
|