capita_git 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/bin/gitc +17 -7
- data/lib/capita_git/cli.rb +53 -50
- data/lib/capita_git/man/gitc +1 -1
- data/lib/capita_git/man/gitc-check +1 -1
- data/lib/capita_git/man/gitc-check.txt +1 -1
- data/lib/capita_git/man/gitc.txt +1 -1
- data/lib/capita_git/repository.rb +57 -34
- data/lib/capita_git/ui.rb +1 -1
- data/lib/capita_git/version.rb +1 -1
- data/lib/capita_git.rb +10 -3
- data/test/cli_test.rb +36 -19
- data/test/shoulda_macros.rb +7 -0
- metadata +11 -9
data/Gemfile.lock
CHANGED
data/bin/gitc
CHANGED
@@ -1,18 +1,28 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'capita_git'
|
3
|
-
require 'capita_git/cli'
|
4
3
|
|
5
4
|
begin
|
6
5
|
CapitaGit::CLI.start
|
7
6
|
rescue CapitaGit::UncleanError => e
|
8
|
-
CapitaGit.ui.error
|
9
|
-
|
7
|
+
CapitaGit.ui.error "-- ERROR DETECTED ----------------------------------------"
|
8
|
+
CapitaGit.ui.error " #{e.message}"
|
9
|
+
CapitaGit.ui.error `git status --short`
|
10
|
+
exit 1
|
11
|
+
rescue CapitaGit::RepositoryError => e
|
12
|
+
CapitaGit.ui.error "-- ERROR DETECTED ----------------------------------------"
|
13
|
+
CapitaGit.ui.error " #{e.message}"
|
14
|
+
CapitaGit.ui.debug "-- BACKTRACE ---------------------------------------------"
|
15
|
+
e.backtrace.each { |bt| CapitaGit.ui.debug "- #{bt}"}
|
16
|
+
exit 1
|
10
17
|
rescue => e
|
11
|
-
CapitaGit.ui.error
|
12
|
-
CapitaGit.ui.
|
18
|
+
CapitaGit.ui.error "-- ERROR DETECTED ----------------------------------------"
|
19
|
+
CapitaGit.ui.error " #{e.class}: #{e.message}"
|
20
|
+
CapitaGit.ui.debug "-- BACKTRACE ---------------------------------------------"
|
21
|
+
e.backtrace.each { |bt| CapitaGit.ui.debug "- #{bt}"}
|
13
22
|
exit 1
|
14
23
|
rescue Interrupt => e
|
15
|
-
CapitaGit.ui.error "\
|
16
|
-
CapitaGit.ui.debug
|
24
|
+
CapitaGit.ui.error "\n-- Received interrupt, quitting ---------------------------\n"
|
25
|
+
CapitaGit.ui.debug "-- BACKTRACE ---------------------------------------------"
|
26
|
+
e.backtrace.each { |bt| CapitaGit.ui.debug "- #{bt}"}
|
17
27
|
exit 1
|
18
28
|
end
|
data/lib/capita_git/cli.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
$:.unshift File.expand_path(__FILE__)
|
2
1
|
require 'thor'
|
3
2
|
require 'thor/actions'
|
4
3
|
require 'rubygems/config_file'
|
@@ -12,9 +11,9 @@ module CapitaGit
|
|
12
11
|
def initialize(*)
|
13
12
|
super
|
14
13
|
the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
|
15
|
-
CapitaGit.ui = UI::Shell.new(the_shell)
|
14
|
+
CapitaGit.ui = CapitaGit::UI::Shell.new(the_shell)
|
16
15
|
CapitaGit.ui.debug! if options["verbose"]
|
17
|
-
Gem::DefaultUserInteraction.ui = UI::RGProxy.new(CapitaGit.ui)
|
16
|
+
Gem::DefaultUserInteraction.ui = CapitaGit::UI::RGProxy.new(CapitaGit.ui)
|
18
17
|
end
|
19
18
|
|
20
19
|
check_unknown_options! unless ARGV.include?("exec") || ARGV.include?("config")
|
@@ -52,91 +51,95 @@ module CapitaGit
|
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
54
|
+
method_option 'remote', :type => :string
|
55
55
|
desc "check", "Generates a Gemfile into the current working directory"
|
56
|
-
|
57
56
|
def check
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
CapitaGit.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
repo.
|
57
|
+
opts = options.dup
|
58
|
+
log :debug, "[DEBUG] Starting action 'check'"
|
59
|
+
|
60
|
+
repo = CapitaGit::Repository.open(Dir.pwd, CapitaGit.ui)
|
61
|
+
repo.git_remote = opts[:remote] if opts[:remote]
|
62
|
+
log :debug, "[DEBUG] Repository remote set to '#{repo.git_remote}'"
|
63
|
+
|
64
|
+
log :info, "-- Starting to check repository '#{repo.name}'"
|
65
|
+
log :confirm, "-> Active user : '#{repo.user_name} <#{repo.user_email}>'"
|
66
|
+
log :confirm, "-> User shortcut : '#{repo.user_shortcut}'"
|
67
|
+
log :info, "\n"
|
68
|
+
|
69
|
+
log :info, "-- Checking for latest changes on \'#{repo.remote}\'"
|
70
|
+
repo.fetch_remote_changes
|
67
71
|
latest_major_release_tag = repo.latest_major_release_tag
|
68
72
|
latest_minor_release_tag = repo.latest_minor_release_tag
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
CapitaGit.ui.info ''
|
73
|
+
log :confirm, "-> Latest major release tag is: #{latest_major_release_tag || '---'}"
|
74
|
+
log :confirm, "-> Latest minor release tag is: #{latest_minor_release_tag || '---'}"
|
75
|
+
log :info, "\n"
|
73
76
|
|
74
77
|
if latest_major_release_tag.nil?
|
75
|
-
|
78
|
+
log :warn, 'No major release tag found, exiting!'
|
76
79
|
exit 0
|
77
80
|
end
|
78
81
|
|
79
|
-
|
82
|
+
log :info, '-- Checking for presence of major release fixbranch'
|
80
83
|
local_fixbranch = repo.local_fixbranch_for_version?(latest_major_release_tag)
|
81
84
|
remote_fixbranch = repo.remote_fixbranch_for_version?(latest_major_release_tag)
|
82
|
-
|
83
|
-
|
85
|
+
log :confirm, "-> Local : #{local_fixbranch.nil? ? '---' : local_fixbranch.full }"
|
86
|
+
log :confirm, "-> Remote : #{remote_fixbranch.nil? ? '---' : remote_fixbranch.full }"
|
84
87
|
|
85
88
|
if not repo.has_remote_fixbranch_for_version?(latest_major_release_tag)
|
86
|
-
|
89
|
+
log :info, "--> Creating remote fixbranch #{latest_major_release_tag}-fix"
|
87
90
|
repo.create_remote_fixbranch_for_version(latest_major_release_tag)
|
88
91
|
end
|
89
92
|
|
90
93
|
if not repo.has_local_fixbranch_for_version?(latest_major_release_tag)
|
91
|
-
|
94
|
+
log :info, "--> Creating tracking local fixbranch #{latest_major_release_tag}-fix from remote fixbranch"
|
92
95
|
repo.create_local_fixbranch_for_version(latest_major_release_tag)
|
93
96
|
end
|
94
97
|
|
95
|
-
|
98
|
+
log :info, "\n-- Done!\n"
|
96
99
|
end
|
97
100
|
|
98
101
|
desc "create", "Creates a new feature branch with the given name and optional source branch"
|
99
|
-
def create(name,
|
100
|
-
repo = Repository.open(Dir.pwd)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
repo.create_local_branch_from_source("#{repo.user_shortcut}_#{source}_#{name}", source)
|
107
|
-
repo.checkout_local_branch("#{repo.user_shortcut}_#{source}_#{name}")
|
102
|
+
def create(name, source_branch=nil)
|
103
|
+
repo = CapitaGit::Repository.open(Dir.pwd)
|
104
|
+
source_branch = source_branch.nil? ? repo.current_branch.to_s : source_branch
|
105
|
+
new_branch = "#{repo.user_shortcut}_#{source_branch}_#{name}"
|
106
|
+
log :confirm, "--> Creating and switching to feature branch '#{new_branch}'"
|
107
|
+
repo.create_local_branch(new_branch, source_branch)
|
108
|
+
repo.checkout_local_branch(new_branch)
|
108
109
|
end
|
109
110
|
|
110
111
|
desc "update", "Updates a feature branch your currently on or specified by name"
|
111
|
-
def update(
|
112
|
-
repo = Repository.open(Dir.pwd)
|
113
|
-
|
114
|
-
raise "Source branch '#{
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
repo.rebase_local_branch(name)
|
112
|
+
def update(feature_branch=nil)
|
113
|
+
repo = CapitaGit::Repository.open(Dir.pwd)
|
114
|
+
feature_branch = feature_branch.nil? ? repo.current_branch : feature_branch
|
115
|
+
raise "Source branch '#{feature_branch}' is not a feature branch, can't update!" unless repo.is_local_feature_branch?(feature_branch)
|
116
|
+
|
117
|
+
log :confirm, "--> Updating feature branch '#{feature_branch}' from '#{repo.source_branch(feature_branch)}'"
|
118
|
+
repo.rebase_local_branch(feature_branch)
|
119
119
|
end
|
120
120
|
|
121
121
|
desc "close", "Closes a feature branch your currently on or specified by name onto the source branch"
|
122
|
-
def close(
|
123
|
-
repo = Repository.open(Dir.pwd)
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
CapitaGit.ui.confirm "--> Closing feature branch '#{name}' onto '#{repo.source_branch(name)}'"
|
129
|
-
repo.close_local_branch(name)
|
122
|
+
def close(feature_branch=nil)
|
123
|
+
repo = CapitaGit::Repository.open(Dir.pwd)
|
124
|
+
feature_branch = feature_branch.nil? ? repo.current_branch : feature_branch
|
125
|
+
|
126
|
+
log :confirm, "--> Closing feature branch '#{feature_branch}' onto '#{repo.source_branch(feature_branch)}'"
|
127
|
+
repo.close_local_branch(feature_branch)
|
130
128
|
end
|
131
129
|
|
132
130
|
desc "runner", "Generates a Gemfile into the current working directory"
|
131
|
+
|
133
132
|
def runner(command)
|
134
|
-
repo = Repository.open(Dir.pwd)
|
133
|
+
repo = CapitaGit::Repository.open(Dir.pwd)
|
135
134
|
puts repo.send("#{command}")
|
136
135
|
end
|
137
136
|
|
138
137
|
private
|
139
138
|
|
139
|
+
def log(level, message)
|
140
|
+
CapitaGit.ui.send(level, message)
|
141
|
+
end
|
142
|
+
|
140
143
|
def have_groff?
|
141
144
|
!(`which groff` rescue '').empty?
|
142
145
|
end
|
data/lib/capita_git/man/gitc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "GITC" "5" "January 2011" "GITC 0.1.
|
4
|
+
.TH "GITC" "5" "January 2011" "GITC 0.1.2" "GITC Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBgitc\fR \- git helper for CAPITA Unternehmensberatung GmbH
|
data/lib/capita_git/man/gitc.txt
CHANGED
@@ -2,42 +2,54 @@ require 'git'
|
|
2
2
|
|
3
3
|
module CapitaGit
|
4
4
|
class Repository
|
5
|
-
|
6
|
-
|
5
|
+
attr_accessor :git_remote
|
6
|
+
attr_reader :logger
|
7
|
+
|
8
|
+
def self.open(path, cli=nil)
|
9
|
+
new(path, cli)
|
7
10
|
end
|
8
11
|
|
9
12
|
def method_missing(m, *args)
|
10
13
|
@repository.send m, *args
|
11
14
|
end
|
12
15
|
|
13
|
-
def initialize(path)
|
14
|
-
@
|
15
|
-
|
16
|
+
def initialize(path, cli)
|
17
|
+
@logger = cli
|
18
|
+
|
19
|
+
begin
|
20
|
+
log 'Opening repository'
|
21
|
+
@repository = Git.open path
|
22
|
+
rescue => e
|
23
|
+
raise CapitaGit::RepositoryError.new 'Can\'t access repository: ' + e.message
|
24
|
+
end
|
25
|
+
|
26
|
+
@git_remote = 'origin'
|
27
|
+
raise CapitaGit::UncleanError.new "Pending changes found!" if has_changes?
|
16
28
|
end
|
17
29
|
|
18
|
-
def
|
19
|
-
|
30
|
+
def name
|
31
|
+
dir.to_s.split(/\//).last
|
20
32
|
end
|
21
33
|
|
22
|
-
def
|
23
|
-
|
34
|
+
def fetch_remote_changes
|
35
|
+
log 'Fetching remote changes'
|
36
|
+
@repository.fetch(@git_remote)
|
24
37
|
end
|
25
38
|
|
26
|
-
def
|
27
|
-
|
28
|
-
@repository.status.added.empty?
|
29
|
-
raise CapitaGit::UncleanError.new "Repository is not clean!"
|
30
|
-
end
|
39
|
+
def current_branch
|
40
|
+
@repository.branches.local.select { |b| b.full == @repository.lib.branch_current }[0]
|
31
41
|
end
|
32
42
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
43
|
+
def has_changes?
|
44
|
+
log 'Checking for pending changes'
|
45
|
+
changes = `git status --short`
|
46
|
+
!changes.empty?
|
36
47
|
end
|
37
48
|
|
38
|
-
def
|
39
|
-
raise "Branch '#{
|
40
|
-
|
49
|
+
def create_local_branch(new_branch, source_branch, track=false)
|
50
|
+
raise "Branch '#{new_branch}' already exists!" if has_local_branch?(new_branch)
|
51
|
+
raise "Current branch '#{source_branch}' can't be used as a source for branching!" unless on_branchable_branch?(source_branch)
|
52
|
+
system "git branch #{track ? '--track' : ''} #{new_branch} #{source_branch}"
|
41
53
|
end
|
42
54
|
|
43
55
|
def push_local_branch_to_remote(remote, local_name, remote_name=nil)
|
@@ -57,19 +69,21 @@ module CapitaGit
|
|
57
69
|
@repository.branch(name).checkout
|
58
70
|
end
|
59
71
|
|
60
|
-
def rebase_local_branch(
|
61
|
-
raise "Can't update #{
|
62
|
-
checkout_local_branch source_branch(
|
72
|
+
def rebase_local_branch(branch)
|
73
|
+
raise "Can't update #{branch} since it doesn't exist!" unless has_local_branch?(branch)
|
74
|
+
checkout_local_branch source_branch(branch)
|
63
75
|
system "git pull"
|
64
|
-
checkout_local_branch
|
65
|
-
system "git rebase #{source_branch(
|
76
|
+
checkout_local_branch branch
|
77
|
+
system "git rebase #{source_branch(branch)}"
|
78
|
+
raise CapitaGit::UncleanError.new "Rebasing failed, please correct and issue 'git rebase --continue'" if has_changes?
|
66
79
|
end
|
67
80
|
|
68
|
-
def close_local_branch(
|
69
|
-
|
70
|
-
|
71
|
-
system "git
|
72
|
-
system "git
|
81
|
+
def close_local_branch(branch)
|
82
|
+
raise "Source branch '#{branch}' is not a feature branch, can't close!" unless is_local_feature_branch?(branch)
|
83
|
+
rebase_local_branch(branch)
|
84
|
+
system "git checkout #{source_branch(branch)}"
|
85
|
+
system "git merge #{branch}"
|
86
|
+
system "git branch -d #{branch}"
|
73
87
|
end
|
74
88
|
|
75
89
|
def has_local_branch?(name)
|
@@ -80,14 +94,18 @@ module CapitaGit
|
|
80
94
|
!name.match(/^#{user_shortcut}/).nil?
|
81
95
|
end
|
82
96
|
|
97
|
+
def on_branchable_branch?(branch)
|
98
|
+
branch == 'master' or not is_local_feature_branch?(branch)
|
99
|
+
end
|
100
|
+
|
83
101
|
def create_remote_fixbranch_for_version(version)
|
84
|
-
|
102
|
+
create_local_branch("local_#{version}-fix", version)
|
85
103
|
push_local_branch_to_remote('origin', "local_#{version}-fix", "#{version}-fix")
|
86
104
|
delete_local_branch("local_#{version}-fix")
|
87
105
|
end
|
88
106
|
|
89
107
|
def create_local_fixbranch_for_version(version)
|
90
|
-
|
108
|
+
create_local_branch("#{version}-fix", "origin/#{version}-fix", true)
|
91
109
|
end
|
92
110
|
|
93
111
|
def local_fixbranch_for_version?(version)
|
@@ -139,10 +157,15 @@ module CapitaGit
|
|
139
157
|
|
140
158
|
private
|
141
159
|
|
142
|
-
def
|
143
|
-
@
|
160
|
+
def log(message)
|
161
|
+
@logger.send(:debug, "[DEBUG] #{message}") if @logger
|
144
162
|
end
|
145
163
|
|
164
|
+
|
165
|
+
# def remote
|
166
|
+
# @repository.remotes.select { |r| r.name == 'origin' }[0]
|
167
|
+
# end
|
168
|
+
|
146
169
|
def major_release_tags
|
147
170
|
@repository.tags.map(&:name).select { |tag| tag =~ /^\d+\.\d+$/ }
|
148
171
|
end
|
data/lib/capita_git/ui.rb
CHANGED
data/lib/capita_git/version.rb
CHANGED
data/lib/capita_git.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
$:.unshift File.expand_path(__FILE__)
|
2
|
+
require 'rubygems'
|
3
|
+
require 'capita_git/cli'
|
4
|
+
require 'capita_git/repository'
|
5
|
+
require 'capita_git/ui'
|
6
|
+
require 'capita_git/version'
|
4
7
|
|
8
|
+
module CapitaGit
|
5
9
|
class << self
|
6
10
|
attr_writer :ui
|
7
11
|
|
@@ -16,4 +20,7 @@ module CapitaGit
|
|
16
20
|
|
17
21
|
class UncleanError < StandardError
|
18
22
|
end
|
23
|
+
|
24
|
+
class RepositoryError < StandardError
|
25
|
+
end
|
19
26
|
end
|
data/test/cli_test.rb
CHANGED
@@ -10,19 +10,19 @@ class CliTest < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
in_dir 'local_checkout_2' do
|
12
12
|
should_not_have_branch '1.0-fix'
|
13
|
-
|
13
|
+
|
14
14
|
gitc 'check' do
|
15
15
|
should_have_branch '1.0-fix'
|
16
|
-
|
16
|
+
|
17
17
|
context "after creating a fix" do
|
18
18
|
setup do
|
19
19
|
assert_command 'git checkout 1.0-fix'
|
20
20
|
assert_command 'echo "foo" > fixfile'
|
21
21
|
assert_command 'git add . && git commit -m "fixfile" && git push'
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
should_not_have_file 'fixfile', :in => 'local_checkout_1'
|
25
|
-
|
25
|
+
|
26
26
|
context "after pull and checkout of 1.0-fix in checkout 1" do
|
27
27
|
setup do
|
28
28
|
in_dir 'local_checkout_1' do
|
@@ -33,19 +33,23 @@ class CliTest < Test::Unit::TestCase
|
|
33
33
|
should_have_file 'fixfile', :in => 'local_checkout_1'
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
gitc 'create my_feature' do
|
42
42
|
should "be on branch USER_master_my_feature" do
|
43
|
-
user = CapitaGit::Repository.
|
43
|
+
user = CapitaGit::Repository.open('.').user_shortcut
|
44
44
|
assert_equal "#{user}_master_my_feature", repo.current_branch
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
should_not_have_file 'awesome_feature', :in => 'local_checkout_1'
|
48
|
-
|
48
|
+
|
49
|
+
should "break trying to create another feature branch from existing feature branch" do
|
50
|
+
assert_command_fail 'gitc create new_feature'
|
51
|
+
end
|
52
|
+
|
49
53
|
# Propagating changes on source branch with gitc update
|
50
54
|
context "after checkout 2 pushes file master_2_update on master" do
|
51
55
|
setup do
|
@@ -54,17 +58,30 @@ class CliTest < Test::Unit::TestCase
|
|
54
58
|
assert_command 'git add . && git commit -m "master 2 update" && git push'
|
55
59
|
end
|
56
60
|
end
|
57
|
-
|
61
|
+
|
58
62
|
after 'git pull origin master' do
|
59
63
|
should_not_have_file 'awesome_feature', :in => 'local_checkout_1'
|
60
64
|
end
|
61
|
-
|
65
|
+
|
62
66
|
context "after invoking 'gitc update'" do
|
63
67
|
setup { assert_command("#{ShouldaMacros::BIN_PATH} update") }
|
64
68
|
should_have_file 'master_2_update', :in => 'local_checkout_1'
|
65
69
|
end
|
70
|
+
|
71
|
+
# context "while having the same file changed in origin" do
|
72
|
+
# setup do
|
73
|
+
# in_dir 'local_checkout_1' do
|
74
|
+
# assert_command 'echo "foo" > master_2_update'
|
75
|
+
# assert_command 'git add . && git commit -m "master 2 update"'
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# should "crash on invoking 'gitc update'" do
|
80
|
+
# assert_command_fail("#{ShouldaMacros::BIN_PATH} update")
|
81
|
+
# end
|
82
|
+
# end
|
66
83
|
end
|
67
|
-
|
84
|
+
|
68
85
|
# Committing a fix and closing branch
|
69
86
|
context "after committing a file and gitc close" do
|
70
87
|
setup do
|
@@ -73,28 +90,28 @@ class CliTest < Test::Unit::TestCase
|
|
73
90
|
assert_command("#{ShouldaMacros::BIN_PATH} close")
|
74
91
|
assert_command 'git push'
|
75
92
|
end
|
76
|
-
|
93
|
+
|
77
94
|
should "be on branch master" do
|
78
95
|
assert_equal 'master', repo.current_branch
|
79
96
|
end
|
80
|
-
|
97
|
+
|
81
98
|
should "have removed the feature branch" do
|
82
|
-
assert !repo.branches.map(&:name).any? {|n| n =~ /feature/}
|
99
|
+
assert !repo.branches.map(&:name).any? { |n| n =~ /feature/ }
|
83
100
|
end
|
84
|
-
|
101
|
+
|
85
102
|
should_have_file 'awesome_feature', :in => 'local_checkout_1'
|
86
|
-
|
103
|
+
|
87
104
|
context "after git pull on local_checkout_2" do
|
88
105
|
setup do
|
89
106
|
in_dir 'local_checkout_2' do
|
90
107
|
assert_command 'git pull'
|
91
108
|
end
|
92
109
|
end
|
93
|
-
|
110
|
+
|
94
111
|
should_have_file 'awesome_feature', :in => 'local_checkout_2'
|
95
112
|
end
|
96
113
|
end
|
97
|
-
|
114
|
+
|
98
115
|
end
|
99
116
|
end
|
100
117
|
end
|
data/test/shoulda_macros.rb
CHANGED
@@ -27,6 +27,13 @@ module ShouldaMacros
|
|
27
27
|
#puts `#{cmd}`
|
28
28
|
assert_equal 0, $?.exitstatus, "Expected exit status of 0 for command '#{cmd}'"
|
29
29
|
end
|
30
|
+
|
31
|
+
# Runs the specified command and asserts it's exit status should be 1
|
32
|
+
def assert_command_fail(cmd)
|
33
|
+
Open4.popen4(cmd) { |pid, stdin, stdout, stderr| }
|
34
|
+
#puts `#{cmd}`
|
35
|
+
assert_equal 1, $?.exitstatus, "Expected exit status of 1 for command '#{cmd}'"
|
36
|
+
end
|
30
37
|
|
31
38
|
# Opens a Git ruby lib instance for current working dir and returns it
|
32
39
|
def repo
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capita_git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sebastian Georgi
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-02-
|
19
|
+
date: 2011-02-03 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -126,8 +126,8 @@ files:
|
|
126
126
|
- test/shoulda_macros.rb
|
127
127
|
- test/test_helper.rb
|
128
128
|
- lib/capita_git/man/gitc
|
129
|
-
- lib/capita_git/man/gitc-check.txt
|
130
129
|
- lib/capita_git/man/gitc-check
|
130
|
+
- lib/capita_git/man/gitc-check.txt
|
131
131
|
- lib/capita_git/man/gitc.txt
|
132
132
|
has_rdoc: true
|
133
133
|
homepage: https://github.com/capita/capita_git
|
@@ -159,9 +159,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
requirements: []
|
160
160
|
|
161
161
|
rubyforge_project: capita_git
|
162
|
-
rubygems_version: 1.
|
162
|
+
rubygems_version: 1.4.1
|
163
163
|
signing_key:
|
164
164
|
specification_version: 3
|
165
165
|
summary: Git-automation tool for quick handling of common patterns for feature and fix branches
|
166
|
-
test_files:
|
167
|
-
|
166
|
+
test_files:
|
167
|
+
- test/cli_test.rb
|
168
|
+
- test/shoulda_macros.rb
|
169
|
+
- test/test_helper.rb
|