markdown_ruby_documentation 0.21.0 → 0.21.1
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 +4 -4
- data/.travis.yml +1 -1
- data/lib/markdown_ruby_documentation/constants_presenter.rb +1 -1
- data/lib/markdown_ruby_documentation/generate.rb +10 -8
- data/lib/markdown_ruby_documentation/summary.rb +24 -8
- data/lib/markdown_ruby_documentation/template_parser/parsing.rb +2 -13
- data/lib/markdown_ruby_documentation/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3779e78fb8a38de3bccb66c1720364fd3046b1d5
|
4
|
+
data.tar.gz: 20e8cc52b0064550321725d7bca00809a35347a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa2ee231bd40b97f8f3e16b427da2f555ee47694acbbe8c14617e8b077e71a8d0783d8f88b15b1934be02dbbebb2716245ef34c9ca3d1d14f255541a888b1f25
|
7
|
+
data.tar.gz: f99c57df386e547070bd4160c1184d20e666bdbf31d4edfd24c0360b02080747d44b3b15a9adc89e9f3f4a3c0e8f00cd7687dc9850bdef5038deb3a0975d146d
|
data/.travis.yml
CHANGED
@@ -25,14 +25,16 @@ module MarkdownRubyDocumentation
|
|
25
25
|
batches = subjects.each_slice(parallel_config.fetch(:in_threads, 2))
|
26
26
|
threads = []
|
27
27
|
batches.each do |batch|
|
28
|
-
threads << Thread.new(batch) do |
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
threads << Thread.new(batch) do |inner_batch|
|
29
|
+
Array[inner_batch].flatten.map do |subject|
|
30
|
+
progressbar.title = subject.fetch(:class).name.ljust(left_padding)
|
31
|
+
Page.new(
|
32
|
+
subject_class: subject.fetch(:class),
|
33
|
+
subject_location: subject.fetch(:file_path).to_s,
|
34
|
+
output_object: output_object,
|
35
|
+
erb_methods_class: erb_methods_class,
|
36
|
+
load_path: load_path
|
37
|
+
).call.tap { progressbar.increment }
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -8,21 +8,37 @@ module MarkdownRubyDocumentation
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def title
|
11
|
-
|
12
|
-
klass.is_a?(Class) && ![BasicObject, Object, subject].include?(klass)
|
13
|
-
end.sort_by { |klass| klass.name }
|
14
|
-
[format_class(subject), *ancestors.map { |a| create_link(a) }].join(" < ")
|
11
|
+
[format_class(subject), *ancestors_links].join(" < ")
|
15
12
|
end
|
16
13
|
|
17
14
|
def summary
|
18
|
-
|
19
|
-
|
20
|
-
descendants_links = descendants.map { |d| create_link(d) }.join(", ")
|
21
|
-
"Descendants: #{descendants_links}" if descendants.count >= 1
|
15
|
+
"Descendants: #{descendants_links.join(", ")}" if descendants.present?
|
22
16
|
end
|
23
17
|
|
24
18
|
private
|
25
19
|
|
20
|
+
def ancestors_links
|
21
|
+
ancestors.map(&method(:create_link))
|
22
|
+
end
|
23
|
+
|
24
|
+
def descendants_links
|
25
|
+
descendants.map(&method(:create_link))
|
26
|
+
end
|
27
|
+
|
28
|
+
def descendants
|
29
|
+
@descendants ||= begin
|
30
|
+
ObjectSpace.each_object(Class).select do |klass|
|
31
|
+
klass.try!(:name) && klass < subject && !(klass.name.to_s.include?("InstanceToClassMethods"))
|
32
|
+
end.sort_by(&:name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def ancestors
|
37
|
+
subject.ancestors.select do |klass|
|
38
|
+
klass.is_a?(Class) && ![BasicObject, Object, subject].include?(klass)
|
39
|
+
end.sort_by(&:name)
|
40
|
+
end
|
41
|
+
|
26
42
|
def create_link(klass)
|
27
43
|
erb_methods_class.link_to_markdown(klass.to_s, title: format_class(klass))
|
28
44
|
end
|
@@ -68,12 +68,7 @@ module MarkdownRubyDocumentation
|
|
68
68
|
|
69
69
|
def get_line_number(file, word)
|
70
70
|
return unless file && word
|
71
|
-
|
72
|
-
file_or_result = File.open(file, "r") { |file| file.each_line { |line|
|
73
|
-
count += 1
|
74
|
-
return count if line =~ /^[\s]*#{word}/
|
75
|
-
}}
|
76
|
-
file_or_result.is_a?(File) ? nil : file_or_result
|
71
|
+
`grep -nr -m 1 "^[\s]*#{word}" #{file}`.match(/#{file}:(\d*)/).to_a[1].try!(:to_i)
|
77
72
|
end
|
78
73
|
|
79
74
|
def look_for_class_macro_comment(method)
|
@@ -88,13 +83,7 @@ module MarkdownRubyDocumentation
|
|
88
83
|
end
|
89
84
|
|
90
85
|
def extract_dsl_comment(comment_string)
|
91
|
-
|
92
|
-
v
|
93
|
-
elsif (x = when_only_start(comment_string))
|
94
|
-
x
|
95
|
-
else
|
96
|
-
""
|
97
|
-
end
|
86
|
+
[when_start_and_end(comment_string), when_only_start(comment_string), ""].compact.first
|
98
87
|
end
|
99
88
|
|
100
89
|
def when_start_and_end(comment_string)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_ruby_documentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.21.
|
4
|
+
version: 0.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
162
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.
|
163
|
+
rubygems_version: 2.6.14
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: Allows creating business or technical documentation that can stays automatically
|