yard-api 0.3.5 → 0.3.6
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.
- checksums.yaml +4 -4
- data/lib/yard-api/templates/helpers/html_helper.rb +10 -1
- data/lib/yard-api/version.rb +1 -1
- data/spec/helpers/html_helper_spec.rb +42 -0
- data/spec/spec_helper.rb +0 -2
- data/templates/api/layout/html/layout.erb +1 -1
- data/templates/api/layout/html/sidebar.erb +1 -1
- data/templates/api/onefile/html/sidebar.erb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06c93991353fbc833a7ca45b81836c7667838845
|
4
|
+
data.tar.gz: 30f2b0a1b805366a5fb1794f2d395999ad177558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98c3d661fc6bf8f33de2754ed07b56b826d066f32e752629459f180c11e7097c2106f8b6d163a28606ca96d25f4bc01bf4d9143a6631947774b58d6415a2abd7
|
7
|
+
data.tar.gz: fab1bbb48be6ed00328df8cb4407c970aec1ac72f83478f97d20a38cc96f3dc7f2c025abb20c2dae4fd18f07d22ebfc9edab99c54f1196ae9a10ffc2e53977ee
|
@@ -11,6 +11,12 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
11
11
|
link
|
12
12
|
end
|
13
13
|
|
14
|
+
def visible_static_pages()
|
15
|
+
@@visible_static_pages ||= begin
|
16
|
+
static_pages.reject { |page| page[:exclude_from_sidebar] }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
14
20
|
def static_pages()
|
15
21
|
@@static_pages ||= begin
|
16
22
|
locate_static_pages(YARD::APIPlugin.options)
|
@@ -19,6 +25,7 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
19
25
|
|
20
26
|
def locate_static_pages(options)
|
21
27
|
title_overrides = {}
|
28
|
+
excludes = {}
|
22
29
|
|
23
30
|
paths = Array(options.static).map do |entry|
|
24
31
|
pages = if entry.is_a?(Hash)
|
@@ -29,6 +36,7 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
29
36
|
end
|
30
37
|
|
31
38
|
title_overrides[entry['path']] = entry['title']
|
39
|
+
excludes[entry['path']] = true if entry['exclude_from_sidebar']
|
32
40
|
|
33
41
|
entry['path']
|
34
42
|
elsif entry.is_a?(Array)
|
@@ -62,7 +70,8 @@ module YARD::Templates::Helpers::HtmlHelper
|
|
62
70
|
{
|
63
71
|
src: page,
|
64
72
|
filename: filename,
|
65
|
-
title: title
|
73
|
+
title: title,
|
74
|
+
exclude_from_sidebar: !!excludes[page]
|
66
75
|
}
|
67
76
|
end.sort_by { |page| page[:title] }
|
68
77
|
end
|
data/lib/yard-api/version.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'tempfile'
|
3
|
+
|
4
|
+
describe YARD::Templates::Helpers::HtmlHelper do
|
5
|
+
let(:html) { Class.new { include YARD::Templates::Helpers::HtmlHelper }.new }
|
6
|
+
let(:included) { Tempfile.new('included') }
|
7
|
+
let(:excluded) { Tempfile.new('excluded') }
|
8
|
+
|
9
|
+
before do
|
10
|
+
html.singleton_class.class_variable_set(:@@static_pages, nil)
|
11
|
+
html.singleton_class.class_variable_set(:@@visible_static_pages, nil)
|
12
|
+
set_option('static', [
|
13
|
+
{'path' => included.path, 'title' => 'Included'},
|
14
|
+
{'path' => excluded.path, 'title' => 'Excluded', 'exclude_from_sidebar' => true}
|
15
|
+
])
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
included.close(true)
|
20
|
+
excluded.close(true)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#visible_static_pages' do
|
24
|
+
it 'excludes pages with exclude_from_sidebar option' do
|
25
|
+
pages = html.visible_static_pages
|
26
|
+
expect(pages.count).to eq(1)
|
27
|
+
expect(pages[0][:title]).to eq('Included')
|
28
|
+
expect(pages[0][:exclude_from_sidebar]).to be_falsey
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#static_pages' do
|
33
|
+
it 'includes pages with exclude_from_sidebar option' do
|
34
|
+
pages = html.static_pages
|
35
|
+
expect(pages.count).to eq(2)
|
36
|
+
|
37
|
+
page = pages.find { |p| p[:exclude_from_sidebar] }
|
38
|
+
expect(page).to_not be_nil
|
39
|
+
expect(page[:title]).to eq('Excluded')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'byebug' if RUBY_VERSION > '1.9.3'
|
2
|
-
|
3
1
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
2
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
3
|
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmad Amireh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- lib/yard-api/version.rb
|
81
81
|
- lib/yard-api/yardoc_task.rb
|
82
82
|
- spec/fulldoc_spec.rb
|
83
|
+
- spec/helpers/html_helper_spec.rb
|
83
84
|
- spec/spec_helper.rb
|
84
85
|
- spec/tags/argument_spec.rb
|
85
86
|
- tasks/yard_api.rake
|
@@ -206,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
207
|
version: '0'
|
207
208
|
requirements: []
|
208
209
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.4.5.1
|
210
211
|
signing_key:
|
211
212
|
specification_version: 4
|
212
213
|
summary: A YARD plugin for documenting APIs in Rails projects.
|