git-up 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/git-up.gemspec +4 -4
  3. data/lib/git-up.rb +27 -9
  4. metadata +15 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{git-up}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aanand Prasad"]
12
- s.date = %q{2010-05-18}
12
+ s.date = %q{2010-06-16}
13
13
  s.default_executable = %q{git-up}
14
14
  s.email = %q{aanand.prasad@gmail.com}
15
15
  s.executables = ["git-up"]
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.homepage = %q{http://github.com/aanand/git-up}
34
34
  s.rdoc_options = ["--charset=UTF-8"]
35
35
  s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.3.6}
36
+ s.rubygems_version = %q{1.3.7}
37
37
  s.summary = %q{git command to fetch and rebase all branches}
38
38
  s.test_files = [
39
39
  "test/helper.rb",
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
44
44
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
45
  s.specification_version = 3
46
46
 
47
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
48
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
49
49
  s.add_runtime_dependency(%q<colored>, [">= 1.2"])
50
50
  s.add_runtime_dependency(%q<grit>, [">= 0"])
@@ -3,12 +3,13 @@ require 'grit'
3
3
 
4
4
  class GitUp
5
5
  def initialize(args)
6
- @repo = Grit::Repo.new(File.expand_path("."))
7
- @head = @repo.head
8
6
  end
9
7
 
10
8
  def run
9
+ get_repo
10
+
11
11
  system "git fetch"
12
+ raise GitError, "`git fetch` failed" unless $? == 0
12
13
 
13
14
  with_stash do
14
15
  returning_to_current_branch do
@@ -43,9 +44,18 @@ class GitUp
43
44
  end
44
45
  end
45
46
  rescue GitError => e
46
- puts e.message.red
47
- puts "Here's what Git said:".red
48
- puts e.output
47
+ puts e.message
48
+ exit 1
49
+ end
50
+
51
+ def get_repo
52
+ git_dir = `git rev-parse --git-dir`
53
+
54
+ if $? == 0
55
+ @repo = Grit::Repo.new(File.dirname(git_dir))
56
+ else
57
+ raise GitError, "We don't seem to be in a git repository."
58
+ end
49
59
  end
50
60
 
51
61
  def remote_for_branch(branch)
@@ -120,11 +130,19 @@ class GitUp
120
130
  end
121
131
 
122
132
  class GitError < StandardError
123
- attr_reader :output
133
+ def initialize(message, output=nil)
134
+ @msg = "#{message.red}"
135
+
136
+ if output
137
+ @msg << "\n"
138
+ @msg << "Here's what Git said:".red
139
+ @msg << "\n"
140
+ @msg << output
141
+ end
142
+ end
124
143
 
125
- def initialize(message, output)
126
- super(message)
127
- @output = output
144
+ def message
145
+ @msg
128
146
  end
129
147
  end
130
148
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-up
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 3
8
- - 1
9
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Aanand Prasad
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-18 00:00:00 -04:00
18
+ date: 2010-06-16 00:00:00 -04:00
18
19
  default_executable: git-up
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: thoughtbot-shoulda
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -33,9 +36,11 @@ dependencies:
33
36
  name: colored
34
37
  prerelease: false
35
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ">="
38
42
  - !ruby/object:Gem::Version
43
+ hash: 11
39
44
  segments:
40
45
  - 1
41
46
  - 2
@@ -46,9 +51,11 @@ dependencies:
46
51
  name: grit
47
52
  prerelease: false
48
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
49
55
  requirements:
50
56
  - - ">="
51
57
  - !ruby/object:Gem::Version
58
+ hash: 3
52
59
  segments:
53
60
  - 0
54
61
  version: "0"
@@ -85,23 +92,27 @@ rdoc_options:
85
92
  require_paths:
86
93
  - lib
87
94
  required_ruby_version: !ruby/object:Gem::Requirement
95
+ none: false
88
96
  requirements:
89
97
  - - ">="
90
98
  - !ruby/object:Gem::Version
99
+ hash: 3
91
100
  segments:
92
101
  - 0
93
102
  version: "0"
94
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
+ none: false
95
105
  requirements:
96
106
  - - ">="
97
107
  - !ruby/object:Gem::Version
108
+ hash: 3
98
109
  segments:
99
110
  - 0
100
111
  version: "0"
101
112
  requirements: []
102
113
 
103
114
  rubyforge_project:
104
- rubygems_version: 1.3.6
115
+ rubygems_version: 1.3.7
105
116
  signing_key:
106
117
  specification_version: 3
107
118
  summary: git command to fetch and rebase all branches