lib/docurium.rb in docurium-0.5.0 vs lib/docurium.rb in docurium-0.6.0
- old
+ new
@@ -21,11 +21,11 @@
def initialize(config_file, repo = nil)
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)
@sigs = {}
- @repo = repo || Rugged::Repository.discover('.')
+ @repo = repo || Rugged::Repository.discover(config_file)
end
def init_data(version = 'HEAD')
data = {:files => [], :functions => {}, :callbacks => {}, :globals => {}, :types => {}, :prefix => ''}
data[:prefix] = option_version(version, 'input', '')
@@ -117,16 +117,26 @@
read_subtree(index, version, option_version(version, 'input', ''))
data = parse_headers(index, version)
data
end
- def generate_docs
+ def generate_docs(options)
output_index = Rugged::Index.new
write_site(output_index)
@tf = File.expand_path(File.join(File.dirname(__FILE__), 'docurium', 'layout.mustache'))
versions = get_versions
versions << 'HEAD'
+ # If the user specified versions, validate them and overwrite
+ if !(vers = options[:for]).empty?
+ vers.each do |v|
+ next if versions.include?(v)
+ puts "Unknown version #{v}"
+ exit(false)
+ end
+ versions = vers
+ end
+
nversions = versions.size
output = Queue.new
pipes = {}
versions.each do |version|
# We don't need to worry about joining since this process is
@@ -362,12 +372,12 @@
k = key.gsub(@options['prefix'], '')
else
k = key
end
group, rest = k.split('_', 2)
- next if group.empty?
- if !rest
- group = value[:file].gsub('.h', '').gsub('/', '_')
+ if group.empty?
+ puts "empty group for function #{key}"
+ next
end
data[:functions][key][:group] = group
func[group] ||= []
func[group] << key
func[group].sort!