regrit 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,11 +2,20 @@ module Regrit
2
2
  class Ref
3
3
  def initialize(repo, ref)
4
4
  @repo = repo
5
- @commit, @name = ref.split(/\t/)
5
+ @commit, @full_name = ref.split(/\t/)
6
+ @type, @name = @full_name.scan(%r#refs/([^/]+)/(.+)#).first || [nil, @full_name]
6
7
  raise InvalidRefsFormat.new(ref) if @name.nil?
7
8
  end
8
9
 
9
- attr_reader :commit, :name
10
+ attr_reader :commit, :full_name, :name, :type
11
+
12
+ def tag?
13
+ type == 'tags'
14
+ end
15
+
16
+ def branch?
17
+ type == 'heads'
18
+ end
10
19
 
11
20
  def abbrev_commit
12
21
  commit[0...7]
@@ -1,3 +1,3 @@
1
1
  module Regrit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Regrit::VERSION
8
8
  s.authors = ["Martin Emde"]
9
9
  s.email = ["martin.emde@gmail.com"]
10
- s.homepage = "http://github.org/martinemde/regrit"
10
+ s.homepage = "http://github.com/engineyard/regrit"
11
11
  s.summary = %q{Never regrit how you talk with remote git repositories}
12
12
  s.description = %q{Deal with remote git repositories, yo.}
13
13
 
@@ -96,13 +96,19 @@ describe Regrit::RemoteRepo do
96
96
  Regrit::Provider::Mock.refs = <<-REFS
97
97
  1234567890123456789012345678901234567890\tHEAD
98
98
  1234567890123456789012345678901234567890\trefs/heads/master
99
+ 1234567890123456789012345678901234567890\trefs/tags/v1.2.3
99
100
  REFS
100
101
  end
101
102
 
102
103
  it "returns the refs as set" do
103
- subject.should have(2).refs
104
+ subject.should have(3).refs
104
105
  subject.ref('master').abbrev_commit.should == "1234567"
106
+ subject.ref('master').should be_branch
105
107
  subject.refs.first.name.should == "HEAD"
108
+ subject.refs.first.type.should == nil
109
+ subject.ref('v1.2.3').type.should == 'tags'
110
+ subject.ref('v1.2.3').should be_tag
111
+ subject.ref('v1.2.3').should_not be_branch
106
112
  end
107
113
  end
108
114
  end
@@ -81,11 +81,17 @@ describe Regrit::RemoteRepo do
81
81
  it { should have_at_least(2).refs }
82
82
 
83
83
  it "has a master ref" do
84
- subject.ref('master').name.should == 'refs/heads/master'
84
+ subject.ref('master').name.should == 'master'
85
+ subject.ref('master').type.should == 'heads'
86
+ subject.ref('master').should be_branch
87
+ subject.ref('master').should_not be_tag
85
88
  end
86
89
 
87
90
  it "has a refs/heads/master ref" do
88
- subject.ref('refs/heads/master').name.should == 'refs/heads/master'
91
+ subject.ref('refs/heads/master').name.should == 'master'
92
+ subject.ref('refs/heads/master').type.should == 'heads'
93
+ subject.ref('refs/heads/master').should be_branch
94
+ subject.ref('refs/heads/master').should_not be_tag
89
95
  end
90
96
  end
91
97
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regrit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-22 00:00:00.000000000 Z
12
+ date: 2012-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gitable
16
- requirement: &70278541044920 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.2.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70278541044920
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.2.1
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: open4
27
- requirement: &70278541044500 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70278541044500
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: escape
38
- requirement: &70278541044040 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70278541044040
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: git-ssh-wrapper
49
- requirement: &70278541043540 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 0.1.0
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *70278541043540
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.1.0
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: system-timer19
60
- requirement: &70278541043040 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: 0.0.2
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *70278541043040
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.0.2
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: rspec
71
- requirement: &70278541042560 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '2.0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70278541042560
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '2.0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: rake
82
- requirement: &70278541042100 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ~>
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '0.9'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70278541042100
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '0.9'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: rcov
93
- requirement: &70278541041720 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ! '>='
@@ -98,7 +133,12 @@ dependencies:
98
133
  version: '0'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *70278541041720
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
102
142
  description: Deal with remote git repositories, yo.
103
143
  email:
104
144
  - martin.emde@gmail.com
@@ -126,7 +166,7 @@ files:
126
166
  - spec/spec.opts
127
167
  - spec/spec_helper.rb
128
168
  - spec/wrong_key
129
- homepage: http://github.org/martinemde/regrit
169
+ homepage: http://github.com/engineyard/regrit
130
170
  licenses: []
131
171
  post_install_message:
132
172
  rdoc_options: []
@@ -140,7 +180,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
180
  version: '0'
141
181
  segments:
142
182
  - 0
143
- hash: 677623455143979724
183
+ hash: 3102733921299104742
144
184
  required_rubygems_version: !ruby/object:Gem::Requirement
145
185
  none: false
146
186
  requirements:
@@ -149,10 +189,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
189
  version: '0'
150
190
  segments:
151
191
  - 0
152
- hash: 677623455143979724
192
+ hash: 3102733921299104742
153
193
  requirements: []
154
194
  rubyforge_project:
155
- rubygems_version: 1.8.15
195
+ rubygems_version: 1.8.24
156
196
  signing_key:
157
197
  specification_version: 3
158
198
  summary: Never regrit how you talk with remote git repositories