double_doc 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,9 @@ This is the problem DoubleDoc tries to solve.
7
7
 
8
8
  DoubleDoc allows you to write the documentation right where your code is, and you can combine it all into a well structured document.
9
9
 
10
- ### Format
10
+ This document was generated using DoubleDoc, and the source of this project is a great source for inspiration for how to use DoubleDoc.
11
+
12
+ ### Documentation Format
11
13
  You write your documentation in markdown right in your source code files by double commenting it:
12
14
 
13
15
  ```ruby
@@ -63,14 +65,53 @@ And DoubleDoc will generate this markdown document for you:
63
65
  ```
64
66
 
65
67
  ### Rake Task
68
+ It is very easy to set up a rake task for generating your documentation. All you have to do is
69
+ tell DoubleDoc what the input files are, and where you want the output to go.
70
+
71
+ ```ruby
72
+ require 'double_doc'
73
+
74
+ DoubleDoc::Task.new(:doc,
75
+ :sources => 'doc/source/*.md',
76
+ :md_destination => 'doc/generated',
77
+ :html_destination => 'site'
78
+ )
79
+ ```
80
+
81
+ The available options are:
82
+
83
+ | name | Description
84
+ | -------------------- | -----------
85
+ | __sources__ | __Required__. This tells Double doc where to look for the source of the documentation. Can be either a string or an array of strings.
86
+ | __md_destination__ | __Required__. This is the directory where you want the generated markdown files to go.
87
+ | __html_destination__ | If you want a pretty HTML version of your documentation, all you have to do is to say where you want it.
88
+ | __html_template__ | You can use your own custom ERB template for HTML rendering. Have a look in the one we ship with DoubleDoc for inspiration (templates/default.html.erb).
89
+ | __html_renderer__ | If you want full control of the HTML rendering you can use your own implementation. Defaults to `DoubleDoc::HtmlRenderer`.
90
+ | __html_css__ | You can use your own custom CSS document by specifying it's path here.
91
+ | __title__ | The title you want in the generated HTML. Defaults to "Documentation".
92
+
93
+ If you just want to use double doc to generate your readme.md for github, you should write your documentation in doc/readme.md and put his in your Rakefile:
94
+
95
+ ```ruby
96
+ require 'double_doc'
97
+
98
+ DoubleDoc::Task.new(:doc, :sources => 'doc/readme.md', :md_destination => '.')
99
+ ```
100
+ Then all you have to do is to run `rake doc`, and you will have a `readme.md` in the root of your project.
101
+
102
+ You can even run `rake doc:publish` to generate html documentation and push it to your Github Pages.
103
+
104
+ ### Notes
105
+ DoubleDoc is tested as working on both ruby 1.8.7 and 1.9.3, but does not work on jruby because if it's dependency on redcarpet.
66
106
 
