diff --git a/Gemfile b/Gemfile index a05f9b8..e817748 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gem 'git' +gem 'rugged' diff --git a/build-docs.rb b/build-docs.rb index f6f632c..254abee 100755 --- a/build-docs.rb +++ b/build-docs.rb @@ -2,7 +2,7 @@ require 'optparse' require 'fileutils' require 'yaml' -require 'git' +require 'rugged' options = {} OptionParser.new { |opts| @@ -30,16 +30,14 @@ OptionParser.new { |opts| def clone_and_update_project(target, clone_target, git, ref) if !File.directory?(clone_target) - puts "Cloning to #{target} to #{clone_target} ..." + puts "Cloning to #{target}: #{ref} to #{clone_target} ..." FileUtils.mkdir_p(clone_target) - repo = Git.clone(git, clone_target) + Rugged::Repository.clone_at(git, clone_target, {:checkout_branch => ref}) else - repo = Git.open(clone_target) - repo.fetch() + puts "Cleaning up #{clone_target}" + FileUtils::rm_rf(clone_target) + clone_and_update_project(target, clone_target, git, ref) end - - puts "Checkout #{target} ref '#{ref}'" - repo.branch(ref).checkout end def build_page_index(full_docs_dir, project_docs_dir) diff --git a/examples/icinga2-latest.yml b/examples/icinga2-latest.yml index 8ed63b5..8aed823 100644 --- a/examples/icinga2-latest.yml +++ b/examples/icinga2-latest.yml @@ -4,7 +4,7 @@ source_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/source' site_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/html' project: git: 'https://github.com/Icinga/icinga2.git' - ref: 'support/v2.7' + ref: 'support/2.7' target: 'icinga2' docs_dir: 'doc' latest: true