Module: PrettyDoc
- Defined in:
- lib/pretty_doc.rb,
lib/pretty_doc.rb,
lib/pretty_doc/cli.rb,
lib/pretty_doc/version.rb,
lib/pretty_doc/resource.rb,
lib/pretty_doc/template.rb,
lib/pretty_doc/converter.rb,
lib/pretty_doc/resources/scss.rb,
lib/pretty_doc/resources/source.rb,
lib/pretty_doc/converters/markdown.rb
Overview
Defined Under Namespace
Classes: Cli, Converter, Markdown, Resource, Template
Constant Summary
collapse
- VERSION =
'1.0.1'
Class Method Summary
collapse
Class Method Details
.mktmpdir ⇒ Object
69
70
71
72
73
74
|
# File 'lib/pretty_doc.rb', line 69
def self.mktmpdir
FileUtils.mkdir_p(tmpdir)
Dir.mktmpdir(nil, tmpdir) do |tmpdir|
yield(tmpdir)
end
end
|
.root ⇒ Object
61
62
63
|
# File 'lib/pretty_doc.rb', line 61
def self.root
Pathname.new(File.expand_path('../../', __FILE__))
end
|
.template(name) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/pretty_doc.rb', line 14
def self.template(name)
@template_loaded = false
try_load_template_from_gem name
try_load_template_from_dir name
try_load_template_from_defaults name
tmpl = Template.get(File.basename(name))
if @template_loaded && tmpl
tmpl
else
puts "No valid template '#{name}' found"
exit
end
end
|
.tmpdir ⇒ Object
65
66
67
|
# File 'lib/pretty_doc.rb', line 65
def self.tmpdir
PrettyDoc.root.join('tmp')
end
|
.try_load_template_from_defaults(name = '') ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/pretty_doc.rb', line 50
def self.try_load_template_from_defaults(name = '')
unless @template_loaded
begin
require PrettyDoc.root.join('templates', name, 'init.rb')
@template_loaded = true
rescue LoadError
@template_loaded = false
end
end
end
|
.try_load_template_from_dir(name = '') ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/pretty_doc.rb', line 39
def self.try_load_template_from_dir(name = '')
if !@template_loaded && Dir.exist?(File.expand_path(name))
begin
require File.join(File.expand_path(name), 'init.rb')
@template_loaded = true
rescue LoadError
@template_loaded = false
end
end
end
|
.try_load_template_from_gem(name = '') ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/pretty_doc.rb', line 28
def self.try_load_template_from_gem(name = '')
unless @template_loaded
begin
require name
@template_loaded = true
rescue LoadError
@template_loaded = false
end
end
end
|