Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
source "http://rubygems.org"

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'rubysl', '~> 2.2'
end

gemspec

gem 'ffi-clang', :git => 'https://github.com/ioquatix/ffi-clang.git'

# vim:ft=ruby
7 changes: 5 additions & 2 deletions bin/cm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ version Docurium::Version
desc 'Generate HTML documentation'
long_desc 'Generate HTML docs from a Docurium config file'
command :doc do |c|
c.flag :for, :desc => "The version to generate", :multiple => true
c.action do |global_options,options,args|
file = args.first
Docurium::CLI.doc(file, options)
Expand All @@ -34,8 +35,10 @@ pre { |global,command,options,args| true }
post { |global,command,options,args| true }

on_error do |exception|
puts exception
puts exception.backtrace
if !exception.is_a?(SystemExit)
puts exception
puts exception.backtrace
end
end

exit run(ARGV)
7 changes: 4 additions & 3 deletions docurium.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ Gem::Specification.new do |s|
s.license = 'MIT'

s.add_dependency "version_sorter", "~>2.0"
s.add_dependency "mustache", "~> 0.99"
s.add_dependency "mustache", "~> 1.1"
s.add_dependency "rocco", "~>0.8"
s.add_dependency "gli", "~>2.5"
s.add_dependency "rugged", "~>0.21"
s.add_dependency "redcarpet", "~>3.0"
s.add_dependency "ffi-clang", "~> 0.2"
s.add_dependency "ffi-clang", "~> 0.5"
s.add_development_dependency "bundler", "~>1.0"
s.add_development_dependency "rake", "~> 10.1"
s.add_development_dependency "rake", "~> 12"
s.add_development_dependency "minitest", "~> 5.11"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand Down
14 changes: 12 additions & 2 deletions lib/docurium.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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')
Expand Down Expand Up @@ -119,12 +119,22 @@ def generate_doc_for(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 = {}
Expand Down
2 changes: 1 addition & 1 deletion lib/docurium/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class CLI

def self.doc(idir, options)
doc = Docurium.new(idir)
doc.generate_docs
doc.generate_docs(options)
end

def self.gen(file)
Expand Down
2 changes: 1 addition & 1 deletion lib/docurium/docparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def parse_file(orig_filename, files)
unsaved = files.map do |name, contents|
full_path = File.join(tmpdir, name)
dirname = File.dirname(full_path)
FileUtils.mkdir_p(dirname) unless Dir.exists? dirname
FileUtils.mkdir_p(dirname) unless Dir.exist? dirname
File.new(full_path, File::CREAT).close()

UnsavedFile.new(full_path, contents)
Expand Down
2 changes: 1 addition & 1 deletion test/repo_test.rb → test/docurium_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'docurium'
require 'rugged'

class DocuriumTest < MiniTest::Unit::TestCase
class DocuriumTest < Minitest::Test

def setup
@dir = Dir.mktmpdir()
Expand Down
4 changes: 2 additions & 2 deletions test/gen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'docurium/cli'
require 'tempfile'

class GenTest < MiniTest::Unit::TestCase
class GenTest < Minitest::Test

# make sure we can read what we give the user
def test_read_generated_file
Expand All @@ -12,7 +12,7 @@ def test_read_generated_file
Docurium::CLI.gen(file.path)
end

Docurium.new file.path
assert_raises(Rugged::RepositoryError) { Docurium.new file.path }
end

end
2 changes: 1 addition & 1 deletion test/parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'docurium'
require 'pp'

class TestParser < Minitest::Unit::TestCase
class ParserTest < Minitest::Test

def setup
@parser = Docurium::DocParser.new
Expand Down