docface 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzE1N2UwNjNlZjFhNGFlMjQzZmFjN2EwMTZlMGMzMDJkNGJiYjlhZg==
4
+ MzI4MGRiODI4Y2I1ZTBlMDAwZDdhMjA4Mzk5MWEwMjJiOTMxMzlkYQ==
5
5
  data.tar.gz: !binary |-
6
- NTIzNzYxYjlmNDExYjVkMmJiNjMwMDFkNGYwNWYwZDU1NDJkYmU5NQ==
6
+ NmI5NTI4YzRhOWY3YzAxZDQ4M2EyZTg5ZmM2ZmIzM2M0MDlkMGZjMw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZTEwZjc5N2M4ZmYwZWJkZTVmYzk3OGM5ZmM0YjQzZjA2N2JkMDNmMzVhNDM3
10
- MmM3ZjRlNjI4ZjkzYzQwNGY5OTk3MWQ4ODk4NTk4MTNiZjQzYTAxODc3ZTA4
11
- NjM3ODJhZjAyYjE4NmFjMGM0ZjI3ZWVlMDliZmM5Mjk1NjlhYjY=
9
+ ODQzNTU2Yjc4OWM4Y2JiMDZmYWQwMTMxODFkZTYzMzFjZGM3OWQyMTIxNzQ5
10
+ ZGZjZTRjMjUzNjgwNTZjNTQxYjFlN2MwMDcyYjNjMjg4MGJlMzg4MThiZTBm
11
+ NzNlYzI0YzkzYzhlYjMxOWQ5ODY3ZjlkM2I5NGY0NGIyMDhjYWQ=
12
12
  data.tar.gz: !binary |-
13
- ZWUxZWY3ZDIxOWNmZmYxYmYzNGM1MDU4ZWIwZmMyYjhjZmUxOGQxMDJiYTZl
14
- YjE3ZGVlNjA4MTFmNWNmOTNlMzc0ZmIzZjhhOGMxYjE0Nzg2ODQ1NWVkNWMz
15
- NmQwMmNkYWFmMTgyZjRkYjU0OWZkYjExZWE1OGE2NTVlMTczZTg=
13
+ ZDhlNDE3OTMzMTg5MDQwMGYzZDZiOGU5N2JhMDNhZGNiZTIxNGFjMWFmYjE3
14
+ ODcxMjdhMjg1NThlOTRhMDkxZmQzZTFiNzY0N2EwZDcyNzg2ZmQ3OWFjMmZl
15
+ YTAwZjU4ZjE1MWQ2YzE0ZWIzNjU2YjJjNzYwZWVlZTJlNTc0NTE=
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  DocFace
2
2
  =========
3
- DocFace turns your markdown files into html and makes them easy to view via a web page.
3
+ DocFace turns your markdown files into html and makes them easy to view via a web page. It will recursively look through the directories you specify and will build navigation in the directory heirarchy that it discovered the files in.
4
4
 
5
5
  I mainly created DocFace because I use Opscode Chef and you end up with tons of README and CHANGELOG files. I wanted to view these is some sane way.
6
6
 
7
7
  <img src="https://raw.github.com/agent462/docface/downloads/screenshot.png" title="docface screenshot" />
8
8
  Installation
9
9
  -----------------------
10
- ~~~~
10
+
11
+ ~~~~ ruby
11
12
  gem install docface
12
13
  ~~~~
13
14
 
@@ -19,13 +20,23 @@ gem build docface.gemspec
19
20
  Usage
20
21
  -----------------------
21
22
  ~~~~
22
- docface -d ~/git/chef
23
23
  docface -d ~/git/chef -o ~/my_docs
24
24
  ~~~~
25
25
 
26
+ * For multiple directories include them seperated by a space
27
+
28
+ ~~~~
29
+ docface -d ~/git/chef/cookbooks ~/git/chef/site-cookbooks
30
+ ~~~~
31
+
32
+ Known Issues
33
+ ------------
34
+ * Running locally and using Chrome? You're going to have a "same origin policy" issue. You can either put a webserver in front of it, use FireFox or try running Chrome with "--allow-file-access-from-files". Chrome prevents ajax calls to local files.
35
+
26
36
  Table of Contents