67
- You can easly use DoubleDoc from Rake, and soon I'll tell you how...
107
+ [![Build Status](https://secure.travis-ci.org/staugaard/double_doc.png?branch=master)](http://travis-ci.org/staugaard/double_doc)
68
108
 
69
109
  ### TODO
70
110
  * Tests
71
111
  * Support for directory structures
72
112
  * Documentation for the Rake task
73
113
  * Documentation for the Guard
114
+ * Add support for extracting documentation from JavaScript files
74
115
 
75
116
  ### License
76
117
  #### The MIT License
@@ -1,35 +1,48 @@
1
1
  module DoubleDoc
2
2
  class DocExtractor
3
- def self.extract(source)
3
+ TYPES = {
4
+ 'rb' => /\s*##\s?(.*)$/
5
+ }.freeze
6
+
7
+ def self.extract(source, options = {})
4
8
  case source
5
9
  when String
6
- extract_from_lines(source.split("\n"))
10
+ extract_from_lines(source.split("\n"), options)
7
11
  when File
8
- extract_from_lines(source.readlines)
12
+ if type = File.extname(source.path)
13
+ type = type[1..-1]
14
+ end
15
+ type ||= 'rb'
16
+
17
+ extract_from_lines(source.readlines, options.merge(:type => type))
9
18
  when Array
10
- extract_from_lines(source)
19
+ extract_from_lines(source, options)
11
20
  else
12
21
  raise "can't extract docs from #{source}"
13
22
  end
14
23
  end
15
24
 
16
- def self.extract_from_lines(lines)
25
+ def self.extract_from_lines(lines, options)
17
26
  doc = []
27
+ extractor = TYPES[options[:type]]
28
+
18
29
  add_empty_line = false
19
30
  lines.each do |line|
20
- if match = line.match(/\s*##\s?(.*)$/)
31
+ if match = line.match(extractor)
21
32
  if add_empty_line
22
33
  doc << ''
23
34
  add_empty_line = false
24
35
  end
25
36
  doc << match[1].rstrip
26
37
  else
27
- add_empty_line = true
38
+ add_empty_line = !doc.empty?
28
39
  end
29
40
  end
30
41
 
31
42
  return '' if doc.empty? || doc.all?(&:empty?)
32
43
 
44
+ doc << ''
45
+
33
46
  return doc.join("\n")
34
47
  end
35
48
  end
@@ -28,7 +28,6 @@ module DoubleDoc
28
28
  :title => @title,
29
29
  :body => body,
30
30
  :css => @stylesheet,
31
- :highlight_css => @html_renderer.stylesheet,
32
31
  :sitemap => sitemap
33
32
  )
34
33
  out.write(html)
@@ -5,7 +5,7 @@ module DoubleDoc
5
5
  class HtmlRenderer
6
6
 
7
7
  def self.render(text)
8
- markdown = Redcarpet::Markdown.new(RedcarpetRenderer, :fenced_code_blocks => true)
8
+ markdown = Redcarpet::Markdown.new(RedcarpetRenderer, :fenced_code_blocks => true, :no_intra_emphasis => true, :tables => true)
9
9
  markdown.render(text)
10
10
  end
11
11
 
@@ -13,10 +13,6 @@ module DoubleDoc
13
13
  text.strip.downcase.gsub(/\s+/, '-')
14
14
  end
15
15
 
16
- def self.stylesheet
17
- Pygments.css('.highlight')
18
- end
19
-
20
16
  class RedcarpetRenderer < Redcarpet::Render::HTML
21
17
  def header(text, level)
22
18
  "<h#{level} id=\"#{DoubleDoc::HtmlRenderer.generate_id(text)}\">#{text}</h#{level}>"
@@ -1,10 +1,46 @@
1
+ require 'rake'
1
2
  require 'pathname'
2
3
  require 'double_doc/import_handler'
3
4
  require 'double_doc/html_generator'
4
5
 
5
6
  module DoubleDoc
6
7
 
7
- ## You can easly use DoubleDoc from Rake, and soon I'll tell you how...
8
+ ## ### Rake Task
9
+ ## It is very easy to set up a rake task for generating your documentation. All you have to do is
10
+ ## tell DoubleDoc what the input files are, and where you want the output to go.
11
+ ##
12
+ ## ```ruby
13
+ ## require 'double_doc'
14
+ ##
15
+ ## DoubleDoc::Task.new(:doc,
16
+ ## :sources => 'doc/source/*.md',
17
+ ## :md_destination => 'doc/generated',
18
+ ## :html_destination => 'site'
19
+ ## )
20
+ ## ```
21
+ ##
22
+ ## The available options are:
23
+ ##
24
+ ## | name | Description
25
+ ## | -------------------- | -----------
26
+ ## | __sources__ | __Required__. This tells Double doc where to look for the source of the documentation. Can be either a string or an array of strings.
27
+ ## | __md_destination__ | __Required__. This is the directory where you want the generated markdown files to go.
28
+ ## | __html_destination__ | If you want a pretty HTML version of your documentation, all you have to do is to say where you want it.
29
+ ## | __html_template__ | You can use your own custom ERB template for HTML rendering. Have a look in the one we ship with DoubleDoc for inspiration (templates/default.html.erb).
30
+ ## | __html_renderer__ | If you want full control of the HTML rendering you can use your own implementation. Defaults to `DoubleDoc::HtmlRenderer`.
31
+ ## | __html_css__ | You can use your own custom CSS document by specifying it's path here.
32
+ ## | __title__ | The title you want in the generated HTML. Defaults to "Documentation".
33
+ ##
34
+ ## If you just want to use double doc to generate your readme.md for github, you should write your documentation in doc/readme.md and put his in your Rakefile:
35
+ ##
36
+ ## ```ruby
37
+ ## require 'double_doc'
38
+ ##
39
+ ## DoubleDoc::Task.new(:doc, :sources => 'doc/readme.md', :md_destination => '.')
40
+ ## ```
41
+ ## Then all you have to do is to run `rake doc`, and you will have a `readme.md` in the root of your project.
42
+ ##
43
+ ## You can even run `rake doc:publish` to generate html documentation and push it to your Github Pages.
8
44
  class Task
9
45
  include Rake::DSL if defined?(Rake::DSL)
10
46
 
@@ -12,14 +48,15 @@ module DoubleDoc
12
48
  md_dst = Pathname.new(options[:md_destination])
13
49
  html_dst = Pathname.new(options[:html_destination]) if options[:html_destination]
14
50
  sources = FileList[*options[:sources]]
15
- import_handler = DoubleDoc::ImportHandler.new(options[:root] || Rake.original_dir)
16
51
 
17
52
  destinations = [md_dst, html_dst].compact
18
53
  destinations.each do |dst|
19
54
  directory(dst.to_s)
20
55
  end
21
56
 
22
- task(task_name => destinations) do
57
+ desc "Generate markdown #{html_dst ? 'and HTML ' : ''}DoubleDoc documentation from #{sources.join(', ')}"
58
+ generate_task = task(task_name => destinations) do |t, args|
59
+ import_handler = DoubleDoc::ImportHandler.new(options[:root] || Rake.original_dir)
23
60
 
24
61
  sources.each do |src|
25
62
  dst = md_dst + File.basename(src)
@@ -29,12 +66,60 @@ module DoubleDoc
29
66
  end
30
67
  end
31
68
 
32
- if html_dst
33
- html_generator = DoubleDoc::HtmlGenerator.new(FileList[(md_dst + '*.md').to_s].sort, options)
69
+ if html_dst || args[:html_destination]
70
+ html_generator = DoubleDoc::HtmlGenerator.new(FileList[(md_dst + '*.md').to_s].sort, options.merge(args))
34
71
  html_generator.generate
35
72
  end
36
73
 
37
74
  end
75
+
76
+ namespace(task_name) do
77
+
78
+ desc "Publish DoubleDoc documentation to Github Pages"
79
+ task :publish do
80
+ git_clean = `git status -s`.empty? rescue false
81
+ raise "Your local git repository needs to be clean for this task to run" unless git_clean
82
+
83
+ git_branch = `git branch | grep "*"`.match(/\* (.*)/)[1] rescue 'master'
84
+
85
+ Dir.mktmpdir do |dir|
86
+ generate_task.execute(:html_destination => dir)
87
+ html_files = Dir.glob(Pathname.new(dir) + '*.html')
88
+
89
+ `git add .`
90
+ `git commit -m 'Updated documentation'`
91
+
92
+ has_github_pages = !`git branch | grep 'gh-pages'`.empty? rescue false
93
+
94
+ unless has_github_pages
95
+ puts "Setting up gh-pages branch"
96
+
97
+ `git symbolic-ref HEAD refs/heads/gh-pages`
98
+ `rm .git/index`
99
+ `git clean -fdx`
100
+ else
101
+ `git checkout gh-pages`
102
+ `git pull origin gh-pages`
103
+ end
104
+
105
+ puts "Publishing your Github Pages"
106
+ `cp #{dir}/* .`
107
+ if html_files.size == 1
108
+ `cp #{html_files[0]} index.html`
109
+ else
110
+ warn("You should probably generate an index.html")
111
+ end
112
+
113
+ `git add .`
114
+ `git commit -m 'Updated Github Pages'`
115
+ `git push origin gh-pages`
116
+ `git co #{git_branch}`
117
+
118
+ puts "Your Github Pages has been published. You will receive an email from Github when they are online."
119
+ end
120
+ end
121
+
122
+ end
38
123
  end
39
124
 
40
125
  end
@@ -1,4 +1,4 @@
1
1
  ## ## DoubleDoc 1.0
2
2
  module DoubleDoc
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
data/lib/double_doc.rb CHANGED
@@ -1,5 +1,2 @@
1
1
  require "double_doc/version"
2
-
3
- module Guard
4
- autoload :Doubledoc, 'double_doc/guard'
5
- end
2
+ require "double_doc/task"
@@ -3,7 +3,7 @@ require 'guard/guard'
3
3
  require 'rake'
4
4
 
5
5
  module Guard
6
- class Doubledoc < Guard
6
+ class DoubleDoc < Guard
7
7
  include ::Rake::DSL
8
8
 
9
9
  def start
@@ -27,7 +27,7 @@ module Guard
27
27
  def run_rake_task
28
28
  UI.info "generating double docs"
29
29
  ::Rake::Task.tasks.each { |t| t.reenable }
30
- ::Rake::Task[@options[:task]].invoke
30
+ ::Rake::Task[@options[:rake_task]].invoke
31
31
  end
32
32
  end
33
33
  end
@@ -0,0 +1,4 @@
1
+ require 'guard/double_doc'
2
+
3
+ class Guard::Doubledoc < Guard::DoubleDoc
4
+ end
@@ -5,10 +5,6 @@
5
5
  <meta name="apple-mobile-web-app-capable" content="yes">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title><%= title %></title>
8
- <link href="http://fonts.googleapis.com/css?family=Droid+Sans+Mono" rel="stylesheet" type="text/css">
9
- <style type="text/css">
10
- <%= highlight_css %>
11
- </style>
12
8
  <link rel="stylesheet" href="<%= css %>">
13
9
  </head>
14
10
  <body>
data/templates/screen.css CHANGED
@@ -250,12 +250,19 @@ a {
250
250
 
251
251
  #content table {
252
252
  margin-bottom: 1.625em;
253
+ padding-bottom: 0.5em;
253
254
  border-collapse: collapse;
255
+ border-spacing: 0;
254
256
  font-size: 80%;
257
+ display: block;
258
+ border: 1px solid #DDD;
259
+ border-radius: 6px;
260
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
255
261
  }
256
262
 
257
263
  #content th {
258
264
  font-weight: bold;
265
+ white-space: nowrap;
259
266
  }
260
267
 
261
268
  #content tr, #content th, #content td {
@@ -264,6 +271,15 @@ a {
264
271
  height: 26px;
265
272
  }
266
273
 
274
+ #content table tbody tr:nth-child(odd) {
275
+ background-color: #F8F8F8;
276
+ }
277
+
278
+ #content table thead tr {
279
+ border-bottom: 1px solid #DADADA;
280
+ line-height: 240%;
281
+ }
282
+
267
283
  #content tfoot {
