diff --git a/docs/js/docurium.js b/docs/js/docurium.js
index 4365f5b5d..466c63d0d 100644
--- a/docs/js/docurium.js
+++ b/docs/js/docurium.js
@@ -39,7 +39,7 @@ $(function() {
content = $('.content')
content.empty()
- content.append($('
').append("API Docs"))
+ content.append($('').append("Public API Functions"))
// Function Groups
for (var i in data['groups']) {
diff --git a/lib/docurium.rb b/lib/docurium.rb
index 508aeb821..ab7248e3e 100644
--- a/lib/docurium.rb
+++ b/lib/docurium.rb
@@ -5,24 +5,27 @@
class Docurium
Version = VERSION = '0.0.1'
- attr_accessor :header_dir, :branch, :output_dir, :valid, :data
+ attr_accessor :header_dir, :branch, :output_dir, :data
- def initialize(dir)
- @valid = false
+ def initialize(config_file)
@data = {:files => [], :functions => {}, :globals => {}, :types => {}, :prefix => ''}
- if !dir
- puts "You need to specify a directory"
- else
- @valid = true
- @data[:prefix] = "include/git2"
- @header_dir = File.expand_path(dir)
- end
+ raise "You need to specify a config file" if !config_file
+ raise "You need to specify a valid config file" if !valid_config(config_file)
end
- def set_function_filter(prefix)
- @prefix_filter = prefix
+ def valid_config(file)
+ return false if !File.file?(file)
+ fpath = File.expand_path(file)
+ @project_dir = File.dirname(fpath)
+ @config_file = File.basename(fpath)
+ @options = JSON.parse(File.read(fpath))
+ @data[:prefix] = @options['input'] || ''
+ @header_dir = File.join(@project_dir, @data[:prefix])
+ raise "Not an input directory" if !File.directory?(@header_dir)
+ true
end
+
def set_branch(branch)
@branch = branch
end
@@ -57,7 +60,11 @@ def parse_headers
def group_functions
func = {}
@data[:functions].each_pair do |key, value|
- k = key.gsub(@prefix_filter, '') if @prefix_filter
+ if @options['prefix']
+ k = key.gsub(@options['prefix'], '')
+ else
+ k = key
+ end
group, rest = k.split('_', 2)
next if group.empty?
if !rest
diff --git a/lib/docurium/cli.rb b/lib/docurium/cli.rb
index 1cbf10553..f0366d941 100644
--- a/lib/docurium/cli.rb
+++ b/lib/docurium/cli.rb
@@ -3,15 +3,7 @@ class CLI
def self.doc(idir, options)
doc = Docurium.new(idir)
- if doc.valid
- doc.set_function_filter(options[:f]) if options[:f]
- if options[:b]
- doc.set_branch(options[:b])
- elsif options[:o]
- doc.set_output_dir(options[:o])
- end
- doc.generate_docs
- end
+ doc.generate_docs
end
end