Class: Rain::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rain.rb

Instance Method Summary collapse

Instance Method Details

#generate(*sources) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rain.rb', line 15

def generate(*sources)
	print "Rain is parsing files in the directories #{sources} \n"

	# loop through all of the file sources and generate docs
	all_docs = []
	sources.each do |source|
		print "Parsing #{source} \n"
		@doc = Rain::Doc.new(source, File.read(Dir.pwd + "/#{source}"), options[:log_parse].nil? ? false : true, options[:parse_signatures].nil? ? false : true)
		@doc.parse

		all_docs << @doc
	end

	# load the rainopts.yml file from local location (if it exists). otherwise use the default
	# one from the gem dir.
	if File.exist?('./rainopts.yml')
		rainopts = YAML.load_file('./rainopts.yml')
	else
		spec = Gem::Specification.find_by_name("rain-doc")
		rainopts = File.read(spec.gem_dir + '/rainopts.yml')
	end

	print "\nBuilding html output... \n"
	Rain::Output.new.build_html(all_docs, rainopts)
	print "\nDone! See rain_out/ directory for output.\n"
end

#helpObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rain.rb', line 44

def help
	print "       _      \n"
	print "     _( )_    \n"
	print "   _(     )_  \n"
	print "  (_________) \n"
	print "    \\ \\ \\ \\ \n"
	print "     \\ \\ \\ \\ \n"
	print "              \n"
	print "---- RAIN ----\n"
	print "              \n"
	print "basic usage:\n"
	print "  rain generate file/**/*.rb\n"
	print "options:\n"
	print "  --lp logs all line parsing output to console\n"
	print "  --s  generates docs for methods and class signatures\n"
end