rokko 0.0.3 → 0.1.0
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/LICENSE +22 -0
- data/README.md +54 -0
- data/Rakefile +1 -1
- data/TODO +3 -3
- data/bin/rokko +3 -1
- data/lib/rokko/index_layout.mustache +2 -4
- data/lib/rokko/index_layout.rb +2 -1
- data/lib/rokko/layout.mustache +2 -4
- data/lib/rokko/layout.rb +16 -6
- data/lib/rokko/task.rb +1 -1
- data/lib/rokko/version.rb +1 -1
- data/lib/rokko.rb +1 -0
- metadata +5 -4
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011 Vasily Polovnyov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
1
|
Rokko -- fat-free [Rocco](http://rtomayko.github.com/rocco/)
|
|
2
2
|
=============================================================
|
|
3
3
|
|
|
4
|
+
Rokko is an else one Ruby port of [Docco](http://jashkenas.github.com/docco/),
|
|
5
|
+
the quick-and-dirty, hundred-line-long, literate-programming-style documentation generator.
|
|
6
|
+
|
|
7
|
+
Rokko reads Ruby source files and produces annotated source documentation in HTML format.
|
|
8
|
+
Comments are formatted with Markdown and presented alongside syntax highlighted code so as to give an annotation effect.
|
|
9
|
+
|
|
10
|
+
##Why Rokko?
|
|
11
|
+
|
|
12
|
+
* Rokko supports only Ruby source files (consider using [Rocco](http://rtomayko.github.com/rocco/)
|
|
13
|
+
if you need more languages).
|
|
14
|
+
* Rokko uses awesome [highlight.js](http://softwaremaniacs.org/soft/highlight/en/) library for syntax highlighting.
|
|
15
|
+
* Rokko can generate offline-ready documentation (all assets are bundled).
|
|
16
|
+
* Rokko can generate an index file with links to everything (like Table of Contents).
|
|
17
|
+
|
|
18
|
+
##Installation
|
|
19
|
+
|
|
20
|
+
Install with Rubygems:
|
|
21
|
+
|
|
22
|
+
sudo gem install rokko
|
|
23
|
+
|
|
24
|
+
##Usage
|
|
25
|
+
|
|
26
|
+
`rokko` command can be used to generate documentation for a set of Ruby source files:
|
|
27
|
+
|
|
28
|
+
rokko -o docs lib/*.rb
|
|
29
|
+
|
|
30
|
+
It is also possible to use Rokko as a Rake task:
|
|
31
|
+
|
|
32
|
+
require 'rokko/task'
|
|
33
|
+
|
|
34
|
+
Rokko::Task.new(:rokko, 'docs', ['lib/**/*.rb', 'README.md'], {:index => true, :local => true})
|
|
35
|
+
|
|
36
|
+
And run:
|
|
37
|
+
|
|
38
|
+
rake rokko
|
|
39
|
+
|
|
40
|
+
##Options and configuration
|
|
41
|
+
|
|
42
|
+
* `-i`, `--index=<file>` -- generate an index with links to HTML files or use `<file>` as index.
|
|
43
|
+
* `-l`, `--local` -- generate offline-ready documentation.
|
|
44
|
+
* `-o`, `--output=<dir>` -- directory where generated HTML files are written.
|
|
45
|
+
|
|
46
|
+
###Rake task
|
|
47
|
+
|
|
48
|
+
Usage:
|
|
49
|
+
|
|
50
|
+
Rokko::Task.new(:task_name, output_dir, filelist, opts)
|
|
51
|
+
|
|
52
|
+
Available options:
|
|
53
|
+
|
|
54
|
+
* `:local` -- generate offline-ready documentation.
|
|
55
|
+
* `:index` -- if value is a file name, then it will be used as an index. If value is `true` then
|
|
56
|
+
an index file with table of contents will be generated.
|
|
57
|
+
|
data/Rakefile
CHANGED
data/TODO
CHANGED
data/bin/rokko
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#/ Options:
|
|
7
7
|
#/ -i, --index=<file> Also generate an index with links to HTML files or use <file> as
|
|
8
8
|
#/ index
|
|
9
|
+
#/ -l, --local Generate offline-ready documentation
|
|
9
10
|
#/ -o, --output=<dir> Directory where generated HTML files are written
|
|
10
11
|
#/ --help Show this help message
|
|
11
12
|
|
|
@@ -46,6 +47,7 @@ ARGV.options { |o|
|
|
|
46
47
|
o.program_name = File.basename($0)
|
|
47
48
|
o.on("-o", "--output=DIR") {|dir| output_dir = dir}
|
|
48
49
|
o.on("-i", "--index [FILE]") {|index| index ? options[:index] = index : options[:generate_index] = true}
|
|
50
|
+
o.on("-l", "--local") {options[:local] = true}
|
|
49
51
|
o.on_tail("-h", "--help") {usage($stdout, 0)}
|
|
50
52
|
o.parse!
|
|
51
53
|
} or abort_with_note
|
|
@@ -78,7 +80,7 @@ if options[:generate_index]
|
|
|
78
80
|
require 'rokko/index_layout'
|
|
79
81
|
dest = File.join(output_dir, 'index.html')
|
|
80
82
|
puts "rokko: #{dest}"
|
|
81
|
-
File.open(dest, 'wb') {|fd| fd.write(Rokko::IndexLayout.new(sources, readme).render)}
|
|
83
|
+
File.open(dest, 'wb') {|fd| fd.write(Rokko::IndexLayout.new(sources, readme, options).render)}
|
|
82
84
|
end
|
|
83
85
|
|
|
84
86
|
# Generate and use specified file as index.
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
5
5
|
<title>{{ title }}</title>
|
|
6
|
-
|
|
7
|
-
{{
|
|
8
|
-
</style>
|
|
9
|
-
<script>{{{ highlight_js }}}</script>
|
|
6
|
+
{{{ styles }}}
|
|
7
|
+
{{{ highlight_js }}}
|
|
10
8
|
</head>
|
|
11
9
|
<body>
|
|
12
10
|
<div id="container">
|
data/lib/rokko/index_layout.rb
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
class Rokko::IndexLayout < Rokko::Layout
|
|
2
2
|
self.template_path = File.dirname(__FILE__)
|
|
3
3
|
|
|
4
|
-
def initialize(sources, readme = '')
|
|
4
|
+
def initialize(sources, readme = '', options = {})
|
|
5
5
|
@sources = sources
|
|
6
6
|
@readme = readme
|
|
7
|
+
@options = options
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
def title
|
data/lib/rokko/layout.mustache
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
5
5
|
<title>{{ title }}</title>
|
|
6
|
-
|
|
7
|
-
{{
|
|
8
|
-
</style>
|
|
9
|
-
<script>{{{ highlight_js }}}</script>
|
|
6
|
+
{{{ styles }}}
|
|
7
|
+
{{{ highlight_js }}}
|
|
10
8
|
</head>
|
|
11
9
|
<body>
|
|
12
10
|
<div id="container">
|
data/lib/rokko/layout.rb
CHANGED
|
@@ -5,6 +5,7 @@ module Rokko
|
|
|
5
5
|
|
|
6
6
|
def initialize(doc)
|
|
7
7
|
@doc = doc
|
|
8
|
+
@options = @doc.options
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
def title
|
|
@@ -12,16 +13,25 @@ module Rokko
|
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def styles
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
if @options[:local]
|
|
17
|
+
docco = File.read(File.join(File.dirname(__FILE__), 'assets', 'docco.css'))
|
|
18
|
+
highlight = File.read(File.join(File.dirname(__FILE__), 'assets', 'highlight.css'))
|
|
19
|
+
|
|
20
|
+
"<style type=\"text/css\" media=\"screen, projection\">#{docco}\n#{highlight}</style>"
|
|
21
|
+
else
|
|
22
|
+
"<link rel=\"stylesheet\" href=\"http://github.com/vast/rokko/raw/v#{::Rokko::VERSION}/lib/rokko/assets/docco.css\" />
|
|
23
|
+
<link rel=\"stylesheet\" href=\"http://github.com/vast/rokko/raw/v#{::Rokko::VERSION}/lib/rokko/assets/highlight.css\" />"
|
|
24
|
+
end
|
|
19
25
|
end
|
|
20
26
|
|
|
21
27
|
def highlight_js
|
|
22
|
-
js =
|
|
28
|
+
js = if @options[:local]
|
|
29
|
+
"<script>#{File.read(File.join(File.dirname(__FILE__), 'assets', 'highlight.pack.js'))}</script>"
|
|
30
|
+
else
|
|
31
|
+
"<script src=\"http://github.com/vast/rokko/raw/v#{::Rokko::VERSION}/lib/rokko/assets/highlight.pack.js\"></script>"
|
|
32
|
+
end
|
|
23
33
|
|
|
24
|
-
js + "\
|
|
34
|
+
js + "\n" + "<script>hljs.initHighlightingOnLoad();</script>\n"
|
|
25
35
|
end
|
|
26
36
|
|
|
27
37
|
def sections
|
data/lib/rokko/task.rb
CHANGED
|
@@ -38,7 +38,7 @@ module Rokko
|
|
|
38
38
|
require 'rokko/index_layout'
|
|
39
39
|
out_dest = File.join(@dest, 'index.html')
|
|
40
40
|
puts "rokko: #{out_dest}"
|
|
41
|
-
File.open(out_dest, 'wb') {|fd| fd.write(IndexLayout.new(@sources, readme).render)}
|
|
41
|
+
File.open(out_dest, 'wb') {|fd| fd.write(IndexLayout.new(@sources, readme, @options).render)}
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Run specified file through rokko and use it as index
|
data/lib/rokko/version.rb
CHANGED
data/lib/rokko.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rokko
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 27
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
+
- 1
|
|
8
9
|
- 0
|
|
9
|
-
|
|
10
|
-
version: 0.0.3
|
|
10
|
+
version: 0.1.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Vasily Polovnyov
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-03-23 00:00:00 +03:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -58,6 +58,7 @@ extra_rdoc_files: []
|
|
|
58
58
|
files:
|
|
59
59
|
- .gitignore
|
|
60
60
|
- Gemfile
|
|
61
|
+
- LICENSE
|
|
61
62
|
- README.md
|
|
62
63
|
- Rakefile
|
|
63
64
|
- TODO
|