Sha256: aa2d31eaa87dc57ce39f18a4d09dd9557a734e760d6d8a09620805965c3d106a
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
#!/usr/bin/env ruby require 'jazzy' require 'find' require 'fileutils' require 'optparse' options = { input: File.expand_path('.'), output: File.expand_path('docs'), excludes: [] } opt_parser = OptionParser.new do |opt| opt.banner = "Usage: jazzy [-i input] [-o output]" opt.separator "" opt.separator "Options" opt.on("-i","--input FOLDER","Folder to recursively search for header files") do |input| options[:input] = File.expand_path(input) end opt.on("-o","--output FOLDER","Folder to output the HTML docs to") do |output| options[:output] = File.expand_path(output) end opt.on("-e", "--exclude filepath1,filepath2,…filepathN", Array, "Exclude specific files") do |e| options[:excludes] = e # path will be expanded after we’re sure the input has been stored end opt.on("-h","--help","help") do puts opt_parser end end opt_parser.parse! options[:excludes] = options[:excludes].map { |p| File.expand_path(File.join(options[:input], p)) } paths = Jazzy.headers(options[:input]) - options[:excludes] FileUtils.rm_r options[:output] if File.directory?(options[:output]); Dir.mkdir options[:output] paths.each do |path| doc = Jazzy.document(path) path = File.join(options[:output], path.scan(/\/(\w+)\.h$/)[0][0]+'.html') File.open(path, 'w') { |file| file.write(doc) } end Jazzy.assets(options[:output])
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jazzy-0.0.4 | bin/jazzy |
jazzy-0.0.3 | bin/jazzy |