capita_git 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .idea
5
+ lib/capita_git/man
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in capita_git.gemspec
4
+ gemspec
5
+ gem 'ronn'
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ capita_git (0.0.1)
5
+ git (>= 1.2.5)
6
+ thor (>= 0.14.6)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ git (1.2.5)
12
+ hpricot (0.8.3)
13
+ mustache (0.12.0)
14
+ rdiscount (1.6.5)
15
+ ronn (0.7.3)
16
+ hpricot (>= 0.8.2)
17
+ mustache (>= 0.7.0)
18
+ rdiscount (>= 1.5.8)
19
+ thor (0.14.6)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ capita_git!
26
+ git (>= 1.2.5)
27
+ ronn
28
+ thor (>= 0.14.6)
data/README.rdoc ADDED
@@ -0,0 +1,57 @@
1
+ = gitc -- git helper for CAPITA Unternehmensberatung GmbH
2
+
3
+ === SYNOPSIS
4
+
5
+ $ gitc help
6
+
7
+ $ gitc help <command>
8
+
9
+ $ gitc check
10
+
11
+ $ gitc create [name] [source_branch]
12
+
13
+ $ gitc update [branch]
14
+
15
+ $ gitc close [branch]
16
+
17
+ === DESCRIPTION
18
+
19
+ *gitc* is a git automation tool used by CAPITA Unternehmensberatung GmbH with comes
20
+ along the gem *capita_git*.
21
+
22
+ It's main purpose is to automate repetivite tasks as spawing new feature branches,
23
+ updating and rebasing from the source branch of a given feature branch, as well as
24
+ closing/merging feature branchs back into their originating timeline.
25
+
26
+ *gict* uses a strict naming convention for creating, idenfitying and maintaining
27
+ local and remote branches and depends on the users's name being set in the git
28
+ configuration of your local cloned copy or in the global settings.
29
+
30
+ Please make sure that both
31
+ $ git config user.name
32
+ and
33
+ $ git config user.email
34
+ return your correct name and email address.
35
+
36
+ === Installation
37
+
38
+ $ gem install capita_git
39
+
40
+ === COMMANDS
41
+
42
+ For detailed explanation of the various commands, please use *gitc help <command>*.
43
+
44
+ Available commands currently are:
45
+
46
+ * <check>:
47
+ performs a basic check of your repository, as well as maintains fixbranches for
48
+ major release tags both locally and remotely
49
+
50
+ * <create>:
51
+ creates a feature branch
52
+
53
+ * <update>:
54
+ updates the feature branch's source branch and does a rebase
55
+
56
+ * <close>:
57
+ closes a feature branch by updating and merging into the source branch
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ $:.unshift File.expand_path("../lib", __FILE__)
2
+ require 'bundler/gem_helper'
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ task :install => ["man:clean", "man:build"]
6
+ task :build => ["man:clean", "man:build"]
7
+ task :release => ["man:clean", "man:build"]
8
+
9
+ namespace :man do
10
+ directory "lib/capita_git/man"
11
+
12
+ ENV['RONN_MANUAL'] = "GITC Manual"
13
+ ENV['RONN_ORGANIZATION'] = "GITC #{CapitaGit::VERSION}"
14
+
15
+ Dir["man/*.ronn"].each do |ronn|
16
+ basename = File.basename(ronn, ".ronn")
17
+ roff = "lib/capita_git/man/#{basename}"
18
+
19
+ file roff => ["lib/capita_git/man", ronn] do
20
+ sh "ronn --roff --pipe #{ronn} > #{roff}"
21
+ end
22
+
23
+ file "#{roff}.txt" => roff do
24
+ sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
25
+ end
26
+
27
+ task :build_all_pages => "#{roff}.txt"
28
+ end
29
+
30
+ desc "Build the man pages"
31
+ task :build => "man:build_all_pages"
32
+
33
+ desc "Clean up from the built man pages"
34
+ task :clean do
35
+ rm_rf "lib/capita_git/man"
36
+ end
37
+ end
data/bin/gitc ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ require 'capita_git'
3
+ require 'capita_git/cli'
4
+
5
+ begin
6
+ CapitaGit::CLI.start
7
+ rescue => e
8
+ CapitaGit.ui.error e.message
9
+ CapitaGit.ui.debug e.backtrace.join("\n")
10
+ exit 1
11
+ rescue Interrupt => e
12
+ CapitaGit.ui.error "\nQuitting..."
13
+ CapitaGit.ui.debug e.backtrace.join("\n")
14
+ exit 1
15
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "capita_git/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "capita_git"
7
+ s.version = CapitaGit::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Sebastian Georgi"]
10
+ s.email = ["sgeorgi@capita.de"]
11
+ s.homepage = "https://github.com/capita/capita_git"
12
+ s.summary = %q{Git-automation tool for managing features branches and more}
13
+ s.description = %q{see RDoc or command help for further information}
14
+
15
+ s.rubyforge_project = "capita_git"
16
+
17
+ man_files = Dir.glob("lib/capita_git/man/**/*")
18
+ s.files = `git ls-files`.split("\n") + man_files
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ s.add_dependency('git', '>= 1.2.5')
23
+ s.add_dependency('thor', '>= 0.14.6')
24
+ end
@@ -0,0 +1,145 @@
1
+ $:.unshift File.expand_path(__FILE__)
2
+ require 'thor'
3
+ require 'thor/actions'
4
+ require 'rubygems/config_file'
5
+
6
+ Gem.configuration
7
+
8
+ module CapitaGit
9
+ class CLI < Thor
10
+ include Thor::Actions
11
+
12
+ def initialize(*)
13
+ super
14
+ the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
15
+ CapitaGit.ui = UI::Shell.new(the_shell)
16
+ CapitaGit.ui.debug! if options["verbose"]
17
+ Gem::DefaultUserInteraction.ui = UI::RGProxy.new(CapitaGit.ui)
18
+ end
19
+
20
+ check_unknown_options! unless ARGV.include?("exec") || ARGV.include?("config")
21
+
22
+ class_option "no-color", :type => :boolean, :banner => "Disable colorization in output"
23
+ class_option "verbose", :type => :boolean, :banner => "Enable verbose output mode", :aliases => "-V"
24
+
25
+ def help(cli = nil)
26
+ case cli
27
+ when "gemfile" then
28
+ command = "gemfile.5"
29
+ when nil then
30
+ command = "gitc"
31
+ else
32
+ command = "gitc-#{cli}"
33
+ end
34
+
35
+ manpages = %w(
36
+ gitc
37
+ gitc-check)
38
+
39
+ if manpages.include?(command)
40
+ root = File.expand_path("../man", __FILE__)
41
+
42
+ if have_groff? && root !~ %r{^file:/.+!/META-INF/jruby.home/.+}
43
+ groff = "groff -Wall -mtty-char -mandoc -Tascii"
44
+ pager = ENV['MANPAGER'] || ENV['PAGER'] || 'more'
45
+
46
+ Kernel.exec "#{groff} #{root}/#{command} | #{pager}"
47
+ else
48
+ puts File.read("#{root}/#{command}.txt")
49
+ end
50
+ else
51
+ super
52
+ end
53
+ end
54
+
55
+ desc "check", "Generates a Gemfile into the current working directory"
56
+
57
+ def check
58
+ repo = Repository.open(Dir.pwd)
59
+ CapitaGit.ui.info "-- Starting to check repository '#{repo.dir.to_s}' --------"
60
+ CapitaGit.ui.confirm "-> Active user : '#{repo.user_name} <#{repo.user_email}>'"
61
+ CapitaGit.ui.confirm "-> User shortcut : '#{repo.user_shortcut}'"
62
+ CapitaGit.ui.info '-----------------------------------------------------------'
63
+ CapitaGit.ui.info ''
64
+
65
+ CapitaGit.ui.info '-- Fetching changes from remote \'origin\' ------------------'
66
+ repo.update_from_remote
67
+ latest_major_release_tag = repo.latest_major_release_tag
68
+ latest_minor_release_tag = repo.latest_minor_release_tag
69
+ CapitaGit.ui.confirm "-> Latest major release tag is: #{latest_major_release_tag || '---'}"
70
+ CapitaGit.ui.confirm "-> Latest minor release tag is: #{latest_minor_release_tag || '---'}"
71
+ CapitaGit.ui.info '-----------------------------------------------------------'
72
+ CapitaGit.ui.info ''
73
+
74
+ if latest_major_release_tag.nil?
75
+ CapitaGit.ui.warn 'No major release tag found, exiting!'
76
+ exit 0
77
+ end
78
+
79
+ CapitaGit.ui.info '-- Checking for presence of major release fixbranch -------'
80
+ local_fixbranch = repo.local_fixbranch_for_version?(latest_major_release_tag)
81
+ remote_fixbranch = repo.remote_fixbranch_for_version?(latest_major_release_tag)
82
+ CapitaGit.ui.confirm "-> Local : #{local_fixbranch.nil? ? '---' : local_fixbranch.full }"
83
+ CapitaGit.ui.confirm "-> Remote : #{remote_fixbranch.nil? ? '---' : remote_fixbranch.full }"
84
+
85
+ if not repo.has_remote_fixbranch_for_version?(latest_major_release_tag)
86
+ CapitaGit.ui.info "--> Creating remote fixbranch #{latest_major_release_tag}-fix"
87
+ repo.create_remote_fixbranch_for_version(latest_major_release_tag)
88
+ end
89
+
90
+ if not repo.has_local_fixbranch_for_version?(latest_major_release_tag)
91
+ CapitaGit.ui.info "--> Creating tracking local fixbranch #{latest_major_release_tag}-fix from remote fixbranch"
92
+ repo.create_local_fixbranch_for_version(latest_major_release_tag)
93
+ end
94
+
95
+ CapitaGit.ui.info '-----------------------------------------------------------'
96
+ end
97
+
98
+ desc "create", "Creates a new feature branch with the given name and optional source branch"
99
+ def create(name, source=nil)
100
+ repo = Repository.open(Dir.pwd)
101
+ source = source.nil? ? repo.current_branch : source
102
+ raise "Source branch '#{source}' does not exist" unless repo.has_local_branch?(source)
103
+ raise "Source branch '#{source}' is a feature branch, can't branch from that!" if repo.is_local_feature_branch?(source)
104
+
105
+ CapitaGit.ui.confirm "--> Creating and switching to feature branch '#{repo.user_shortcut}_#{source}_#{name}'"
106
+ repo.create_local_branch_from_source("#{repo.user_shortcut}_#{source}_#{name}", source)
107
+ repo.checkout_local_branch("#{repo.user_shortcut}_#{source}_#{name}")
108
+ end
109
+
110
+ desc "update", "Updates a feature branch your currently on or specified by name"
111
+ def update(name=nil)
112
+ repo = Repository.open(Dir.pwd)
113
+ name = name.nil? ? repo.current_branch : name
114
+ raise "Source branch '#{name}' does not exist" unless repo.has_local_branch?(name)
115
+ raise "Source branch '#{name}' is not a feature branch, can't update!" unless repo.is_local_feature_branch?(name)
116
+
117
+ CapitaGit.ui.confirm "--> Updating feature branch '#{name}' from '#{repo.source_branch(name)}'"
118
+ repo.rebase_local_branch(name)
119
+ end
120
+
121
+ desc "close", "Closes a feature branch your currently on or specified by name onto the source branch"
122
+ def close(name=nil)
123
+ repo = Repository.open(Dir.pwd)
124
+ name = name.nil? ? repo.current_branch : name
125
+ raise "Source branch '#{name}' does not exist" unless repo.has_local_branch?(name)
126
+ raise "Source branch '#{name}' is not a feature branch, can't close!" unless repo.is_local_feature_branch?(name)
127
+
128
+ CapitaGit.ui.confirm "--> Closing feature branch '#{name}' onto '#{repo.source_branch(name)}'"
129
+ repo.rebase_local_branch(name)
130
+ repo.close_local_branch(name)
131
+ end
132
+
133
+ desc "runner", "Generates a Gemfile into the current working directory"
134
+ def runner(command)
135
+ repo = Repository.open(Dir.pwd)
136
+ puts repo.send("#{command}")
137
+ end
138
+
139
+ private
140
+
141
+ def have_groff?
142
+ !(`which groff` rescue '').empty?
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,71 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "GITC" "5" "January 2011" "GITC 0.0.2" "GITC Manual"
5
+ .
6
+ .SH "NAME"
7
+ \fBgitc\fR \- git helper for CAPITA Unternehmensberatung GmbH
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBgitc\fR help
11
+ .
12
+ .br
13
+ \fBgitc\fR help \fIcommand\fR
14
+ .
15
+ .br
16
+ \fBgitc\fR check
17
+ .
18
+ .br
19
+ \fBgitc\fR create [name] [source_branch]
20
+ .
21
+ .br
22
+ \fBgitc\fR update [branch]
23
+ .
24
+ .br
25
+ \fBgitc\fR close [branch]
26
+ .
27
+ .br
28
+ .
29
+ .SH "DESCRIPTION"
30
+ \fBgitc\fR is a git automation tool used by CAPITA Unternehmensberatung GmbH\.
31
+ .
32
+ .P
33
+ It\'s main purpose is to automate repetivite tasks as spawing new feature branches, updating and rebasing from the source branch of a given feature branch, as well as closing/merging feature branchs back into their originating timeline\.
34
+ .
35
+ .P
36
+ \fBgict\fR uses a strict naming convention for creating, idenfitying and maintaining local and remote branches and depends on the users\'s name being set in the git configuration of your local cloned copy or in the global settings\.
37
+ .
38
+ .P
39
+ Please make sure that both
40
+ .
41
+ .br
42
+ * \fBgit config user\.name\fR and
43
+ .
44
+ .br
45
+ * \fBgit config user\.email\fR
46
+ .
47
+ .br
48
+ return your correct name and email address\.
49
+ .
50
+ .SH "COMMANDS"
51
+ For detailed explanation of the various commands, please use \fBgitc help \fIcommand\fR\fR\.
52
+ .
53
+ .P
54
+ Available commands currently are:
55
+ .
56
+ .TP
57
+ \fIcheck\fR
58
+ performs a basic check of your repository, as well as maintains fixbranches for major release tags both locally and remotely
59
+ .
60
+ .TP
61
+ \fIcreate\fR
62
+ creates a feature branch
63
+ .
64
+ .TP
65
+ \fIupdate\fR
66
+ updates the feature branch\'s source branch and does a rebase
67
+ .
68
+ .TP
69
+ \fIclose\fR
70
+ closes a feature branch by updating and merging into the source branch
71
+
@@ -0,0 +1,5 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "GITC\-CHECK" "" "January 2011" "GITC 0.0.2" "GITC Manual"
5
+
@@ -0,0 +1,5 @@
1
+ GITC-CHECK() GITC Manual GITC-CHECK()
2
+
3
+
4
+
5
+ GITC 0.0.2 January 2011 GITC-CHECK()
@@ -0,0 +1,53 @@
1
+ GITC(5) GITC Manual GITC(5)
2
+
3
+
4
+
5
+ NAME
6
+ gitc - git helper for CAPITA Unternehmensberatung GmbH
7
+
8
+ SYNOPSIS
9
+ gitc help
10
+ gitc help command
11
+ gitc check
12
+ gitc create [name] [source_branch]
13
+ gitc update [branch]
14
+ gitc close [branch]
15
+
16
+ DESCRIPTION
17
+ gitc is a git automation tool used by CAPITA Unternehmensberatung GmbH.
18
+
19
+ It's main purpose is to automate repetivite tasks as spawing new fea-
20
+ ture branches, updating and rebasing from the source branch of a given
21
+ feature branch, as well as closing/merging feature branchs back into
22
+ their originating timeline.
23
+
24
+ gict uses a strict naming convention for creating, idenfitying and
25
+ maintaining local and remote branches and depends on the users's name
26
+ being set in the git configuration of your local cloned copy or in the
27
+ global settings.
28
+
29
+ Please make sure that both
30
+ * git config user.name and
31
+ * git config user.email
32
+ return your correct name and email address.
33
+
34
+ COMMANDS
35
+ For detailed explanation of the various commands, please use gitc help
36
+ command.
37
+
38
+ Available commands currently are:
39
+
40
+ check performs a basic check of your repository, as well as maintains
41
+ fixbranches for major release tags both locally and remotely
42
+
43
+ create creates a feature branch
44
+
45
+ update updates the feature branch's source branch and does a rebase
46
+
47
+ close closes a feature branch by updating and merging into the source
48
+ branch
49
+
50
+
51
+
52
+
53
+ GITC 0.0.2 January 2011 GITC(5)
@@ -0,0 +1,146 @@
1
+ require 'git'
2
+
3
+ module CapitaGit
4
+ class Repository
5
+ def self.open(path)
6
+ new(path)
7
+ end
8
+
9
+ def method_missing(m, *args)
10
+ @repository.send m, *args
11
+ end
12
+
13
+ def initialize(path)
14
+ @repository = Git.open path
15
+ end
16
+
17
+ def update_from_remote
18
+ @repository.fetch(remote)
19
+ end
20
+
21
+ def current_branch
22
+ @repository.branches.local.select { |b| b.full == @repository.lib.branch_current }[0]
23
+ end
24
+
25
+ def create_feature_branch(name)
26
+ raise "Can't create feature branch from branch #{current_branch} since you already seem to be on one" if current_branch =~ /#{user_shortcut}/
27
+ system "git checkout -b #{user_shortcut}/#{current_branch}/#{name}"
28
+ end
29
+
30
+ def create_local_branch_from_source(name, source, track=false)
31
+ raise "Branch '#{name}' already exists!" if has_local_branch?(name)
32
+ system "git branch #{track ? '--track' : ''} #{name} #{source}"
33
+ end
34
+
35
+ def push_local_branch_to_remote(remote, local_name, remote_name=nil)
36
+ if remote_name.nil?
37
+ system "git push #{remote} #{local_name}"
38
+ else
39
+ system "git push #{remote} #{local_name}:#{remote_name}"
40
+ end
41
+ end
42
+
43
+ def delete_local_branch(name)
44
+ system "git branch -d #{name}"
45
+ end
46
+
47
+ def checkout_local_branch(name)
48
+ raise "Can't checkout #{name} since it doesn't exist!" unless has_local_branch?(name)
49
+ @repository.branch(name).checkout
50
+ end
51
+
52
+ def rebase_local_branch(name)
53
+ raise "Can't update #{name} since it doesn't exist!" unless has_local_branch?(name)
54
+ checkout_local_branch source_branch(name)
55
+ system "git pull"
56
+ checkout_local_branch name
57
+ system "git rebase #{source_branch(name)}"
58
+ end
59
+
60
+ def close_local_branch(name)
61
+ rebase_local_branch(name)
62
+ system "git checkout #{source_branch(name)}"
63
+ system "git merge #{name}"
64
+ system "git branch -d #{name}"
65
+ end
66
+
67
+ def has_local_branch?(name)
68
+ !@repository.branches.local.detect { |b| b.full =~ /#{name.gsub('/', '\/')}/ }.nil?
69
+ end
70
+
71
+ def is_local_feature_branch?(name)
72
+ ! name.match(/^#{user_shortcut}/).nil?
73
+ end
74
+
75
+ def create_remote_fixbranch_for_version(version)
76
+ create_local_branch_from_source("local_#{version}-fix", version)
77
+ push_local_branch_to_remote('origin', "local_#{version}-fix", "#{version}-fix")
78
+ delete_local_branch("local_#{version}-fix")
79
+ end
80
+
81
+ def create_local_fixbranch_for_version(version)
82
+ create_local_branch_from_source("#{version}-fix", "origin/#{version}-fix", true)
83
+ end
84
+
85
+ def local_fixbranch_for_version?(version)
86
+ branches = @repository.branches.local.select { |b| b.full =~ /^#{version}-fix$/ }
87
+ branches.nil? ? branches : branches[0]
88
+ end
89
+
90
+ def remote_fixbranch_for_version?(version)
91
+ branches = @repository.branches.remote.select { |b| b.full =~ /#{version}-fix$/ }
92
+ branches.nil? ? branches : branches[0]
93
+ end
94
+
95
+ def has_local_fixbranch_for_version?(version)
96
+ !local_fixbranch_for_version?(version).nil?
97
+ end
98
+
99
+ def has_remote_fixbranch_for_version?(version)
100
+ !remote_fixbranch_for_version?(version).nil?
101
+ end
102
+
103
+ def current_branch
104
+ @repository.lib.branch_current
105
+ end
106
+
107
+
108
+ def latest_major_release_tag
109
+ major_release_tags.sort.last
110
+ end
111
+
112
+ def latest_minor_release_tag(major_release=nil)
113
+ major_release.nil? ? minor_release_tags.sort.last : minor_release_tags.select { |tag| tag =~ /^#{major_release}\..*$/ }.sort.last
114
+ end
115
+
116
+ def user_name
117
+ @repository.config('user.name')
118
+ end
119
+
120
+ def user_email
121
+ @repository.config('user.email')
122
+ end
123
+
124
+ def user_shortcut
125
+ user_name.downcase.split(/\s/).map { |n| n[0, 1] }.join
126
+ end
127
+
128
+ def source_branch(name)
129
+ name.split('_')[1]
130
+ end
131
+
132
+ private
133
+
134
+ def remote
135
+ @repository.remotes.select { |r| r.name == 'origin' }[0]
136
+ end
137
+
138
+ def major_release_tags
139
+ @repository.tags.map(&:name).select { |tag| tag =~ /^\d+\.\d+$/ }
140
+ end
141
+
142
+ def minor_release_tags
143
+ @repository.tags.map(&:name).select { |tag| tag =~ /^\d+\.\d+\.\d+$/ }
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,72 @@
1
+ require 'rubygems/user_interaction'
2
+
3
+ module CapitaGit
4
+ class UI
5
+ def warn(message)
6
+ end
7
+
8
+ def debug(message)
9
+ end
10
+
11
+ def error(message)
12
+ end
13
+
14
+ def info(message)
15
+ end
16
+
17
+ def confirm(message)
18
+ end
19
+
20
+ class Shell < UI
21
+ attr_writer :shell
22
+
23
+ def initialize(shell)
24
+ @shell = shell
25
+ @quiet = false
26
+ @debug = ENV['DEBUG']
27
+ end
28
+
29
+ def debug(msg)
30
+ @shell.say(msg) if @debug && !@quiet
31
+ end
32
+
33
+ def info(msg)
34
+ @shell.say(msg) if !@quiet
35
+ end
36
+
37
+ def confirm(msg)
38
+ @shell.say(msg, :green) if !@quiet
39
+ end
40
+
41
+ def warn(msg)
42
+ @shell.say(msg, :yellow)
43
+ end
44
+
45
+ def error(msg)
46
+ @shell.say(msg, :red)
47
+ end
48
+
49
+ def be_quiet!
50
+ @quiet = true
51
+ end
52
+
53
+ def debug!
54
+ @debug = true
55
+ end
56
+ end
57
+
58
+ class RGProxy < Gem::SilentUI
59
+ def initialize(ui)
60
+ @ui = ui
61
+ end
62
+
63
+ def say(message)
64
+ if message =~ /native extensions/
65
+ @ui.info "with native extensions "
66
+ else
67
+ @ui.debug(message)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,3 @@
1
+ module CapitaGit
2
+ VERSION = "0.0.2"
3
+ end
data/lib/capita_git.rb ADDED
@@ -0,0 +1,16 @@
1
+ module CapitaGit
2
+ autoload :UI, 'capita_git/ui'
3
+ autoload :Repository, 'capita_git/repository'
4
+
5
+ class << self
6
+ attr_writer :ui
7
+
8
+ def ui
9
+ @ui ||= UI.new
10
+ end
11
+ end
12
+
13
+ def self.do
14
+ puts "Working"
15
+ end
16
+ end
@@ -0,0 +1,2 @@
1
+ HAHA
2
+ ====
data/man/gitc.ronn ADDED
@@ -0,0 +1,47 @@
1
+ gitc(5) -- git helper for CAPITA Unternehmensberatung GmbH
2
+ =======================================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `gitc` help<br>
7
+ `gitc` help <command><br>
8
+ `gitc` check<br>
9
+ `gitc` create [name] [source_branch]<br>
10
+ `gitc` update [branch]<br>
11
+ `gitc` close [branch]<br>
12
+
13
+ ## DESCRIPTION
14
+
15
+ **gitc** is a git automation tool used by CAPITA Unternehmensberatung GmbH.
16
+
17
+ It's main purpose is to automate repetivite tasks as spawing new feature branches,
18
+ updating and rebasing from the source branch of a given feature branch, as well as
19
+ closing/merging feature branchs back into their originating timeline.
20
+
21
+ **gict** uses a strict naming convention for creating, idenfitying and maintaining
22
+ local and remote branches and depends on the users's name being set in the git
23
+ configuration of your local cloned copy or in the global settings.
24
+
25
+ Please make sure that both<br>
26
+ * `git config user.name` and<br>
27
+ * `git config user.email`<br>
28
+ return your correct name and email address.
29
+
30
+ ## COMMANDS
31
+
32
+ For detailed explanation of the various commands, please use **gitc help <command>**.
33
+
34
+ Available commands currently are:
35
+
36
+ * <check>:
37
+ performs a basic check of your repository, as well as maintains fixbranches for
38
+ major release tags both locally and remotely
39
+
40
+ * <create>:
41
+ creates a feature branch
42
+
43
+ * <update>:
44
+ updates the feature branch's source branch and does a rebase
45
+
46
+ * <close>:
47
+ closes a feature branch by updating and merging into the source branch
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capita_git
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Sebastian Georgi
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-25 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: git
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 5
34
+ version: 1.2.5
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: thor
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 43
46
+ segments:
47
+ - 0
48
+ - 14
49
+ - 6
50
+ version: 0.14.6
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ description: see RDoc or command help for further information
54
+ email:
55
+ - sgeorgi@capita.de
56
+ executables:
57
+ - gitc
58
+ extensions: []
59
+
60
+ extra_rdoc_files: []
61
+
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - README.rdoc
67
+ - Rakefile
68
+ - bin/gitc
69
+ - capita_git.gemspec
70
+ - lib/capita_git.rb
71
+ - lib/capita_git/cli.rb
72
+ - lib/capita_git/repository.rb
73
+ - lib/capita_git/ui.rb
74
+ - lib/capita_git/version.rb
75
+ - man/gitc-check.ronn
76
+ - man/gitc.ronn
77
+ - lib/capita_git/man/gitc
78
+ - lib/capita_git/man/gitc-check.txt
79
+ - lib/capita_git/man/gitc-check
80
+ - lib/capita_git/man/gitc.txt
81
+ has_rdoc: true
82
+ homepage: https://github.com/capita/capita_git
83
+ licenses: []
84
+
85
+ post_install_message:
86
+ rdoc_options: []
87
+
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ requirements: []
109
+
110
+ rubyforge_project: capita_git
111
+ rubygems_version: 1.3.7
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: Git-automation tool for managing features branches and more
115
+ test_files: []
116
+