27
37
  -----------------
28
38
  Want a table of contents on your pages? Include the following snippet in your markdown file wherever you want the TOC.
39
+
29
40
  ~~~~
30
41
  * This will be replaced with the ToC
31
42
  {:toc}
data/docface.gemspec CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Bryan Brandau"]
10
10
  s.email = 'agent462@gmail.com'
11
11
  s.has_rdoc = false
12
+ s.licenses = ['APACHE']
12
13
 
13
14
  s.homepage ='http://github.com/agent462/docface'
14
15
  s.add_dependency('rainbow', '1.1.4')
data/lib/docface/base.rb CHANGED
@@ -30,7 +30,10 @@ module DocFace
30
30
  def cli
31
31
  @cli = Cli.opts
32
32
  @directory = @cli[:dir]
33
- @title = @cli[:title] || "DocFace"
33
+ @page_attributes = {
34
+ :title => @cli[:title] || "DocFace",
35
+ :summary => @cli[:summary] || ""
36
+ }
34
37
  @output_dir = @cli[:output] ? @cli[:output] : "#{Dir.pwd}/docface"
35
38
  end
36
39
 
@@ -45,7 +48,7 @@ module DocFace
45
48
  end
46
49
 
47
50
  def build(file,content)
48
- file = File.join(@output_dir,file).gsub(/\.md/,".html")
51
+ file = File.join(@output_dir,file).gsub(/\.md|.MD|.markdown|.mdown/,".html")
49
52
  directory = File.dirname(file)
50
53
  @writer.write(directory,file,content)
51
54
  end
data/lib/docface/cli.rb CHANGED
@@ -27,13 +27,14 @@ module DocFace
27
27
  EOS
28
28
  banner <<-EOS.gsub(/^ {10}/, '').color(:cyan)
29
29
 
30
- Example Usage: docface -d ~/git/chef -o ~/my_build
30
+ Example Usage: docface -d ~/git/chef/cookbooks ~/git/chef/site-cookbooks -o ~/my_build
31
31
  For help use: docface --help
32
32
  EOS
33
- opt :dir, "The directories to scan for markdown files", :short => "d", :type => :strings, :required => true
33
+ opt :dir, "The directories to scan for markdown files. For multiple directories, separate each directory with a space.", :short => "d", :type => :strings, :required => true
34
34
  opt :output, "The directory to write the generated output to", :short => "o", :type => :string
35
35
  opt :title, "The title of the page", :short => "t", :type => :string
36
- opt :description, "A custom description for the page", :short => "D", :type => :string
36
+ opt :summary, "A custom summary for the page", :short => "s", :type => :string
37
+ opt :wide, "Pass this parameter if you need a wider nav", :short => "w"
37
38
  end
38
39
 
39
40
  opts = Trollop::with_standard_exception_handling p do
@@ -5,7 +5,7 @@ module DocFace
5
5
  if File.directory?(dir)
6
6
  index = Array.new
7
7
  path = dir.gsub(/\\(?=\S)/, '/')
8
- Dir.glob(File.join(path, '**/*.md')).each do |file|
8
+ Dir.glob(File.join(path, '**/*.{md,MD,markdown,mdown}')).each do |file|
9
9
  index << file
10
10
  end
11
11
  index
@@ -1,8 +1,8 @@
1
- <div class="span9">
2
- <div id="center-container" class="well">
3
- <h1><%= @title %></h1>
4
- <p></p>
1
+ <div class="span<%= @cli[:wide] ? "9" : "10"%>">
2
+ <div id="center-container">
3
+ <h1><%= @page_attributes[:title] %></h1>
4
+ <p><span class="label label-info"><%= @short_files.count %></span> parsed markdown files. </p>
5
+ <p><%= @page_attributes[:summary] %></p>
5
6
  </div>
