docface 0.0.4 → 0.0.5

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzI4MGRiODI4Y2I1ZTBlMDAwZDdhMjA4Mzk5MWEwMjJiOTMxMzlkYQ==
4
+ MWRiNTg0ZWU2NmRhYmRiNTg0YmMzZDM3NDRiZGNhN2E3OGM5ZGU1Yw==
5
5
  data.tar.gz: !binary |-
6
- NmI5NTI4YzRhOWY3YzAxZDQ4M2EyZTg5ZmM2ZmIzM2M0MDlkMGZjMw==
6
+ ZjRkZDA2NTE5OGI5ODg0MmQyM2IxYWY5NDM1YTJiNTY4ODUwNmYzMw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ODQzNTU2Yjc4OWM4Y2JiMDZmYWQwMTMxODFkZTYzMzFjZGM3OWQyMTIxNzQ5
10
- ZGZjZTRjMjUzNjgwNTZjNTQxYjFlN2MwMDcyYjNjMjg4MGJlMzg4MThiZTBm
11
- NzNlYzI0YzkzYzhlYjMxOWQ5ODY3ZjlkM2I5NGY0NGIyMDhjYWQ=
9
+ N2U4YTZkMTdkODk0NWQyMmM5NWYzODIxYzg5MTU0NGEzOTBiMjE1NDZmOTMx
10
+ YzNhMTM2MWU5NzI3NjQ4YzIzMzI2Y2EyODgxMzk1ZTZiMjAwZjVkMWQ4YWEw
11
+ NTcxZmU3ZGI2MDg0NDExYTcyMmFmYmZhZTkzYWQ4NjljYzQzMzg=
12
12
  data.tar.gz: !binary |-
13
- ZDhlNDE3OTMzMTg5MDQwMGYzZDZiOGU5N2JhMDNhZGNiZTIxNGFjMWFmYjE3
14
- ODcxMjdhMjg1NThlOTRhMDkxZmQzZTFiNzY0N2EwZDcyNzg2ZmQ3OWFjMmZl
15
- YTAwZjU4ZjE1MWQ2YzE0ZWIzNjU2YjJjNzYwZWVlZTJlNTc0NTE=
13
+ YjQxOTkzOTJjMTI4ZjNlNzU3ZDMxNTA1YmQ1ZWFlMWRlMzI3ODgyNGIxMTUz
14
+ ZTI5NDZiMDZkYzlkZGU4YjcxZTQ5Mjg4YWY5YThkOGI2ZTJhMGJlODViZGYx
15
+ ZjQxODdiNDY2ZTNkY2IxYWI3OWRkMzM0NjcwNWY0NmE1NzJjMmQ=
data/lib/docface/base.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  require 'docface/file_troll'
2
2
  require 'docface/parser'
3
3
  require 'docface/writer'
4
- require 'erb'
5
4
  require 'docface/cli'
5
+ require 'erb'
6
+ require 'rainbow'
6
7
 
7
8
  module DocFace
8
9
  class Base
@@ -17,14 +18,17 @@ module DocFace
17
18
  end
18
19
 
19
20
  def all_the_things
21
+ time = Time.now
20
22
  @directory.each do |dir|
21
23
  files = @troll.troll(dir)
22
24
  parse(files,dir)
23
25
  end
24
26
  @index_hash = @troll.index_hash(@short_files)
25
- cleanup(@index_hash)
27
+ @troll.cleanup(@index_hash)
26
28
  assets
27
29
  write_index(build_index("templates/index.erb"))
30
+ time_taken = Time.now - time
31
+ puts "Your build was created at #{@output_dir}.\n\r#{@short_files.count} documents were parsed in #{time_taken} seconds.".color(:cyan)
28
32
  end
29
33
 
30
34
  def cli
@@ -40,13 +44,17 @@ module DocFace
40
44
  def parse(files,directory)
41
45
  files.each do |file|
42
46
  content = @parser.to_html(File.read(file))
43
- dir = directory.gsub(directory.split('/').last, "")
44
- file = file.gsub(dir, "")
45
- @short_files << file
47
+ @short_files << strip_path(file,directory)
48
+ puts file.color(:yellow) if @cli[:verbose]
46
49
  build(file,content)
47
50
  end
48
51
  end
49
52
 
53
+ def strip_path(file,directory)
54
+ dir = directory.gsub(/\/*$/,'').gsub(directory.split('/').last, "")
55
+ file = file.gsub(dir, "")
56
+ end
57
+
50
58
  def build(file,content)
51
59
  file = File.join(@output_dir,file).gsub(/\.md|.MD|.markdown|.mdown/,".html")
52
60
  directory = File.dirname(file)
@@ -66,11 +74,5 @@ module DocFace
66
74
  @writer.write(@output_dir,"#{@output_dir}/index.html",content)
67
75
  end
68
76
 
69
- def cleanup(h)
70
- return true if h.empty?
71
- h.find_all{|k,v|h[k]=nil if v.is_a?(Hash)&&cleanup(v)}
72
- false
73
- end
74
-
75
77
  end
76
78
  end
data/lib/docface/cli.rb CHANGED
@@ -35,6 +35,7 @@ module DocFace
35
35
  opt :title, "The title of the page", :short => "t", :type => :string
36
36
  opt :summary, "A custom summary for the page", :short => "s", :type => :string
37
37
  opt :wide, "Pass this parameter if you need a wider nav", :short => "w"
38
+ opt :verbose, "Verbose CLI output", :short => "v"
38
39
  end
39
40
 
40
41
  opts = Trollop::with_standard_exception_handling p do
@@ -26,5 +26,11 @@ module DocFace
26
26
  tree
27
27
  end
28
28
 
29
+ def cleanup(h)
30
+ return true if h.empty?
31
+ h.find_all{|k,v|h[k]=nil if v.is_a?(Hash)&&cleanup(v)}
32
+ false
33
+ end
34
+
29
35
  end
30
36
  end
@@ -1,3 +1,3 @@
1
1
  module DocFace
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
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.4
4
+ version: 0.0.5
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-20 00:00:00.000000000 Z
11
+ date: 2013-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow