mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-23 20:31:17 +08:00
split DocsetGenerator#run to generating ruby code and generating HTML
This commit is contained in:
@@ -136,6 +136,7 @@ class DocsetGenerator
|
||||
def initialize(outpath, paths)
|
||||
@input_paths = []
|
||||
paths.each do |path|
|
||||
path = File.expand_path(path)
|
||||
if File.directory?(path)
|
||||
@input_paths.concat(Dir.glob(path + '/**/*.html'))
|
||||
else
|
||||
@@ -143,20 +144,27 @@ class DocsetGenerator
|
||||
end
|
||||
end
|
||||
@outpath = outpath
|
||||
@rb_files_dir = '/tmp/rb_docset'
|
||||
end
|
||||
|
||||
def run
|
||||
rb_files_dir = '/tmp/rb_docset'
|
||||
FileUtils.rm_rf(rb_files_dir)
|
||||
FileUtils.mkdir_p(rb_files_dir)
|
||||
def generate_ruby_code
|
||||
FileUtils.rm_rf(@rb_files_dir)
|
||||
FileUtils.mkdir_p(@rb_files_dir)
|
||||
|
||||
@input_paths.map { |path| parse_html_data(File.read(path)) }.compact.each_with_index do |code, n|
|
||||
File.open(File.join(rb_files_dir, "t#{n}.rb"), 'w') do |io|
|
||||
File.open(File.join(@rb_files_dir, "t#{n}.rb"), 'w') do |io|
|
||||
io.write(code)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
sh "yard doc #{rb_files_dir}"
|
||||
def generate_html
|
||||
sh "yard doc #{@rb_files_dir}"
|
||||
sh "mv doc \"#{@outpath}\""
|
||||
end
|
||||
|
||||
def run
|
||||
generate_ruby_code()
|
||||
generate_html()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user