git-topic 0.1.6.2 → 0.1.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -79,9 +79,26 @@ task 'version:write:build' do
79
79
  File.open( "VERSION.yml", "w" ){|f| f.puts YAML::dump( v )}
80
80
  end
81
81
 
82
+ task 'version:bump:build' do
83
+ y = YAML::load_file( "VERSION.yml" )
84
+ v = {
85
+ :major => 0, :minor => 0, :patch => 0, :build => 0
86
+ }
87
+ v.merge!( y ) if y.is_a? Hash
88
+
89
+ raise "Can't bump build: not a number" unless v[:build].is_a? Numeric
90
+ v[ :build ] += 1
91
+
92
+ v.each{|k,v| ENV[ k.to_s.upcase ] = v.to_s}
93
+ Rake::Task["version:write"].invoke
94
+ end
95
+
96
+
82
97
  desc "Run all specs."
83
98
  task :spec do
84
- sh "bundle exec rspec spec"
99
+ # Jeweler messes up specs by polluting ENV
100
+ ENV.keys.grep( /git/i ).each{|k| ENV.delete k }
101
+ sh "rspec spec"
85
102
  end
86
103
 
87
104
 
@@ -2,4 +2,4 @@
2
2
  :major: 0
3
3
  :minor: 1
4
4
  :patch: 6
5
- :build: "2"
5
+ :build: "3"
@@ -17,7 +17,6 @@ module GitTopic
17
17
  [h[:major], h[:minor], h[:patch], h[:build]].compact.join( "." )
18
18
  end
19
19
  }.call
20
- GlobalOptKeys = [ :verbose, :help, :verbose_given, :version ]
21
20
 
22
21
  class << self
23
22
  def run
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{git-topic}
8
- s.version = "0.1.6.2"
8
+ s.version = "0.1.6.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David J. Hamilton"]
@@ -13,6 +13,8 @@ module GitTopic
13
13
  include GitTopic::Git
14
14
  include GitTopic::Naming
15
15
 
16
+ GlobalOptKeys = [ :verbose, :help, :verbose_given, :version ]
17
+
16
18
 
17
19
  class << self
18
20
 
@@ -167,7 +169,7 @@ module GitTopic
167
169
 
168
170
  rem_review_branch = find_remote_review_branch( topic ).gsub( %r{^origin/}, '' )
169
171
  git [
170
- "push origin :#{rem_review_branch}",
172
+ "push origin master :#{rem_review_branch}",
171
173
  "branch -d #{local_review_branch}"
172
174
  ]
173
175
  end
@@ -15,7 +15,7 @@ describe GitTopic do
15
15
  FileUtils.rm_rf './tmp'
16
16
  FileUtils.mkdir './tmp'
17
17
 
18
- %w(fresh in-progress dirty origin).each do |repo|
18
+ %w(fresh in-progress origin).each do |repo|
19
19
  FileUtils.cp_r "spec/template/#{repo}", './tmp'
20
20
 
21
21
  # set template branches to their proper name (i.e. matching @user)
@@ -42,6 +42,13 @@ describe GitTopic do
42
42
 
43
43
  # helpers # {{{
44
44
 
45
+ def use_repo( repo )
46
+ Dir.chdir( repo )
47
+ # Exit if e.g. GIT_DIR is set
48
+ raise "Spec error" unless `git rev-parse --git-dir`.chomp == '.git'
49
+ end
50
+
51
+
45
52
  def git_branch
46
53
  all_branches = `git branch --no-color`.split( "\n" )
47
54
  current_branch = all_branches.find{|b| b =~ /^\*/}
@@ -53,6 +60,10 @@ describe GitTopic do
53
60
  `git rev-parse HEAD`.chomp
54
61
  end
55
62
 
63
+ def git_origin_master
64
+ `git rev-parse origin/master`.chomp
65
+ end
66
+
56
67
  def git_config( key )
57
68
  `git config #{key}`.chomp
58
69
  end
@@ -85,7 +96,7 @@ describe GitTopic do
85
96
  describe "#work_on" do
86
97
 
87
98
  describe "in fresh" do
88
- before( :each ) { Dir.chdir( 'fresh' )}
99
+ before( :each ) { use_repo( 'fresh' )}
89
100
  after( :each ) { Dir.chdir( '..' )}
90
101
 
91
102
  it "
@@ -108,7 +119,7 @@ describe GitTopic do
108
119
 
109
120
  describe "in in-progress" do
110
121
 
