stash-client 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/LICENSE.txt +1 -1
- data/lib/stash/client.rb +18 -1
- data/lib/stash/client/version.rb +1 -1
- data/spec/stash/client_spec.rb +7 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 366ade5c848ed2bf054a811a897c6507f37bc9c0
|
4
|
+
data.tar.gz: 4bc2f3fcb7dfc7bcefd6868a775d1148f7ba6d79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0120334e28567dae31f9670b7100d945e70121224ce69b6a1022bd2a1f56ff7cc4eb169e0492ad8c07e53a3dcd98a3f119921509b98f7fa361d5b8ec37454daa
|
7
|
+
data.tar.gz: b5447d17c342f5202da2b504ee47a1982fabd59916c05f9a504f1f19a36b0484424da4b128de008f5bbb6e3d772358ed1b3d4e80aa4b79a1496fc6928cd9b7cb
|
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
data/lib/stash/client.rb
CHANGED
@@ -57,7 +57,7 @@ module Stash
|
|
57
57
|
# default limit to 100 commits
|
58
58
|
query_values['limit'] = 100
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
uri.query_values = query_values
|
62
62
|
|
63
63
|
if query_values['limit'] && query_values['limit'] < 100
|
@@ -67,6 +67,23 @@ module Stash
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
def changes_for(repo, sha, opts = {})
|
71
|
+
path = remove_leading_slash repo.fetch('link').fetch('url').sub('browse', 'changes')
|
72
|
+
uri = @url.join(path)
|
73
|
+
|
74
|
+
query_values = { 'until' => sha }
|
75
|
+
query_values['since'] = opts[:parent] if opts[:parent]
|
76
|
+
query_values['limit'] = opts[:limit] if opts[:limit]
|
77
|
+
|
78
|
+
uri.query_values = query_values
|
79
|
+
|
80
|
+
if query_values['limit']
|
81
|
+
fetch(uri).fetch('values')
|
82
|
+
else
|
83
|
+
fetch_all(uri)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
70
87
|
private
|
71
88
|
|
72
89
|
def fetch_all(uri)
|
data/lib/stash/client/version.rb
CHANGED
data/spec/stash/client_spec.rb
CHANGED
@@ -30,6 +30,13 @@ module Stash
|
|
30
30
|
client.commits_for({'link' => {'url' => '/repos/foo/browse'}}).should == [{'key' => 'value'}]
|
31
31
|
end
|
32
32
|
|
33
|
+
it 'feches changes' do
|
34
|
+
stub_request(:get, 'foo:bar@git.example.com/rest/api/1.0/projects/foo/repos/bar/changes?limit=100&until=deadbeef').to_return(body: response_with_value('key' => 'value'))
|
35
|
+
|
36
|
+
repo = {'link' => {'url' => '/projects/foo/repos/bar/browse'}}
|
37
|
+
client.changes_for(repo, 'deadbeef', limit: 100).should == [{'key' => 'value'}]
|
38
|
+
end
|
39
|
+
|
33
40
|
it 'respects since/until when fetching commits' do
|
34
41
|
stub_request(:get, 'foo:bar@git.example.com/rest/api/1.0/repos/foo/commits?since=cafebabe&until=deadbeef').to_return(body: response_with_value('key' => 'value'))
|
35
42
|
client.commits_for({'link' => {'url' => '/repos/foo/browse'}}, since: 'cafebabe', until: 'deadbeef').should == [{'key' => 'value'}]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stash-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,11 +133,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.0.14
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Atlassian Stash Client
|
140
140
|
test_files:
|
141
141
|
- spec/spec_helper.rb
|
142
142
|
- spec/stash/client_spec.rb
|
143
|
-
has_rdoc:
|