class Docset::Base
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/docset/base.rb, line 7 def initialize(path) @path = path FileUtils.mkdir_p(documents_path) @db = IndexDB.new(docset_index_db_path) @db.init end
Public Instance Methods
add_content(from, to = '')
click to toggle source
# File lib/docset/base.rb, line 14 def add_content(from, to = '') dest_path = File.join(contents_path, to) FileUtils.mkdir_p(File.dirname(dest_path)) FileUtils.cp_r(from, dest_path) end
add_document(from, to = '')
click to toggle source
# File lib/docset/base.rb, line 20 def add_document(from, to = '') dest_path = File.join(documents_path, to) FileUtils.mkdir_p(File.dirname(dest_path)) FileUtils.cp_r(from, dest_path) end
add_index(name, type, path)
click to toggle source
# File lib/docset/base.rb, line 26 def add_index(name, type, path) @db.add_index(name, type, path) end
add_plist(plist)
click to toggle source
# File lib/docset/base.rb, line 30 def add_plist(plist) File.write(plist_path, plist.to_s) end
write_content(to, content)
click to toggle source
# File lib/docset/base.rb, line 34 def write_content(to, content) dest_path = File.join(contents_path, to) FileUtils.mkdir_p(File.dirname(dest_path)) File.write(dest_path, content) end
write_document(to, document)
click to toggle source
# File lib/docset/base.rb, line 40 def write_document(to, document) dest_path = File.join(documents_path, to) FileUtils.mkdir_p(File.dirname(dest_path)) File.write(dest_path, document) end
Private Instance Methods
contents_path()
click to toggle source
# File lib/docset/base.rb, line 48 def contents_path File.join(path, 'Contents') end
docset_index_db_path()
click to toggle source
# File lib/docset/base.rb, line 52 def docset_index_db_path File.join(resources_path, 'docSet.dsidx') end
documents_path()
click to toggle source
# File lib/docset/base.rb, line 56 def documents_path File.join(resources_path, 'Documents') end
plist_path()
click to toggle source
# File lib/docset/base.rb, line 60 def plist_path File.join(contents_path, 'Info.plist') end
resources_path()
click to toggle source
# File lib/docset/base.rb, line 64 def resources_path File.join(contents_path, 'Resources') end