double_doc 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## DoubleDoc 1.0
1
+ ## DoubleDoc 1.2
2
2
 
3
3
  One of the challenges you face when writing public documention for code or APIs, is that you have to remember to update the documentation
4
4
  when ever you change the API. The main reason why this is a problem is that very often the documentation lives very for from your code.
@@ -14,6 +14,7 @@ module DoubleDoc
14
14
  @html_renderer = options[:html_renderer] || HtmlRenderer
15
15
  @stylesheet = options[:html_css] || DEFAULT_CSS
16
16
  @title = options[:title] || 'Documentation'
17
+ @exclude_from_navigation = options[:exclude_from_navigation] || []
17
18
  end
18
19
 
19
20
  def generate
@@ -62,7 +63,9 @@ module DoubleDoc
62
63
 
63
64
  @sitemap = []
64
65
 
65
- @sources.each do |src|
66
+ navigation_sources = @sources - @exclude_from_navigation
67
+
68
+ navigation_sources.each do |src|
66
69
  path = File.basename(src).sub(/\.md$/, '.html')
67
70
  lines = File.readlines(src)
68
71
 
@@ -113,7 +113,7 @@ module DoubleDoc
113
113
  `git add .`
114
114
  `git commit -n -m 'Updated Github Pages'`
115
115
  `git push origin gh-pages`
116
- `git co #{git_branch}`
116
+ `git checkout #{git_branch}`
117
117
  end
118
118
  end
119
119
  end
@@ -1,4 +1,4 @@
1
- ## ## DoubleDoc 1.0
1
+ ## ## DoubleDoc 1.2
2
2
  module DoubleDoc
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
@@ -43,5 +43,48 @@ describe "the html generator" do
43
43
  output.must_match(/<a href="params.html\?foo=bar">params<\/a>/)
44
44
  output.must_match(/<a href="params.html#foo-bar">params<\/a>/)
45
45
  end
46
+
47
+ end
48
+
49
+ describe "navigation" do
50
+ before do
51
+ @input_file_one = @root + 'source/file_one.md'
52
+ File.open(@input_file_one, 'w') do |f|
53
+ f.puts "## Title One"
54
+ end
55
+
56
+ @input_file_two = @root + 'source/file_two.md'
57
+ File.open(@input_file_two, 'w') do |f|
58
+ f.puts "## Title Two"
59
+ end
60
+
61
+ @input_files = [@input_file_one, @input_file_two]
62
+ end
63
+
64
+ it "should generate links for each page in the navigation area" do
65
+ generator = DoubleDoc::HtmlGenerator.new(@input_files, {
66
+ :html_destination => @destination
67
+ })
68
+ generator.generate
69
+
70
+ output = File.read(@destination + 'file_one.html')
71
+
72
+ output.must_match(/<li>\s*<a class="source" href="file_one.html">Title One<\/a>\s*<\/li>/)
73
+ output.must_match(/<li>\s*<a class="source" href="file_two.html">Title Two<\/a>\s*<\/li>/)
74
+ end
75
+
76
+ it "should skip specified filed" do
77
+ generator = DoubleDoc::HtmlGenerator.new(@input_files, {
78
+ :html_destination => @destination,
79
+ :exclude_from_navigation => [@input_file_two]
80
+ })
81
+ generator.generate
82
+
83
+ output = File.read(@destination + 'file_one.html')
84
+
85
+ output.must_match(/<li>\s*<a class="source" href="file_one.html">Title One<\/a>\s*<\/li>/)
86
+ output.wont_match(/<li>\s*<a class="source" href="file_two.html">Title Two<\/a>\s*<\/li>/)
87
+ end
46
88
  end
89
+
47
90
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: double_doc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mick Staugaard
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-02 00:00:00 Z
18
+ date: 2012-04-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: guard