Class: Mutx::Support::Documentation

Inherits:
Object
  • Object
show all
Defined in:
lib/mutx/support/documentation.rb

Constant Summary collapse

@@main_folder =
File.expand_path("../../../../", __FILE__) + "/"
@@docs_folder =
@@main_folder + "documentation/"
@@folders_to_search =
[@@main_folder, @@docs_folder]

Class Method Summary collapse

Class Method Details

.generate_entry(name, text) ⇒ Object



27
28
29
30
31
32
# File 'lib/mutx/support/documentation.rb', line 27

def self.generate_entry name, text
  {
      "title" => name,
      "body" => text
  }
end

.load_documentationObject



12
13
14
15
16
17
# File 'lib/mutx/support/documentation.rb', line 12

def self.load_documentation
  print "\nLoading documentation..."
  Mutx::Database::MongoConnector.clean_documentation
  @@folders_to_search.each { |folder| self.open_files folder }
  print "OK"
end

.open_files(folder) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/mutx/support/documentation.rb', line 19

def self.open_files folder
  Dir.glob(folder + "*.md") do |md_file|
    name = md_file.split("/").last.gsub('.md','')
    text = File.read(md_file)
    Mutx::Database::MongoConnector.insert_documentation self.generate_entry(name,text)
  end
end