lib/docurium.rb in docurium-0.3.1 vs lib/docurium.rb in docurium-0.3.2
- old
+ new
@@ -14,17 +14,21 @@
Rocco::Markdown = RedcarpetCompat
class Docurium
attr_accessor :branch, :output_dir, :data
- def initialize(config_file)
+ 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 = {}
@groups = {}
- repo_path = Rugged::Repository.discover('.')
- @repo = Rugged::Repository.new(repo_path)
+ if repo
+ @repo = repo
+ else
+ repo_path = Rugged::Repository.discover('.')
+ @repo = Rugged::Repository.new(repo_path)
+ end
clear_data
end
def clear_data(version = 'HEAD')
@data = {:files => [], :functions => {}, :globals => {}, :types => {}, :prefix => ''}
@@ -374,13 +378,15 @@
end
else # enum has name
@data[:types][r[:name]] ||= {}
wanted[:types].each do |k|
next unless r.has_key? k
+ contents = r[k]
if k == :comments
contents = md.render r[k]
- else
- contents = r[k]
+ elsif k == :block
+ old_block = @data[:types][r[:name]][k]
+ contents = old_block ? [old_block, r[k]].join("\n") : r[k]
end
@data[:types][r[:name]][k] = contents
end
end