git-smart 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ gem 'colorize'
5
5
  group :development do
6
6
  gem "rspec", "~> 2.3.0"
7
7
  gem "rcov", ">= 0"
8
- gem 'ruby-debug'
9
8
  gem "bundler", "~> 1.0.0"
10
9
  gem "jeweler", "~> 1.5.2"
11
10
  end
data/Gemfile.lock CHANGED
@@ -2,14 +2,12 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  colorize (0.5.8)
5
- columnize (0.3.2)
6
5
  diff-lcs (1.1.2)
7
6
  git (1.2.5)
8
7
  jeweler (1.5.2)
9
8
  bundler (~> 1.0.0)
10
9
  git (>= 1.2.5)
11
10
  rake
12
- linecache (0.43)
13
11
  rake (0.8.7)
14
12
  rcov (0.9.8)
15
13
  rspec (2.3.0)
@@ -20,11 +18,6 @@ GEM
20
18
  rspec-expectations (2.3.0)
21
19
  diff-lcs (~> 1.1.2)
22
20
  rspec-mocks (2.3.0)
23
- ruby-debug (0.10.4)
24
- columnize (>= 0.1)
25
- ruby-debug-base (~> 0.10.4.0)
26
- ruby-debug-base (0.10.4)
27
- linecache (>= 0.3)
28
21
 
29
22
  PLATFORMS
30
23
  ruby
@@ -35,4 +28,3 @@ DEPENDENCIES
35
28
  jeweler (~> 1.5.2)
36
29
  rcov
37
30
  rspec (~> 2.3.0)
38
- ruby-debug
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/git-smart.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{git-smart}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Glen Maddern"]
@@ -58,14 +58,12 @@ Gem::Specification.new do |s|
58
58
  s.add_runtime_dependency(%q<colorize>, [">= 0"])
59
59
  s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
60
60
  s.add_development_dependency(%q<rcov>, [">= 0"])
61
- s.add_development_dependency(%q<ruby-debug>, [">= 0"])
62
61
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
63
62
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
64
63
  else
65
64
  s.add_dependency(%q<colorize>, [">= 0"])
66
65
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
67
66
  s.add_dependency(%q<rcov>, [">= 0"])
68
- s.add_dependency(%q<ruby-debug>, [">= 0"])
69
67
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
70
68
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
71
69
  end
@@ -73,7 +71,6 @@ Gem::Specification.new do |s|
73
71
  s.add_dependency(%q<colorize>, [">= 0"])
74
72
  s.add_dependency(%q<rspec>, ["~> 2.3.0"])
75
73
  s.add_dependency(%q<rcov>, [">= 0"])
76
- s.add_dependency(%q<ruby-debug>, [">= 0"])
77
74
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
78
75
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
79
76
  end
@@ -1,2 +1,10 @@
1
- class GitSmart::RunFailed < Exception; end
2
- class GitSmart::UnexpectedOutput < Exception; end
1
+ class GitSmart
2
+ class Exception < ::RuntimeError
3
+ def initialize(msg = '')
4
+ super(msg)
5
+ end
6
+ end
7
+
8
+ class RunFailed < Exception; end
9
+ class UnexpectedOutput < Exception; end
10
+ end
@@ -1,6 +1,9 @@
1
1
  class GitRepo
2
2
  def initialize(dir)
3
3
  @dir = dir
4
+ if !File.exists? File.join(@dir, ".git")
5
+ raise GitSmart::RunFailed.new("You need to run this from within a git directory")
6
+ end
4
7
  end
5
8
 
6
9
  def current_branch
@@ -55,9 +58,9 @@ class GitRepo
55
58
  map_values { |lines| lines.map(&:last) }.
56
59
  map_keys { |status|
57
60
  case status
58
- when /^M/: :modified
59
- when /^A/: :added
60
- when /^\?\?/: :untracked
61
+ when /^M/; :modified
62
+ when /^A/; :added
63
+ when /^\?\?/; :untracked
61
64
  else raise GitSmart::UnexpectedOutput.new("Expected the output of git status to only have lines starting with A,M, or ??. Got: \n#{raw_status}")
62
65
  end
63
66
  }
@@ -4,7 +4,10 @@ class GitSmart
4
4
  if lambda
5
5
  begin
6
6
  lambda.call(args)
7
- rescue GitSmart::RunFailed
7
+ rescue GitSmart::Exception => e
8
+ if e.message && !e.message.empty?
9
+ puts e.message.red
10
+ end
8
11
  end