268
284
  font-style: italic;
269
285
  }
@@ -324,23 +340,18 @@ a {
324
340
  }
325
341
 
326
342
  #content pre, #content code, #content tt {
327
- font: .7em "Droid Sans Mono", Monaco, monospace;
343
+ font: 12px "Bitstream Vera Sans Mono", "Courier", monospace;
328
344
  line-height: 1.5;
329
345
  }
330
346
 
331
347
  #content pre {
332
- background: #f8f8ff;
348
+ background: #F8F8F8;
333
349
  padding: 10px;
334
350
  border: 1px solid #ddd;
335
351
  border-radius: 6px;
336
352
  word-wrap: break-word;
337
353
  }
338
354
 
339
- .highlight {
340
- background: none;
341
- }
342
-
343
-
344
355
  #content tt {
345
356
  display: block;
346
357
  margin: 1.625em 0;
@@ -366,4 +377,68 @@ a {
366
377
  padding: 30px;
367
378
  position: relative;
368
379
  }
369
- }
380
+ }
381
+
382
+ /* This was generated like this: `pygmentize -S github -f html -a .highlight` */
383
+ .highlight .hll { background-color: #ffffcc }
384
+ .highlight { background: #ffffff; }
385
+ .highlight .c { color: #999988; font-style: italic } /* Comment */
386
+ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
387
+ .highlight .k { color: #000000; font-weight: bold } /* Keyword */
388
+ .highlight .o { color: #000000; font-weight: bold } /* Operator */
389
+ .highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
390
+ .highlight .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
391
+ .highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
392
+ .highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
393
+ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
394
+ .highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
395
+ .highlight .gr { color: #aa0000 } /* Generic.Error */
396
+ .highlight .gh { color: #999999 } /* Generic.Heading */
397
+ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
398
+ .highlight .go { color: #888888 } /* Generic.Output */
399
+ .highlight .gp { color: #555555 } /* Generic.Prompt */
400
+ .highlight .gs { font-weight: bold } /* Generic.Strong */
401
+ .highlight .gu { color: #aaaaaa } /* Generic.Subheading */
402
+ .highlight .gt { color: #aa0000 } /* Generic.Traceback */
403
+ .highlight .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
404
+ .highlight .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
405
+ .highlight .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
406
+ .highlight .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
407
+ .highlight .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
408
+ .highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
409
+ .highlight .m { color: #009999 } /* Literal.Number */
410
+ .highlight .s { color: #d01040 } /* Literal.String */
411
+ .highlight .na { color: #008080 } /* Name.Attribute */
412
+ .highlight .nb { color: #0086B3 } /* Name.Builtin */
413
+ .highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
414
+ .highlight .no { color: #008080 } /* Name.Constant */
415
+ .highlight .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
416
+ .highlight .ni { color: #800080 } /* Name.Entity */
417
+ .highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
418
+ .highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
419
+ .highlight .nl { color: #990000; font-weight: bold } /* Name.Label */
420
+ .highlight .nn { color: #555555 } /* Name.Namespace */
421
+ .highlight .nt { color: #000080 } /* Name.Tag */
422
+ .highlight .nv { color: #008080 } /* Name.Variable */
423
+ .highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
424
+ .highlight .w { color: #bbbbbb } /* Text.Whitespace */
425
+ .highlight .mf { color: #009999 } /* Literal.Number.Float */
426
+ .highlight .mh { color: #009999 } /* Literal.Number.Hex */
427
+ .highlight .mi { color: #009999 } /* Literal.Number.Integer */
428
+ .highlight .mo { color: #009999 } /* Literal.Number.Oct */
429
+ .highlight .sb { color: #d01040 } /* Literal.String.Backtick */
430
+ .highlight .sc { color: #d01040 } /* Literal.String.Char */
431
+ .highlight .sd { color: #d01040 } /* Literal.String.Doc */
432
+ .highlight .s2 { color: #d01040 } /* Literal.String.Double */
433
+ .highlight .se { color: #d01040 } /* Literal.String.Escape */
434
+ .highlight .sh { color: #d01040 } /* Literal.String.Heredoc */
435
+ .highlight .si { color: #d01040 } /* Literal.String.Interpol */
436
+ .highlight .sx { color: #d01040 } /* Literal.String.Other */
437
+ .highlight .sr { color: #009926 } /* Literal.String.Regex */
438
+ .highlight .s1 { color: #d01040 } /* Literal.String.Single */
439
+ .highlight .ss { color: #990073 } /* Literal.String.Symbol */
440
+ .highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
441
+ .highlight .vc { color: #008080 } /* Name.Variable.Class */
442
+ .highlight .vg { color: #008080 } /* Name.Variable.Global */
443
+ .highlight .vi { color: #008080 } /* Name.Variable.Instance */
444
+ .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ describe "the doc extractor" do
4
+ describe "on ruby files" do
5
+ ## this line should be extracted
6
+ # this line should not be extracted
7
+ ## this line should also be extracted
8
+
9
+ before do
10
+ @doc = DoubleDoc::DocExtractor.extract(File.new(__FILE__))
11
+ end
12
+
13
+ it "should extract documentation from ruby files" do
14
+ @doc.must_match(/this line should be extracted/)
15
+ @doc.must_match(/this line should also be extracted/)
16
+ end
17
+
18
+ it "should not extract regular comments" do
19
+ @doc.wont_match(/this line should not be extracted/)
20
+ end
21
+
22
+ it "should not add any extra new-lines" do
23
+ @doc.must_match(/^this/m)
24
+ @doc.must_match(/extracted\n$/m)
25
+ end
26
+
27
+ it "add an empty line between documentation sections" do
28
+ @doc.must_match(/extracted\n\nthis/m)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,4 @@
1
+ require "bundler"
2
+ Bundler.require
3
+
4
+ require "minitest/autorun"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: double_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-18 00:00:00.000000000 Z
12
+ date: 2012-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &70226292443260 !ruby/object:Gem::Requirement
16
+ requirement: &70134689089720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70226292443260
24
+ version_requirements: *70134689089720
25
25
  - !ruby/object:Gem::Dependency
26
- name: guard-rake
27
- requirement: &70226292442540 !ruby/object:Gem::Requirement
26
+ name: minitest
27
+ requirement: &70134689089300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70226292442540
35
+ version_requirements: *70134689089300
36
36
  - !ruby/object:Gem::Dependency
37
- name: erubis
38
- requirement: &70226292441960 !ruby/object:Gem::Requirement
37
+ name: rake
38
+ requirement: &70134689088880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70226292441960
46
+ version_requirements: *70134689088880
47
47
  - !ruby/object:Gem::Dependency
48
- name: redcarpet
49
- requirement: &70226292441220 !ruby/object:Gem::Requirement
48
+ name: erubis
49
+ requirement: &70134689088460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,18 +54,29 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70226292441220
57
+ version_requirements: *70134689088460
58
+ - !ruby/object:Gem::Dependency
59
+ name: redcarpet
60
+ requirement: &70134689087960 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '2.1'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70134689087960
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: pygments.rb
60
- requirement: &70226292440440 !ruby/object:Gem::Requirement
71
+ requirement: &70134689087460 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
- - - ! '>='
74
+ - - ~>
64
75
  - !ruby/object:Gem::Version
65
- version: '0'
76
+ version: '0.2'
66
77
  type: :runtime
67
78
  prerelease: false
68
- version_requirements: *70226292440440
79
+ version_requirements: *70134689087460
69
80
  description: A simple framework for writing and generating beautiful documentation
70
81
  for your code
71
82
  email:
@@ -74,25 +85,20 @@ executables: []
74
85
  extensions: []
75
86
  extra_rdoc_files: []
76
87
  files:
77
- - .gitignore
78
- - Gemfile
79
- - Guardfile
80
- - Rakefile
81
- - doc/license.md
82
- - doc/readme.md
83
- - doc/todo.md
84
- - double_doc.gemspec
85
- - lib/double_doc.rb
86
88
  - lib/double_doc/doc_extractor.rb
87
- - lib/double_doc/guard.rb
88
89
  - lib/double_doc/html_generator.rb
89
90
  - lib/double_doc/html_renderer.rb
90
91
  - lib/double_doc/import_handler.rb
91
92
  - lib/double_doc/task.rb
92
93
  - lib/double_doc/version.rb
93
- - readme.md
94
+ - lib/double_doc.rb
95
+ - lib/guard/double_doc.rb
96
+ - lib/guard/doubledoc.rb
94
97
  - templates/default.html.erb
95
98
  - templates/screen.css
99
+ - README.md
100
+ - test/doc_extractor_test.rb
101
+ - test/test_helper.rb
96
102
  homepage: http://staugaard.github.com/double_doc
97
103
  licenses: []
98
104
  post_install_message:
@@ -112,9 +118,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
118
  - !ruby/object:Gem::Version
113
119
  version: '0'
114
120
  requirements: []
115
- rubyforge_project: double_doc
116
- rubygems_version: 1.8.10
121
+ rubyforge_project:
122
+ rubygems_version: 1.8.16
117
123
  signing_key:
118
124
  specification_version: 3
119
125
  summary: Documentation right where you want it
120
- test_files: []
126
+ test_files:
127
+ - test/doc_extractor_test.rb
128
+ - test/test_helper.rb
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
- site
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in double_doc.gemspec
4
- gemspec
data/Guardfile DELETED
@@ -1,6 +0,0 @@
1
- $LOAD_PATH.unshift 'lib'
2
- require 'double_doc'
3
-
4
- guard :double_doc, :task => 'doc' do
5
- watch(%r{^(doc|lib|templates)/})
6
- end
data/Rakefile DELETED
@@ -1,29 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- $LOAD_PATH.unshift 'lib'
4
-
5
- require 'double_doc/task'
6
-
7
- desc "Generate documentation"
8
- DoubleDoc::Task.new(:doc,
9
- :sources => 'doc/readme.md',
10
- :md_destination => '.',
11
- :html_destination => 'site',
12
- :title => 'API Documentaion'
13
- )
14
-
15
- desc "Publish docs to github"
16
- task :publish => :doc do
17
- `git add doc`
18
- `git add readme.md`
19
- `git commit -m 'Updated documentation'`
20
- `git push origin master`
21
- `git checkout gh-pages`
22
- `cp site/* .`
23
- `cp readme.html index.html`
24
- `git commit -a -m 'Updated site'`
25
- `git push origin gh-pages`
26
- `git co master`
27
- end
28
-
29
- task :default => [:doc]
data/doc/license.md DELETED
@@ -1,9 +0,0 @@
1
- #### The MIT License
2
-
3
- Copyright © 2012 [Mick Staugaard](mailto:mick@staugaard.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/doc/readme.md DELETED
@@ -1,72 +0,0 @@
1
- @import lib/double_doc/version.rb
2
-
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
- 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.
5
-
6
- This is the problem DoubleDoc tries to solve.
7
-
8
- DoubleDoc allows you to write the documentation right where your code is, and you can combine it all into a well structured document.
9
-
10
- ### Format
11
- You write your documentation in markdown right in your source code files by double commenting it:
12
-
13
- ```ruby
14
- class User < ActiveRecord::Base
15
-
16
- ## ```js
17
- ## {
18
- ## "id": 1,
19
- ## "name": "Mick Staugaard"
20
- ## }
21
- ## ```
22
- def as_json
23
- # this comment will not be included in the documentation
24
- # as it only has a single # character
25
- super(:only => [:id, :name])
26
- end
27
-
28
- end
29
-
30
- class UsersController < ApplicationController
31
- ## ### Getting a User
32
- ## `GET /users/{id}.json`
33
- ##
34
- ## #### Format
35
- ## @@import app/models/user.rb
36
- def show
37
- render :json => User.find(params[:id])
38
- end
39
- end
40
- ```
41
-
42
- You would then write a markdown document about your User API:
43
-
44
- ## Users
45
- You can acces users in our system by using our REST API, blah blah blah...
46
-
47
- @@import app/controllers/users_controller.rb
48
-
49
- And DoubleDoc will generate this markdown document for you:
50
-
51
- ## Users
52
- You can acces users in our system by using our REST API, blah blah blah...
53
-
54
- ### Getting a User
55
- `GET /users/{id}.json`
56
-
57
- #### Format
58
- ```js
59
- {
60
- "id": 1,
61
- "name": "Mick Staugaard"
62
- }
63
- ```
64
-
65
- ### Rake Task
66
- @import lib/double_doc/task.rb
67
-
68
- ### TODO
69
- @import doc/todo.md
70
-
71
- ### License
72
- @import doc/license.md
data/doc/todo.md DELETED
@@ -1,4 +0,0 @@
1
- * Tests
2
- * Support for directory structures
3
- * Documentation for the Rake task
4
- * Documentation for the Guard
data/double_doc.gemspec DELETED
@@ -1,27 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "double_doc/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "double_doc"
7
- s.version = DoubleDoc::VERSION
8
- s.authors = ["Mick Staugaard"]
9
- s.email = ["mick@staugaard.com"]
10
- s.homepage = "http://staugaard.github.com/double_doc"
11
- s.summary = "Documentation right where you want it"
12
- s.description = "A simple framework for writing and generating beautiful documentation for your code"
13
-
14
- s.rubyforge_project = "double_doc"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
-
21
- s.add_development_dependency "guard"
22
- s.add_development_dependency "guard-rake"
23
-
24
- s.add_runtime_dependency "erubis"
25
- s.add_runtime_dependency "redcarpet"
26
- s.add_runtime_dependency "pygments.rb"
27
- end