asgit 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f89a149b2ac9d40a18e93a6f80da4e394901046
4
- data.tar.gz: ac6a95bce8a86080ff057908c97ad9ee654e980a
3
+ metadata.gz: 4b9a8c2c5bf1f7d9e58c9ef5485061726c028c85
4
+ data.tar.gz: e27c4c6ed799f60ad422462309218ce844857e8a
5
5
  SHA512:
6
- metadata.gz: d7ad454da449e915d67ea0346ce7b3eaf017ccedb2cd51c78f302309a0d5c7db0ec87536b401771bef72c4aeb4112d1e218c14f9a435e31167e5c9bc56a004aa
7
- data.tar.gz: d3775c9813be77c6921fc378fa50ba316201ca86b53637cf6d8e2910e15b0dc9af988841df6f1aadc05484b4a0dc5bef4564abf4b22030d92461f24ecd4fdf4d
6
+ metadata.gz: af63a58c7b5da43a899951f9d4e82b277736866b2ef708dcd444c9f427e1064e29b034e3f8250a643a980b099b7d13c639dcb1d916c3a090ee1736e765fcdaa7
7
+ data.tar.gz: 1cdfdec55f29086a8a45854b01fd3b15f2f94e6a99a222ce10205f2cda94b40cf193147e0fe82241e8661385d7667126f9ba3c592642a2433111561378817686
@@ -28,6 +28,10 @@ module Asgit
28
28
  "blob/%{commit}/%{file_path}%{line}"
29
29
  end
30
30
 
31
+ def compare_uri
32
+ "compare/%{ref_a}...%{ref_b}"
33
+ end
34
+
31
35
  end
32
36
  end
33
37
  end
@@ -8,28 +8,13 @@ module Asgit
8
8
  end
9
9
  end
10
10
 
11
- def base_url
12
- raise MissingUrlStructure, "#{self.class} does not implement #{__method__}"
13
- end
14
-
15
- def base_structure
16
- raise MissingUrlStructure, "#{self.class} does not implement #{__method__}"
17
- end
18
-
19
- def commit_uri
20
- raise MissingUrlStructure, "#{self.class} does not implement #{__method__}"
21
- end
22
-
23
- def branch_uri
24
- raise MissingUrlStructure, "#{self.class} does not implement #{__method__}"
25
- end
26
-
27
- def file_uri
28
- raise MissingUrlStructure, "#{self.class} does not implement #{__method__}"
29
- end
30
-
31
- def file_at_commit_uri
32
- raise MissingUrlStructure, "#{self.class} does not implement #{__method__}"
11
+ [ :base_url, :base_structure,
12
+ :commit_uri, :branch_uri, :file_uri,
13
+ :file_at_commit_uri, :compare_uri
14
+ ].each do |m|
15
+ define_method m do
16
+ raise MissingUrlStructure, "#{self.class} does not implement #{__method__}"
17
+ end
33
18
  end
34
19
 
35
20
  class MissingUrlStructure < StandardError
data/lib/asgit/url.rb CHANGED
@@ -39,6 +39,10 @@ module Asgit
39
39
  File.join( project, service.file_at_commit_uri % { file_path: file_path, commit: commit, line: line } )
40
40
  end
41
41
 
42
+ def compare ref_a, ref_b
43
+ File.join( project, service.compare_uri % { ref_a: ref_a, ref_b: ref_b })
44
+ end
45
+
42
46
  private
43
47
 
44
48
  def format_lines input
data/lib/asgit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Asgit
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -101,4 +101,13 @@ describe Asgit::Url do
101
101
  end
102
102
  end
103
103
 
104
+ describe "#compare" do
105
+ it "returns url for comparison with two commits" do
106
+ expect( subject.compare 'commit_sha_a', 'commit_sha_b' ).to eq 'https://github.com/stevenosloan/asgit/compare/commit_sha_a...commit_sha_b'
107
+ end
108
+ it "returns url for comparison with two branches" do
109
+ expect( subject.compare 'branch_a', 'branch_b' ).to eq 'https://github.com/stevenosloan/asgit/compare/branch_a...branch_b'
110
+ end
111
+ end
112
+
104
113
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Sloan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-03 00:00:00.000000000 Z
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: here_or_there
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  requirements: []
70
70
  rubyforge_project:
71
- rubygems_version: 2.2.0
71
+ rubygems_version: 2.4.2
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: A simple query interface for git