Class: DocToDash::DocsetGenerator
- Inherits:
-
Object
- Object
- DocToDash::DocsetGenerator
- Defined in:
- lib/doc_to_dash.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ DocsetGenerator
constructor
A new instance of DocsetGenerator.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ DocsetGenerator
Returns a new instance of DocsetGenerator.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/doc_to_dash.rb', line 11 def initialize( = {}) @classes = [] @methods = [] @options = { :docset_name => 'DefaultDocset', :docset_output_path => 'doc/', # This is where the actual package will be created. :docset_output_filename => lambda {@options[:docset_name] + '.docset' }, :icon_path => File.(File.(File.dirname(__FILE__)) + '/../default_icon.png'), # This is the docset icon that never changes, if you want a default icon just set this to nil. :doc_input_path => nil, # This is the actual docs to copy over to the Docset. :doc_save_folder => 'docs', # This is the directory name it will store under /Contents/Resources/Documents/{this} :verbose => true, :index_file => nil, :parser => DocToDash::YardParser }.merge() @docset_path = File.(@options[:docset_output_path]) + '/' + @options[:docset_output_filename].call @doc_directory = @docset_path + '/Contents/Resources/Documents/' + @options[:doc_save_folder] end |
Instance Method Details
#run ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/doc_to_dash.rb', line 31 def run log "Beginning to generate Dash Docset." unless log "Error: " + @error # There was an error of some sort.. return false end clean_up_files create_structure copy_default_files copy_docs_to_docset create_database parser = @options[:parser].new(@doc_directory) @classes = parser.parse_classes @methods = parser.parse_methods if @methods && @classes load_methods_into_database load_classes_into_database log "Docset created." @docset_path else log "Docset could not be created. Parser returned no data." return false end rescue Errno::ENOENT log "Oops! Seems you've given us a wrong file path." end |