Use git system commands instead of ruby gems

This commit is contained in:
Blerim Sheqa 2017-10-19 09:58:31 +02:00
parent d37721a3b3
commit af82165502
5 changed files with 22 additions and 9 deletions

View File

@ -2,7 +2,6 @@
require 'optparse' require 'optparse'
require 'fileutils' require 'fileutils'
require 'yaml' require 'yaml'
require 'rugged'
options = {} options = {}
OptionParser.new { |opts| OptionParser.new { |opts|
@ -29,10 +28,14 @@ OptionParser.new { |opts|
}.parse! }.parse!
def clone_and_update_project(target, clone_target, git, ref) def clone_and_update_project(target, clone_target, git, ref)
@git_options = "-b #{ref}" if ref =~ /tags/
if !File.directory?(clone_target) if !File.directory?(clone_target)
puts "Cloning to #{target}: #{ref} to #{clone_target} ..." puts "Cloning #{git} to #{clone_target} ..."
FileUtils.mkdir_p(clone_target) FileUtils.mkdir_p(clone_target)
Rugged::Repository.clone_at(git, clone_target, {:checkout_branch => ref}) %x(git clone #{git} #{clone_target})
puts "Checking out #{ref}"
%x(git --git-dir=#{clone_target}/.git --work-tree=#{clone_target} checkout #{ref} #{@git_options})
else else
puts "Cleaning up #{clone_target}" puts "Cleaning up #{clone_target}"
FileUtils::rm_rf(clone_target) FileUtils::rm_rf(clone_target)

View File

@ -0,0 +1,10 @@
---
site_name: 'Business Process Module'
source_dir: 'www/source'
site_dir: 'www/html'
project:
git: 'https://github.com/Icinga/icingaweb2-module-businessprocess.git'
ref: 'tags/v2.1.0'
target: 'businessprocess'
docs_dir: 'doc'
latest: true

View File

@ -1,7 +1,7 @@
--- ---
site_name: 'Director' site_name: 'Director'
source_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/source' source_dir: 'www/source'
site_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/html' site_dir: 'www/html'
project: project:
git: 'https://github.com/Icinga/icingaweb2-module-director.git' git: 'https://github.com/Icinga/icingaweb2-module-director.git'
ref: 'support/1.4' ref: 'support/1.4'

View File

@ -1,7 +1,7 @@
--- ---
site_name: 'Icinga 2' site_name: 'Icinga 2'
source_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/source' source_dir: 'www/source'
site_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/html' site_dir: 'www/html'
project: project:
git: 'https://github.com/Icinga/icinga2.git' git: 'https://github.com/Icinga/icinga2.git'
ref: 'support/2.7' ref: 'support/2.7'

View File

@ -1,7 +1,7 @@
--- ---
site_name: 'Icinga Web 2' site_name: 'Icinga Web 2'
source_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/source' source_dir: 'www/source'
site_dir: '/Users/bsheqa/git/github/icinga/icinga-docs-tools/www/html' site_dir: 'www/html'
project: project:
git: 'https://github.com/Icinga/icingaweb2.git' git: 'https://github.com/Icinga/icingaweb2.git'
ref: 'support/v2.4' ref: 'support/v2.4'