propel 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,11 +13,23 @@ module Propel
13
13
  end
14
14
 
15
15
  def remote_config
16
- git("config branch.#{current_branch}.remote")
16
+ git("config branch.#{current_branch}.remote").tap do |remote|
17
+ if remote.empty?
18
+ warn "We could not determine the remote repository for branch '#{current_branch}.' " +
19
+ "Please set it with git config branch.#{current_branch}.remote REMOTE_REPO."
20
+ exit 1
21
+ end
22
+ end
17
23
  end
18
24
 
19
25
  def merge_config
20
- git("config branch.#{current_branch}.merge")
26
+ git("config branch.#{current_branch}.merge").tap do |merge|
27
+ if merge.empty?
28
+ warn "We could not determine the remote branch for local branch '#{current_branch}.' " +
29
+ "Please set it with git config branch.#{current_branch}.merge REMOTE_BRANCH."
30
+ exit 1
31
+ end
32
+ end
21
33
  end
22
34
 
23
35
  private
@@ -1,3 +1,3 @@
1
1
  module Propel
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -56,6 +56,18 @@ describe Propel::GitRepository do
56
56
 
57
57
  git_repository.remote_config.should == 'origin'
58
58
  end
59
+
60
+ it "should raise an error if the remote repository cannot be determined" do
61
+ git_repository = Propel::GitRepository.new
62
+
63
+ git_repository.stub!(:git).with("branch").and_return("* foo\n testbranch")
64
+ git_repository.stub!(:git).with("config branch.foo.remote").and_return("")
65
+
66
+ git_repository.should_receive(:warn).with("We could not determine the remote repository for branch 'foo.' Please set it with git config branch.foo.remote REMOTE_REPO.")
67
+ git_repository.should_receive(:exit).with(1)
68
+
69
+ git_repository.remote_config
70
+ end
59
71
  end
60
72
 
61
73
  describe "#merge_config" do
@@ -66,5 +78,16 @@ describe Propel::GitRepository do
66
78
 
67
79
  git_repository.merge_config.should == 'refs/heads/master'
68
80
  end
81
+
82
+ it "should raise an error if the remote branch cannot be determined" do
83
+ git_repository = Propel::GitRepository.new
84
+
85
+ git_repository.stub!(:git).with("branch").and_return("* foo\n testbranch")
86
+ git_repository.stub!(:git).with("config branch.foo.merge").and_return("")
87
+
88
+ git_repository.should_receive(:warn).with("We could not determine the remote branch for local branch 'foo.' Please set it with git config branch.foo.merge REMOTE_BRANCH.")
89
+ git_repository.should_receive(:exit).with(1)
90
+ git_repository.merge_config
91
+ end
69
92
  end
70
93
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Leitgeb