yard-rest-plugin 0.2.3 → 0.2.4

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/README.markdown CHANGED
@@ -54,20 +54,6 @@ The rationale here is that you are documenting external services (as represented
54
54
  # @argument ["@assigned"|"@complete"|"!@complete"] search Return samples that are assigned, complete, or
55
55
  # uncomplete.
56
56
  #
57
- # @example_request
58
- # <samples type="array">
59
- # <sample>
60
- # <id>961</id>
61
- # <name>My Sample</name>
62
- # <state>complete</state>
63
- # <last_unassigned_user_id type="integer"></last_unassigned_user_id>
64
- # <resource_id type="integer">127</resource_id>
65
- # <notes></notes>
66
- # <updated_at type="datetime">2010-03-09T20:43:29Z</updated_at>
67
- # <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
68
- # </interval>
69
- # <intervals>
70
- #
71
57
  # @example_response
72
58
  # <samples type="array">
73
59
  # <sample>
@@ -79,15 +65,15 @@ The rationale here is that you are documenting external services (as represented
79
65
  # <notes></notes>
80
66
  # <updated_at type="datetime">2010-03-09T20:43:29Z</updated_at>
81
67
  # <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
82
- # </interval>
83
- # <intervals>
68
+ # </sample>
69
+ # <samples>
84
70
  #
85
- # @response_field id A unique ID identifying the Sample
86
- # @response_field name The name of the sample
87
- # @response_field state The current status of the Sample. Can be complete, uncomplete, etc.
88
- # @response_field notes Any notes given for the sample
89
- # @response_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
90
- # @response_field created_at The Date/Time (in ISO8601) that the Sample was created
71
+ # @response_field [Integer] id A unique ID identifying the Sample
72
+ # @response_field [String] name The name of the sample
73
+ # @response_field [String] state The current status of the Sample. Can be complete, uncomplete, etc.
74
+ # @response_field [String] notes Any notes given for the sample
75
+ # @response_field [DateTime] updated_at The Date/Time (in ISO8601) that the Sample was last updated
76
+ # @response_field [DateTime] created_at The Date/Time (in ISO8601) that the Sample was created
91
77
  #
92
78
  def index
93
79
  end
@@ -116,12 +102,12 @@ The rationale here is that you are documenting external services (as represented
116
102
  # <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
117
103
  # </sample>
118
104
  #
119
- # @request_field id A unique ID identifying the Sample
120
- # @request_field name The name of the sample
121
- # @request_field state The current status of the Sample. Can be complete, uncomplete, etc.
122
- # @request_field note_attributes Any notes given for the sample that will be created
123
- # @request_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
124
- # @request_field created_at The Date/Time (in ISO8601) that the Sample was created
105
+ # @request_field [Integer] id A unique ID identifying the Sample
106
+ # @request_field [String] name The name of the sample
107
+ # @request_field [String] state The current status of the Sample. Can be complete, uncomplete, etc.
108
+ # @request_field [String] note_attributes Any notes given for the sample that will be created
109
+ # @request_field [DateTime] updated_at The Date/Time (in ISO8601) that the Sample was last updated
110
+ # @request_field [DateTime] created_at The Date/Time (in ISO8601) that the Sample was created
125
111
  #
126
112
  # @example_response
127
113
  # <sample>
@@ -139,12 +125,12 @@ The rationale here is that you are documenting external services (as represented
139
125
  # <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
140
126
  # </sample>
141
127
  #
142
- # @response_field id A unique ID identifying the Sample
143
- # @response_field name The name of the sample
144
- # @response_field state The current status of the Sample. Can be complete, uncomplete, etc.
145
- # @response_field notes Any notes given for the sample
146
- # @response_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
147
- # @response_field created_at The Date/Time (in ISO8601) that the Sample was created
128
+ # @response_field [Integer] id A unique ID identifying the Sample
129
+ # @response_field [String] name The name of the sample
130
+ # @response_field [String] state The current status of the Sample. Can be complete, uncomplete, etc.
131
+ # @response_field [String] notes Any notes given for the sample
132
+ # @response_field [DateTime] updated_at The Date/Time (in ISO8601) that the Sample was last updated
133
+ # @response_field [DateTime] created_at The Date/Time (in ISO8601) that the Sample was created
148
134
  #
149
135
  def create
150
136
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -11,7 +11,7 @@ class SampleController
11
11
  # @url [GET] /samples/index.[format]?[arguments]
12
12
  # @url [GET] /samples.[format]?[arguments]
13
13
  #
14
- # @argument [String] format Only "xml" is support at this time.
14
+ # @argument [String] format Only "xml" is supported at this time.
15
15
  # @argument [String] name The name of the sample
16
16
  # @argument [String] reource The resource that sample belongs to
17
17
  # @argument ["@assigned"|"@complete"|"!@complete"] search Return jobs that are assigned, complete, or
@@ -28,15 +28,15 @@ class SampleController
28
28
  # <notes></notes>
29
29
  # <updated_at type="datetime">2010-03-09T20:43:29Z</updated_at>
30
30
  # <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
31
- # </interval>
32
- # <intervals>
31
+ # </sample>
32
+ # <samples>
33
33
  #
34
- # @response_field id A unique ID identifying the Sample
35
- # @response_field name The name of the sample
36
- # @response_field state The current status of the Sample. Can be complete, uncomplete, etc.
37
- # @response_field notes Any notes given for the sample
38
- # @response_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
39
- # @response_field created_at The Date/Time (in ISO8601) that the Sample was created
34
+ # @response_field [Integer] id A unique ID identifying the Sample
35
+ # @response_field [String] name The name of the sample
36
+ # @response_field [String] state The current status of the Sample. Can be complete, uncomplete, etc.
37
+ # @response_field [String] notes Any notes given for the sample
38
+ # @response_field [DateTime] updated_at The Date/Time (in ISO8601) that the Sample was last updated
39
+ # @response_field [DateTime] created_at The Date/Time (in ISO8601) that the Sample was created
40
40
  #
41
41
  def index
42
42
  end
@@ -52,7 +52,7 @@ class SampleController
52
52
  #
53
53
  # @url [POST] /samples.[format]?[arguments]
54
54
  #
55
- # @argument [String] format Only "xml" is support at this time.
55
+ # @argument [String] format Only "xml" is supported at this time.
56
56
  #
57
57
  # @example_request
58
58
  # <sample>
@@ -71,12 +71,12 @@ class SampleController
71
71
  # <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
72
72
  # </sample>
73
73
  #
74
- # @request_field id A unique ID identifying the Sample
75
- # @request_field name The name of the sample
76
- # @request_field state The current status of the Sample. Can be complete, uncomplete, etc.
77
- # @request_field note_attributes Any notes given for the sample that will be created
78
- # @request_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
79
- # @request_field created_at The Date/Time (in ISO8601) that the Sample was created
74
+ # @request_field [Integer] id A unique ID identifying the Sample
75
+ # @request_field [String] name The name of the sample
76
+ # @request_field [String] state The current status of the Sample. Can be complete, uncomplete, etc.
77
+ # @request_field [String] note_attributes Any notes given for the sample that will be created
78
+ # @request_field [DateTime] updated_at The Date/Time (in ISO8601) that the Sample was last updated
79
+ # @request_field [DateTime] created_at The Date/Time (in ISO8601) that the Sample was created
80
80
  #
81
81
  # @example_response
82
82
  # <sample>
@@ -94,12 +94,12 @@ class SampleController
94
94
  # <created_at type="datetime">2010-03-09T20:43:16Z</created_at>
95
95
  # </sample>
96
96
  #
97
- # @response_field id A unique ID identifying the Sample
98
- # @response_field name The name of the sample
99
- # @response_field state The current status of the Sample. Can be complete, uncomplete, etc.
100
- # @response_field notes Any notes given for the sample
101
- # @response_field updated_at The Date/Time (in ISO8601) that the Sample was last updated
102
- # @response_field created_at The Date/Time (in ISO8601) that the Sample was created
97
+ # @response_field [Integer] id A unique ID identifying the Sample
98
+ # @response_field [String] name The name of the sample
99
+ # @response_field [String] state The current status of the Sample. Can be complete, uncomplete, etc.
100
+ # @response_field [String] notes Any notes given for the sample
101
+ # @response_field [DateTime] updated_at The Date/Time (in ISO8601) that the Sample was last updated
102
+ # @response_field [DateTime] created_at The Date/Time (in ISO8601) that the Sample was created
103
103
  #
104
104
  def create
105
105
  end
@@ -13,7 +13,11 @@ YARD::Tags::Library.define_tag("URL for Service", :url)
13
13
  YARD::Tags::Library.define_tag("Topic for Service", :topic)
14
14
  YARD::Tags::Library.define_tag("Arguments", :argument, :with_types_and_name)
15
15
  YARD::Tags::Library.define_tag("Example Request", :example_request)
16
- YARD::Tags::Library.define_tag("Request Fields", :request_field, :with_name)
16
+ YARD::Tags::Library.define_tag("Request Fields", :request_field, :with_types_and_name)
17
17
  YARD::Tags::Library.define_tag("Example Response", :example_response)
18
- YARD::Tags::Library.define_tag("Response Fields", :response_field, :with_name)
18
+ YARD::Tags::Library.define_tag("Response Fields", :response_field, :with_types_and_name)
19
+ YARD::Tags::Library.define_tag("Headers", :header, :with_name)
20
+ YARD::Tags::Library.define_tag("Response codes", :response_code, :with_name)
21
+ YARD::Tags::Library.define_tag("Image", :image)
22
+ YARD::Tags::Library.define_tag("Overall", :overall)
19
23
 
@@ -5,29 +5,37 @@ module YARD::Templates::Helpers
5
5
 
6
6
  # Adds additional test that only includes Objects that contain a URL tag
7
7
  def run_verifier(list)
8
-
8
+
9
9
  if options[:verifier]
10
- list.reject! {|item| options[:verifier].call(item).is_a?(FalseClass) }
10
+ list.reject! { |item| options[:verifier].call(item).is_a?(FalseClass) }
11
11
  end
12
12
 
13
- reject_module(list)
14
- reject_without_url(list)
15
- reject_without_topic(list)
16
-
17
- list
13
+ index_objects(list)
14
+ end
15
+
16
+ def index_objects(list)
17
+ res = reject_module(list)
18
+ res = reject_without_url(res)
19
+ res = reject_without_topic(res)
20
+ res = reject_overall(res)
21
+
22
+ res
18
23
  end
19
24
 
20
25
  def reject_module(list)
21
- list.reject! { |object| [:root, :module].include?(object.type) }
22
- end
23
-
26
+ list.reject { |object| [:root, :module].include?(object.type) }
27
+ end
28
+
24
29
  def reject_without_url(list)
25
- list.reject! { |object| [:class,:method].include?(object.type) and object.tags("url").empty? }
30
+ list.reject { |object| [:class, :method].include?(object.type) and object.tags("url").empty? }
26
31
  end
27
32
 
28
33
  def reject_without_topic(list)
29
- list.reject! { |object| [:class].include?(object.type) and object.tags("topic").empty? }
34
+ list.reject { |object| [:class].include?(object.type) and object.tags("topic").empty? }
35
+ end
36
+
37
+ def reject_overall(list)
38
+ list.reject { |object| object.has_tag?('overall') }
30
39
  end
31
-
32
40
  end
33
41
  end
@@ -3,20 +3,20 @@ include Helpers::FilterHelper
3
3
 
4
4
  def init
5
5
  options[:objects] = objects = run_verifier(options[:objects])
6
- options[:files] = ([options[:readme]] + options[:files]).compact.map {|t| t.to_s }
6
+ options[:files] = ([options[:readme]] + options[:files]).compact.map { |t| t.to_s }
7
7
  options[:readme] = options[:files].first
8
8
  options[:title] ||= "Documentation by YARD #{YARD::VERSION}"
9
-
9
+
10
10
  generate_assets
11
11
  serialize('_index.html')
12
- options[:files].each_with_index do |file, i|
13
- serialize_file(file, i == 0 ? options[:title] : nil)
12
+ options[:files].each_with_index do |file, i|
13
+ serialize_file(file, i == 0 ? options[:title] : nil)
14
14
  end
15
15
 
16
16
  options.delete(:objects)
17
17
  options.delete(:files)
18
-
19
- objects.each do |object|
18
+
19
+ objects.each do |object|
20
20
  begin
21
21
  serialize(object)
22
22
  rescue => e
@@ -61,11 +61,11 @@ def asset(path, content)
61
61
  end
62
62
 
63
63
  def generate_assets
64
- %w( js/jquery.js js/app.js js/full_list.js
65
- css/style.css css/full_list.css css/common.css ).each do |file|
64
+ %w(js/jquery.js js/app.js js/full_list.js
65
+ css/style.css css/full_list.css css/common.css).each do |file|
66
66
  asset(file, file(file, true))
67
67
  end
68
-
68
+
69
69
  @object = Registry.root
70
70
  generate_resource_list
71
71
  generate_topic_list
@@ -73,21 +73,20 @@ def generate_assets
73
73
  end
74
74
 
75
75
  def generate_topic_list
76
- topic_objects = options[:objects].reject {|o| o.root? || !is_class?(o) || o.tags('url').empty? || o.tags('topic').empty? }
76
+ topic_objects = index_objects(options[:objects]).reject { |o| o.root? }
77
77
  @topics = {}
78
-
78
+
79
79
  topic_objects.each do |object|
80
80
  object.tags('topic').each { |topic| (@topics[topic.text] ||= []) << object }
81
81
  end
82
82
 
83
-
84
83
  @list_title = "Topic List"
85
84
  @list_type = "topic"
86
85
  asset('topic_list.html', erb(:full_list))
87
86
  end
88
87
 
89
88
  def generate_resource_list
90
- @items = options[:objects]
89
+ @items = index_objects(options[:objects])
91
90
  @list_title = "Resource List"
92
91
  @list_type = "resource"
93
92
  asset('resource_list.html', erb(:full_list))
@@ -12,10 +12,9 @@ def init
12
12
  elsif object
13
13
  case object
14
14
  when '_index.html'
15
- sections :layout, [:index]
15
+ sections :layout, [:index, [T('class')]]
16
16
  when CodeObjects::Base
17
17
  type = object.root? ? :module : object.type
18
- #sections :layout, [T(type), T('disqus')]
19
18
  sections :layout, [T(type)]
20
19
  end
21
20
  else
@@ -29,16 +28,17 @@ end
29
28
 
30
29
  def index
31
30
 
32
- legitimate_objects = @objects.reject {|o| o.root? || !is_class?(o) || o.tags('url').empty?}
33
- topic_objects = legitimate_objects.reject{|o| o.tags('topic').empty? }
31
+ legitimate_objects = index_objects(@objects).reject {|o| o.root? }
34
32
  @topics = {}
35
-
36
- topic_objects.each do |object|
33
+
34
+ legitimate_objects.each do |object|
37
35
  object.tags('topic').each { |topic| (@topics[topic.text] ||= []) << object }
38
36
  end
39
37
 
40
38
  @resources = legitimate_objects.sort_by {|o| o.tags('url').first.text }
41
-
39
+
40
+ @overall_objects = @objects.find_all {|o| o.has_tag?('overall')}.sort_by {|o| o.tag('overall').text}
41
+
42
42
  erb(:index)
43
43
  end
44
44
 
@@ -1,6 +1,12 @@
1
1
  def init
2
2
  super
3
- sections.place([:argument, :example_request, :request_field, :example_response, :response_field]).before(:index)
3
+ sections :index, [:argument,
4
+ :example_request,
5
+ :request_field,
6
+ :example_response,
7
+ :response_field,
8
+ :header,
9
+ :response_code]
4
10
  end
5
11
 
6
12
  def request_field
@@ -15,6 +21,14 @@ def argument
15
21
  generic_tag :argument, :no_types => false
16
22
  end
17
23
 
24
+ def header
25
+ generic_tag :header
26
+ end
27
+
28
+ def response_code
29
+ generic_tag :response_code
30
+ end
31
+
18
32
  def generic_tag(name, opts = {})
19
33
  return unless object.has_tag?(name)
20
34
  @no_names = true if opts[:no_names]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-rest-plugin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aisha Fenton
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-08 00:00:00 +13:00
18
+ date: 2010-11-19 00:00:00 +13:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -63,8 +63,8 @@ homepage: http://github.com/visfleet/yard-rest-plugin
63
63
  licenses: []
64
64
 
65
65
  post_install_message:
66
- rdoc_options:
67
- - --charset=UTF-8
66
+ rdoc_options: []
67
+
68
68
  require_paths:
69
69
  - lib
70
70
  required_ruby_version: !ruby/object:Gem::Requirement