mirror of
https://github.com/Icinga/icinga-docs-tools.git
synced 2025-07-23 13:54:23 +02:00
Fix cloning and checkout mechanism
This commit is contained in:
parent
23f21fe42f
commit
d37721a3b3
2
Gemfile
2
Gemfile
@ -1,3 +1,3 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'git'
|
gem 'rugged'
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'git'
|
require 'rugged'
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
OptionParser.new { |opts|
|
OptionParser.new { |opts|
|
||||||
@ -30,16 +30,14 @@ OptionParser.new { |opts|
|
|||||||
|
|
||||||
def clone_and_update_project(target, clone_target, git, ref)
|
def clone_and_update_project(target, clone_target, git, ref)
|
||||||
if !File.directory?(clone_target)
|
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)
|
FileUtils.mkdir_p(clone_target)
|
||||||
repo = Git.clone(git, clone_target)
|
Rugged::Repository.clone_at(git, clone_target, {:checkout_branch => ref})
|
||||||
else
|
else
|
||||||
repo = Git.open(clone_target)
|
puts "Cleaning up #{clone_target}"
|
||||||
repo.fetch()
|
FileUtils::rm_rf(clone_target)
|
||||||
|
clone_and_update_project(target, clone_target, git, ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "Checkout #{target} ref '#{ref}'"
|
|
||||||
repo.branch(ref).checkout
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_page_index(full_docs_dir, project_docs_dir)
|
def build_page_index(full_docs_dir, project_docs_dir)
|
||||||
|
@ -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'
|
site_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/html'
|
||||||
project:
|
project:
|
||||||
git: 'https://github.com/Icinga/icinga2.git'
|
git: 'https://github.com/Icinga/icinga2.git'
|
||||||
ref: 'support/v2.7'
|
ref: 'support/2.7'
|
||||||
target: 'icinga2'
|
target: 'icinga2'
|
||||||
docs_dir: 'doc'
|
docs_dir: 'doc'
|
||||||
latest: true
|
latest: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user