docme 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/docme.rb +9 -8
- data/lib/docme/DocmeCLI.rb +15 -14
- data/lib/docme/block.rb +0 -1
- data/lib/docme/page.rb +2 -2
- data/lib/docme/rake_task.rb +0 -1
- data/lib/docme/utils.rb +10 -14
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d33d597f12ed9d841234cedd2ce1c36a7a7c1eb
|
4
|
+
data.tar.gz: f70136bd3a009b72107a70b3c23ae4969e9ae2ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebd174751b8cf1847a44ec123572dbba5d7832a1370b1fea5c52378bbfc03b01823e4b67a0e23cb4f584e3568225890e5c411d23c56857a4f1e9989e0d7e7920
|
7
|
+
data.tar.gz: 0324861098261957dd3580682757ae0a38c61856aace13c56192f3a31df825ab16aae857da2fcd5461e20767bc2aff901e014f3792f36b151a00afa65b0a8373
|
data/lib/docme.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'docme/utils'
|
5
5
|
require 'erb'
|
6
6
|
require 'fileutils'
|
7
|
+
require 'rainbow/ext/string'
|
7
8
|
|
8
9
|
class Docme
|
9
10
|
|
@@ -15,7 +16,7 @@ class Docme
|
|
15
16
|
@index = index
|
16
17
|
@page_erb = page_erb
|
17
18
|
|
18
|
-
puts '+ docme will parse: ' + @path if @is_verbose
|
19
|
+
puts '+ docme will parse: '.color(:cyan) + @path if @is_verbose
|
19
20
|
|
20
21
|
make_home
|
21
22
|
end
|
@@ -33,7 +34,7 @@ class Docme
|
|
33
34
|
if Dir.exist?('docme_site')
|
34
35
|
clean_directory('docme_site', @is_verbose)
|
35
36
|
else
|
36
|
-
puts "+ Setting up docme's living arrangements." if @is_verbose
|
37
|
+
puts "+ Setting up docme's living arrangements.".color(:cyan) if @is_verbose
|
37
38
|
Dir.mkdir('docme_site')
|
38
39
|
puts ' - Woohoo! docme has a home!' if @is_verbose
|
39
40
|
end
|
@@ -41,7 +42,7 @@ class Docme
|
|
41
42
|
|
42
43
|
def scan_docs
|
43
44
|
|
44
|
-
puts '+ docme scanning: ' + @path if @is_verbose
|
45
|
+
puts '+ docme scanning: '.color(:cyan) + @path if @is_verbose
|
45
46
|
|
46
47
|
# if a directory was provided
|
47
48
|
if File.directory?(@path)
|
@@ -56,7 +57,7 @@ class Docme
|
|
56
57
|
end
|
57
58
|
|
58
59
|
def render_docs
|
59
|
-
puts '+ docme generated the following pages: ' if @is_verbose
|
60
|
+
puts '+ docme generated the following pages: '.color(:cyan) if @is_verbose
|
60
61
|
@pages.each do |page_object|
|
61
62
|
page_object.render_site(@pages, @page_erb)
|
62
63
|
puts ' - ' + page_object.name if @is_verbose
|
@@ -65,7 +66,7 @@ class Docme
|
|
65
66
|
|
66
67
|
def render_index
|
67
68
|
|
68
|
-
puts '+ docme is creating the index' if @is_verbose
|
69
|
+
puts '+ docme is creating the index'.color(:cyan) if @is_verbose
|
69
70
|
|
70
71
|
if @index.nil?
|
71
72
|
template = File.read(File.join(File.dirname(__FILE__), 'templates/index.erb'))
|
@@ -82,11 +83,11 @@ class Docme
|
|
82
83
|
# add page to docme dir
|
83
84
|
FileUtils.mv('site_index.html', 'docme_site/site_index.html')
|
84
85
|
|
85
|
-
puts '+ index created' if @is_verbose
|
86
|
+
puts '+ index created'.color(:cyan) if @is_verbose
|
86
87
|
end
|
87
88
|
|
88
89
|
def render_css
|
89
|
-
puts '+ docme is styling' if @is_verbose
|
90
|
+
puts '+ docme is styling'.color(:cyan) if @is_verbose
|
90
91
|
|
91
92
|
if @style.nil?
|
92
93
|
template = File.read(File.join(File.dirname(__FILE__), 'templates/style.erb'))
|
@@ -103,7 +104,7 @@ class Docme
|
|
103
104
|
# add page to docme dir
|
104
105
|
FileUtils.mv('style.css', 'docme_site/style.css')
|
105
106
|
|
106
|
-
puts '+ styling completed' if @is_verbose
|
107
|
+
puts '+ styling completed'.color(:cyan) if @is_verbose
|
107
108
|
|
108
109
|
end
|
109
110
|
|
data/lib/docme/DocmeCLI.rb
CHANGED
@@ -5,44 +5,45 @@ require 'docme'
|
|
5
5
|
require 'docme/utils'
|
6
6
|
require 'fileutils'
|
7
7
|
require 'thor'
|
8
|
+
require 'rainbow/ext/string'
|
8
9
|
|
9
10
|
class DocmeCLI < Thor
|
10
11
|
class_option :v, type: :boolean
|
11
12
|
|
12
|
-
desc 'default', '
|
13
|
+
desc 'default', 'docme'.color(:blue) + ' : When no commands are provided docme will begin the current directory and parse through all eligible folders and files.'
|
13
14
|
option :style, type: :string
|
14
15
|
option :index, type: :string
|
15
16
|
option :page, type: :string
|
16
17
|
def default
|
17
18
|
path = Dir.pwd
|
18
|
-
puts "\n ***Begining docme magix***"
|
19
|
+
puts "\n ***Begining docme magix***".color(:green)
|
19
20
|
|
20
21
|
docmeer = Docme.new(path, options[:v], options[:style], options[:index], options[:page])
|
21
22
|
docmeer.engage
|
22
23
|
|
23
|
-
puts "\n ***Finished docme magic!***"
|
24
|
-
puts "\n You can find your docs inside the `docme_site` folder. \n Hint: look for site_index.html\n\n"
|
24
|
+
puts "\n ***Finished docme magic!***".color(:green)
|
25
|
+
puts "\n You can find your docs inside the `docme_site` folder. \n Hint: look for site_index.html\n\n".color(:green)
|
25
26
|
|
26
27
|
end
|
27
28
|
|
28
|
-
desc 'clean', '
|
29
|
+
desc 'clean', 'docme clean <path>'.color(:blue) + ' : Attemtps to empty and remove the docme_site directory. Path is optional and should point to a directory containing a `docme_site` folder. If an error is returned then you will have to delete the folder manually.'
|
29
30
|
def clean(path = nil)
|
30
31
|
path = Dir.pwd if path.nil?
|
31
32
|
|
32
|
-
fail 'Please provide a valid path to a directory that contains a `docme_site` folder.' unless Dir.exist?(path + '/docme_site')
|
33
|
+
fail 'Please provide a valid path to a directory that contains a `docme_site` folder.'.color(:red) unless Dir.exist?(path + '/docme_site')
|
33
34
|
|
34
|
-
puts '+ docme will clean ' + path if options[:v]
|
35
|
-
puts '+ docme cleaning' if options[:v]
|
35
|
+
puts '+ docme will clean '.color(:cyan) + path if options[:v]
|
36
|
+
puts '+ docme cleaning'.color(:cyan) if options[:v]
|
36
37
|
|
37
38
|
clean_directory(path + '/docme_site', options[:v])
|
38
39
|
Dir.rmdir(path + '/docme_site') if Dir.exist?(path + '/docme_site')
|
39
40
|
|
40
|
-
puts '+ docme_site removed' if options[:v]
|
41
|
-
puts '+ docme is now homeless' if options[:v]
|
41
|
+
puts '+ docme_site removed'.color(:cyan) if options[:v]
|
42
|
+
puts '+ docme is now homeless'.color(:cyan) if options[:v]
|
42
43
|
|
43
44
|
end
|
44
45
|
|
45
|
-
desc 'parse', '
|
46
|
+
desc 'parse', 'docme parse <path>'.color(:blue) + ' -- Either provide a path to a file or a path to a directory and docme will parse all valid files found.'
|
46
47
|
long_desc <<-LONGDESC
|
47
48
|
`docme parse <path/to/file>` will parse a single file specified
|
48
49
|
|
@@ -61,13 +62,13 @@ class DocmeCLI < Thor
|
|
61
62
|
option :page, type: :string
|
62
63
|
def parse(path)
|
63
64
|
|
64
|
-
puts "\n ***Begining docme magix***"
|
65
|
+
puts "\n ***Begining docme magix***".color(:green)
|
65
66
|
|
66
67
|
docmeer = Docme.new(path, options[:v], options[:style], options[:index], options[:page])
|
67
68
|
docmeer.engage
|
68
69
|
|
69
|
-
puts "\n ***Finished docme magic!***"
|
70
|
-
puts "\n You can find your docs inside the `docme_site` folder. \n Hint: look for index.html\n\n"
|
70
|
+
puts "\n ***Finished docme magic!***".color(:green)
|
71
|
+
puts "\n You can find your docs inside the `docme_site` folder. \n Hint: look for index.html\n\n".color(:green)
|
71
72
|
|
72
73
|
end
|
73
74
|
|
data/lib/docme/block.rb
CHANGED
data/lib/docme/page.rb
CHANGED
@@ -19,14 +19,14 @@ class Page
|
|
19
19
|
@name = clean_filename(file)
|
20
20
|
@source_file = File.open(file).read
|
21
21
|
@page_erb = '../templates/page.erb'
|
22
|
-
@blocks
|
22
|
+
@blocks = []
|
23
23
|
@is_empty = true
|
24
24
|
end
|
25
25
|
|
26
26
|
def parse_blocks
|
27
27
|
block = []
|
28
28
|
|
29
|
-
@source_file.each_line
|
29
|
+
@source_file.each_line do |line|
|
30
30
|
strip_line = line.lstrip
|
31
31
|
|
32
32
|
# if this is the begining of a comment block then start a new function doc
|
data/lib/docme/rake_task.rb
CHANGED
data/lib/docme/utils.rb
CHANGED
@@ -57,8 +57,7 @@ def parse_directory(path, is_verbose = nil)
|
|
57
57
|
|
58
58
|
# for each file in the sub directory
|
59
59
|
Dir.foreach(path) do |f|
|
60
|
-
|
61
|
-
next if f == '.' || f == '..' || f.rindex('.', 0) || unsupported_encoding(f) || unsupported_extension(f)
|
60
|
+
next if f == '.' || f == '..' || f.rindex('.', 0) || unsupported_encoding(f) || unsupported_extension(f)
|
62
61
|
|
63
62
|
# if another directory then go inside
|
64
63
|
if File.directory?(path + '/' + f)
|
@@ -80,26 +79,23 @@ def parse_directory(path, is_verbose = nil)
|
|
80
79
|
end
|
81
80
|
|
82
81
|
def parse_file(file, is_verbose = nil)
|
82
|
+
return unless File.file?(file)
|
83
|
+
return unless File.exist?(file)
|
84
|
+
return if file.rindex('.', 0)
|
85
|
+
return if unsupported_encoding(file)
|
86
|
+
return if unsupported_extension(file)
|
83
87
|
|
84
|
-
|
85
|
-
|
86
|
-
puts ' - docme parsing page: ' + file if is_verbose
|
87
|
-
|
88
|
-
page = Page.new(file)
|
89
|
-
page.parse_blocks
|
88
|
+
puts ' - docme parsing page: ' + file if is_verbose
|
90
89
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
nil
|
95
|
-
end
|
90
|
+
page = Page.new(file)
|
91
|
+
page.parse_blocks
|
92
|
+
page
|
96
93
|
|
97
94
|
end
|
98
95
|
|
99
96
|
def clean_directory(path, is_verbose = nil)
|
100
97
|
# for each file in the directory
|
101
98
|
Dir.foreach(path) do |f|
|
102
|
-
|
103
99
|
next if f == '.' || f == '..'
|
104
100
|
|
105
101
|
# if another directory then go inside
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bailey Belvis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A gem to support easy documentation for any file that recognizes `/*
|
14
14
|
*/` as a code block. This gem lets you easily parse multiple files in a directory
|
@@ -40,17 +40,17 @@ require_paths:
|
|
40
40
|
- lib
|
41
41
|
required_ruby_version: !ruby/object:Gem::Requirement
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
52
|
rubyforge_project:
|
53
|
-
rubygems_version: 2.
|
53
|
+
rubygems_version: 2.4.5
|
54
54
|
signing_key:
|
55
55
|
specification_version: 4
|
56
56
|
summary: A documentation site generator.
|