6
7
  </div>
7
8
  </div><!--/row -->
8
- </div><!--/containter-->
@@ -1,3 +1,9 @@
1
+ <hr>
2
+ <footer>
3
+ <p>documentation generated by <a href="http://github.com/agent462/docface">DocFace</a></p>
4
+ </footer>
5
+ </div><!--/containter-->
6
+
1
7
  <script type="text/javascript" src="public/js/jquery-2.0.0.min.js"></script>
2
8
  <script type="text/javascript" src="public/js/bootstrap.min.js"></script>
3
9
  <script type="text/javascript">
@@ -1,7 +1,7 @@
1
1
  <html><head>
2
2
  <meta charset="UTF-8">
3
3
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
- <title><%= @title %></title>
4
+ <title><%= @page_attributes[:title] %></title>
5
5
  <link rel="stylesheet" href="public/css/bootstrap.min.css">
6
6
  <link rel="stylesheet" href="public/css/doc.css">
7
7
  <style type="text/css">
@@ -6,8 +6,8 @@ def create_nav(h,path="")
6
6
  return if h == nil
7
7
  h.each do |k,v|
8
8
  @i += 1
9
- if k.end_with?("md")
10
- html_path = k.gsub(/md/, 'html')
9
+ if k.end_with?(".md") || k.end_with?(".MD") || k.end_with?(".markdown") || k.end_with?(".mdown")
10
+ html_path = k.gsub(/.md|.MD|.markdown|.mdown/, '.html')
11
11
  @str << "<ul class='nav nav-list'><li><a href=\"#\" res=\"#{path}/#{html_path}\">#{k}</a></li></ul>"
12
12
  else
13
13
  ## Accordion Header
@@ -38,7 +38,7 @@ end
38
38
  <span class="icon-bar"></span>
39
39
  <span class="icon-bar"></span>
40
40
  </button>
41
- <a class="brand" href="#"><%= @title %></a>
41
+ <a class="brand" href="#"><%= @page_attributes[:title] %></a>
42
42
  <div class="nav-collapse collapse">
43
43
  <ul class="nav">
44
44
  <li class="active"><a href="/">Home</a></li>
@@ -49,8 +49,8 @@ end
49
49
  </div>
50
50
  <div class="container-fluid">
51
51
  <div class="row-fluid">
52
- <div class="span3">
53
- <div class="well sidebar-nav">
52
+ <div class="span<%= @cli[:wide] ? "3" : "2"%>">
53
+ <div class="sidebar-nav">
54
54
  <div class='accordion'>
55
55
  <% @index_hash.each do |k,v| %>
56
56
  <div class='accordion-group'>
@@ -1,3 +1,3 @@
1
1
  module DocFace
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/public/css/doc.css CHANGED
@@ -6,7 +6,7 @@ h2 {
6
6
  font-size: 1.5em;
7
7
  padding-top: 1.2em;
8
8
  margin: 1em 0 1em;
9
- border-top: 1px solid #ddd;
9
+ border-top: 2px solid #ddd;
10
10
  }
11
11
 
12
12
  h3 {
@@ -18,3 +18,15 @@ p {
18
18
  line-height:1.5em;
19
19
  margin: 1em 0 1.5em;
20
20
  }
21
+
22
+ .accordion .accordion-toggle {
23
+ padding: 8px 8px;
24
+ }
25
+
26
+ pre {
27
+ background-color: rgb(0, 0, 0);
28
+ color: rgb(248, 248, 248);
29
+ font-family: monospace;
30
+ font-size: 14px;
31
+ width: 800px;
32
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Brandau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-19 00:00:00.000000000 Z
11
+ date: 2013-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -97,7 +97,8 @@ files:
97
97
  - docface.gemspec
98
98
  - README.md
99
99
  homepage: http://github.com/agent462/docface
100
- licenses: []
100
+ licenses:
101
+ - APACHE
101
102
  metadata: {}
102
103
  post_install_message:
103
104
  rdoc_options: []