Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Add a git-integration formula #25186

Closed
48 changes: 48 additions & 0 deletions Library/Formula/git-integration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
require 'formula'

class SufficientlyRecentGit < Requirement
fatal true
default_formula 'git'

satisfy do
# `git stripspace` condition copy/pasted from git-integration 0.2
system 'git stripspace --comment-lines </dev/null 2>/dev/null'
end

def message
"Your Git is too old. Please upgrade to Git 1.8.2 or newer."
end
end

class GitIntegration < Formula
homepage 'http://johnkeeping.github.io/git-integration/'
url 'https://github.com/johnkeeping/git-integration/archive/v0.2.zip'
sha1 'ce86564077a683c8ce270c85530f9100f3f8c950'

depends_on 'asciidoc' => [:build, :optional]
depends_on SufficientlyRecentGit

def install
ENV["XML_CATALOG_FILES"] = "#{HOMEBREW_PREFIX}/etc/xml/catalog"
(buildpath/"config.mak").write "prefix = #{prefix}"
system "make", "install"
if build.with? "asciidoc"
system "make", "install-doc"
end
system "make", "install-completion"
end

test do
system "git", "init"
system "git", "commit", "--allow-empty", "-m", "An initial commit"
system "git", "checkout", "-b", "branch-a", "master"
system "git", "commit", "--allow-empty", "-m", "A commit on branch-a"
system "git", "checkout", "-b", "branch-b", "master"
system "git", "commit", "--allow-empty", "-m", "A commit on branch-b"
system "git", "checkout", "master"
system "git", "integration", "--create", "integration"
system "git", "integration", "--add", "branch-a"
system "git", "integration", "--add", "branch-b"
system "git", "integration", "--rebuild"
end
end