9
12
  else
10
13
  puts "No command #{code.inspect} defined! Available commands are #{commands.keys.sort.inspect}"
@@ -62,7 +62,7 @@ describe 'smart-pull' do
62
62
  it "should fast-forward" do
63
63
  out = run_command(local_dir, 'smart-pull')
64
64
  out.should report("Executing: git fetch origin")
65
- out.should report(/master +-> +origin\/master/)
65
+ out.should report(/master +-> +origin\/master/)
66
66
  out.should report("There is 1 new commit on master.")
67
67
  out.should report("No uncommitted changes, no need to stash.")
68
68
  out.should report("Local branch 'master' has not moved on. Fast-forwarding.")
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'ruby-debug'
2
1
  require 'rspec'
3
2
 
4
3
  require File.dirname(__FILE__) + '/../lib/git-smart'
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-smart
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Glen Maddern
@@ -19,95 +18,76 @@ date: 2011-01-04 00:00:00 +11:00
19
18
  default_executable: git-smart
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- type: :runtime
24
21
  name: colorize
25
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ requirement: &id001 !ruby/object:Gem::Requirement
26
23
  none: false
27
24
  requirements:
28
25
  - - ">="
29
26
  - !ruby/object:Gem::Version
30
- hash: 3
31
27
  segments:
32
28
  - 0
33
29
  version: "0"
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
30
+ type: :runtime
36
31
  prerelease: false
37
- type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
38
34
  name: rspec
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
35
+ requirement: &id002 !ruby/object:Gem::Requirement
40
36
  none: false
41
37
  requirements:
42
38
  - - ~>
43
39
  - !ruby/object:Gem::Version
44
- hash: 3
45
40
  segments:
46
41
  - 2
47
42
  - 3
48
43
  - 0
49
44
  version: 2.3.0
50
- requirement: *id002
51
- - !ruby/object:Gem::Dependency
52
- prerelease: false
53
45
  type: :development
46
+ prerelease: false
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
54
49
  name: rcov
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
50
+ requirement: &id003 !ruby/object:Gem::Requirement
56
51
  none: false
57
52
  requirements:
58
53
  - - ">="
59
54
  - !ruby/object:Gem::Version
60
- hash: 3
61
55
  segments:
62
56
  - 0
63
57
  version: "0"
64
- requirement: *id003
65
- - !ruby/object:Gem::Dependency
66
- prerelease: false
67
58
  type: :development
68
- name: ruby-debug
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
78
- requirement: *id004
79
- - !ruby/object:Gem::Dependency
80
59
  prerelease: false
81
- type: :development
60
+ version_requirements: *id003
61
+ - !ruby/object:Gem::Dependency
82
62
  name: bundler
83
- version_requirements: &id005 !ruby/object:Gem::Requirement
63
+ requirement: &id004 !ruby/object:Gem::Requirement
84
64
  none: false
85
65
  requirements:
86
66
  - - ~>
87
67
  - !ruby/object:Gem::Version
88
- hash: 23
89
68
  segments:
90
69
  - 1
91
70
  - 0
92
71
  - 0
93
72
  version: 1.0.0
94
- requirement: *id005
95
- - !ruby/object:Gem::Dependency
96
- prerelease: false
97
73
  type: :development
74
+ prerelease: false
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
98
77
  name: jeweler
99
- version_requirements: &id006 !ruby/object:Gem::Requirement
78
+ requirement: &id005 !ruby/object:Gem::Requirement
100
79
  none: false
101
80
  requirements:
102
81
  - - ~>
103
82
  - !ruby/object:Gem::Version
104
- hash: 7
105
83
  segments:
106
84
  - 1
107
85
  - 5
108
86
  - 2
109
87
  version: 1.5.2
110
- requirement: *id006
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *id005
111
91
  description: Installs some additional 'smart' git commands, like `git smart-pull`.
112
92
  email: glenmaddern@gmail.com
113
93
  executables:
@@ -152,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
132
  requirements:
153
133
  - - ">="
154
134
  - !ruby/object:Gem::Version
155
- hash: 3
135
+ hash: -40968980638764518
156
136
  segments:
157
137
  - 0
158
138
  version: "0"
@@ -161,7 +141,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
141
  requirements:
162
142
  - - ">="
163
143
  - !ruby/object:Gem::Version
164
- hash: 3
165
144
  segments:
166
145
  - 0
167
146
  version: "0"