apispec 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/apispec-0.0.3.gem ADDED
Binary file
@@ -29,8 +29,8 @@ class APISpec::Namespace < APISpec::Node
29
29
  path_parts = path.split(".")
30
30
  node = self
31
31
  while path_parts.any?
32
- node = node.find_node(path_parts.shift)
33
- raise ReferenceError.new("#{path} not found in #{self.to_s}") unless node
32
+ part = path_parts.shift
33
+ node = node.find_node(part)
34
34
  end
35
35
  node
36
36
  end
@@ -57,7 +57,26 @@ class APISpec::Namespace < APISpec::Node
57
57
  end
58
58
 
59
59
  def find_node(name)
60
- @nodes[name]
60
+ node = @nodes[name]
61
+ if node
62
+ node
63
+ else
64
+ similar_node = self.find_similar_node(name)
65
+ if similar_node
66
+ raise ReferenceError.new("#{name} not found in #{self.to_s}, maybe you meant #{similar_node} (case-sensitive!)")
67
+ else
68
+ raise ReferenceError.new("#{name} not found in #{self.to_s}")
69
+ end
70
+ end
71
+ end
72
+
73
+ def find_similar_node(name)
74
+ @nodes.each do |node_name,node_value|
75
+ if node_name.downcase == name.downcase
76
+ return node_name
77
+ end
78
+ end
79
+ nil
61
80
  end
62
81
 
63
82
  def to_s
@@ -23,7 +23,7 @@ class APISpec::Resource
23
23
  end
24
24
 
25
25
  def highlighted_path
26
- "#{@interface.base_uri}/#{@path}".gsub(/:[^\/0-9][^\/]*/) do |value|
26
+ "#{@interface.base_uri}/#{@path}".gsub(/:[^\/0-9][^\/&\?]*/) do |value|
27
27
  "<span class=\"parameter\">#{value}</span>"
28
28
  end
29
29
  end
@@ -1,5 +1,5 @@
1
1
  module APISpec
2
- TINY = 3
2
+ TINY = 4
3
3
  MINOR = 0
4
4
  MAJOR = 0
5
5
  VERSION = [MAJOR, MINOR, TINY].join(".")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apispec
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vincent Landgraf
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-28 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-09-28 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: RedCloth
@@ -115,7 +114,6 @@ files:
115
114
  - templates/message.html.erb
116
115
  - templates/object.html.erb
117
116
  - templates/resource.html.erb
118
- has_rdoc: true
119
117
  homepage: http://github.com/threez/apispec/
120
118
  licenses: []
121
119
 
@@ -145,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
143
  requirements: []
146
144
 
147
145
  rubyforge_project:
148
- rubygems_version: 1.6.2
146
+ rubygems_version: 1.8.10
149
147
  signing_key:
150
148
  specification_version: 3
151
149
  summary: A ruby based http/rest documentation generator