111
- before( :each ) { Dir.chdir( 'in-progress' )}
122
+ before( :each ) { use_repo( 'in-progress' )}
112
123
  after( :each ) { Dir.chdir( '..' )}
113
124
 
114
125
 
@@ -139,7 +150,7 @@ describe GitTopic do
139
150
 
140
151
  describe "in in-progress" do
141
152
 
142
- before( :each ) { Dir.chdir 'in-progress' }
153
+ before( :each ) { use_repo 'in-progress' }
143
154
  after( :each ) { Dir.chdir '..' }
144
155
 
145
156
  describe "without an argument" do
@@ -181,7 +192,7 @@ describe GitTopic do
181
192
 
182
193
  describe "with pending review branches" do
183
194
 
184
- before( :each ) { Dir.chdir 'in-progress' }
195
+ before( :each ) { use_repo 'in-progress' }
185
196
  after( :each ) { Dir.chdir '..' }
186
197
 
187
198
 
@@ -207,7 +218,7 @@ describe GitTopic do
207
218
  end
208
219
 
209
220
  describe "passed the --prepended flag" do
210
- before( :each ) { Dir.chdir 'in-progress' }
221
+ before( :each ) { use_repo 'in-progress' }
211
222
  after( :each ) { Dir.chdir '..' }
212
223
 
213
224
  it "should invoke git status before producing its output" do
@@ -221,7 +232,7 @@ describe GitTopic do
221
232
  describe "#review" do
222
233
 
223
234
  describe "with no review branches" do
224
- before( :each ) { Dir.chdir 'fresh' }
235
+ before( :each ) { use_repo 'fresh' }
225
236
  after( :each ) { Dir.chdir '..' }
226
237
 
227
238
  it "should report that there is nothing to do" do
@@ -235,7 +246,7 @@ describe GitTopic do
235
246
  end
236
247
 
237
248
  describe "with some review branches" do
238
- before( :each ) { Dir.chdir 'in-progress' }
249
+ before( :each ) { use_repo 'in-progress' }
239
250
  after( :each ) { Dir.chdir '..' }
240
251
 
241
252
  it "
@@ -279,7 +290,7 @@ describe GitTopic do
279
290
 
280
291
  describe "while on a review branch" do
281
292
  before( :each ) do
282
- Dir.chdir 'in-progress'
293
+ use_repo 'in-progress'
283
294
  GitTopic.review 'user24601/zombie-basic'
284
295
  end
285
296
  after( :each ) { Dir.chdir '..' }
@@ -297,13 +308,14 @@ describe GitTopic do
297
308
  git_remote_branches.should_not include( 'review/user24601/zombie-basic' )
298
309
 
299
310
  git_head.should == '0ce06c616769768f09f5e629cfcc68eabe3dee81'
311
+ git_origin_master.should == '0ce06c616769768f09f5e629cfcc68eabe3dee81'
300
312
  end
301
313
  end
302
314
  end
303
315
 
304
316
  describe "while on a review branch that does not FF" do
305
317
  before( :each ) do
306
- Dir.chdir 'in-progress'
318
+ use_repo 'in-progress'
307
319
  system "
308
320
  git checkout master > /dev/null 2> /dev/null &&
309
321
  git merge wip/prevent-ff > /dev/null 2> /dev/null
@@ -325,7 +337,7 @@ describe GitTopic do
325
337
  end
326
338
 
327
339
  describe "while not on a review branch" do
328
- before( :each ) { Dir.chdir 'in-progress' }
340
+ before( :each ) { use_repo 'in-progress' }
329
341
  after( :each ) { Dir.chdir '..' }
330
342
 
331
343
  it "should fail" do
@@ -339,7 +351,7 @@ describe GitTopic do
339
351
 
340
352
  describe "while on a review branch" do
341
353
  before( :each ) do
342
- Dir.chdir 'in-progress'
354
+ use_repo 'in-progress'
343
355
  GitTopic.review 'user24601/zombie-basic'
344
356
  end
345
357
  after( :each ) { Dir.chdir '..' }
@@ -361,7 +373,7 @@ describe GitTopic do
361
373
  end
362
374
 
363
375
  describe "while not on a review branch" do
364
- before( :each ) { Dir.chdir 'in-progress' }
376
+ before( :each ) { use_repo 'in-progress' }
365
377
  after( :each ) { Dir.chdir '..' }
366
378
 
367
379
  it "should fail" do
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 1
8
8
  - 6
9
- - 2
10
- version: 0.1.6.2
9
+ - 3
10
+ version: 0.1.6.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - David J. Hamilton