libdolt 0.24.0 → 0.25.0
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.
data/Gemfile.lock
CHANGED
data/lib/libdolt.rb
CHANGED
@@ -21,18 +21,24 @@ require "time"
|
|
21
21
|
class Time; def to_json(*args); "\"#{iso8601}\""; end; end
|
22
22
|
|
23
23
|
module Dolt
|
24
|
-
class
|
24
|
+
class RepositoryLookup
|
25
25
|
def initialize(repo_resolver, archiver = nil)
|
26
26
|
@repo_resolver = repo_resolver
|
27
27
|
@archiver = archiver
|
28
28
|
end
|
29
29
|
|
30
30
|
def blob(repo, ref, path)
|
31
|
-
|
31
|
+
repository = resolve_repository(repo)
|
32
|
+
tpl_data(repository, ref, path, {
|
33
|
+
:blob => repository.rev_parse("#{ref}:#{path}")
|
34
|
+
})
|
32
35
|
end
|
33
36
|
|
34
37
|
def tree(repo, ref, path)
|
35
|
-
|
38
|
+
repository = resolve_repository(repo)
|
39
|
+
tpl_data(repository, ref, path, {
|
40
|
+
:tree => repository.tree(ref, path)
|
41
|
+
}).merge(:readme => readme(repo, ref, path))
|
36
42
|
end
|
37
43
|
|
38
44
|
def tree_entry(repo, ref, path)
|
@@ -45,11 +51,17 @@ module Dolt
|
|
45
51
|
end
|
46
52
|
|
47
53
|
def blame(repo, ref, path)
|
48
|
-
|
54
|
+
repository = resolve_repository(repo)
|
55
|
+
tpl_data(repository, ref, path, {
|
56
|
+
:blame => repository.blame(ref, path)
|
57
|
+
})
|
49
58
|
end
|
50
59
|
|
51
60
|
def history(repo, ref, path, count)
|
52
|
-
|
61
|
+
repository = resolve_repository(repo)
|
62
|
+
tpl_data(repository, ref, path, {
|
63
|
+
:commits => repository.log(ref, path, count)
|
64
|
+
})
|
53
65
|
end
|
54
66
|
|
55
67
|
def refs(repo)
|
@@ -62,7 +74,10 @@ module Dolt
|
|
62
74
|
end
|
63
75
|
|
64
76
|
def tree_history(repo, ref, path, count)
|
65
|
-
|
77
|
+
repository = resolve_repository(repo)
|
78
|
+
tpl_data(repository, ref, path, {
|
79
|
+
:tree => repository.tree_history(ref, path, count)
|
80
|
+
})
|
66
81
|
end
|
67
82
|
|
68
83
|
def archive(repo, ref, format)
|
@@ -85,14 +100,6 @@ module Dolt
|
|
85
100
|
private
|
86
101
|
def repo_resolver; @repo_resolver; end
|
87
102
|
|
88
|
-
def repo_action(repo, ref, path, data, method, *args)
|
89
|
-
repository = resolve_repository(repo)
|
90
|
-
|
91
|
-
tpl_data(repository, ref, path, {
|
92
|
-
data => repository.send(method, *args)
|
93
|
-
})
|
94
|
-
end
|
95
|
-
|
96
103
|
def tpl_data(repo, ref, path, locals = {})
|
97
104
|
{ :path => path,
|
98
105
|
:ref => ref }.merge(repo.to_hash).merge(locals)
|
data/lib/libdolt/version.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
17
|
#++
|
18
18
|
require "test_helper"
|
19
|
-
require "libdolt/
|
19
|
+
require "libdolt/repository_lookup"
|
20
20
|
require "ostruct"
|
21
21
|
require "mocha/setup"
|
22
22
|
|
@@ -41,15 +41,15 @@ class MetaResolver < Resolver
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
describe Dolt::
|
44
|
+
describe Dolt::RepositoryLookup do
|
45
45
|
before do
|
46
46
|
@resolver = Resolver.new
|
47
|
-
@
|
47
|
+
@lookup = Dolt::RepositoryLookup.new(@resolver)
|
48
48
|
end
|
49
49
|
|
50
50
|
describe "#blob" do
|
51
51
|
it "returns path, blob, repo, ref and base_tree_url" do
|
52
|
-
data = @
|
52
|
+
data = @lookup.blob("gitorious", "fc5f5fb50b435e18", "lib/foo.rb")
|
53
53
|
assert_equal "gitorious", data[:repository_slug]
|
54
54
|
assert_equal "fc5f5fb50b435e18", data[:ref]
|
55
55
|
assert Rugged::Blob === data[:blob]
|
@@ -58,7 +58,7 @@ describe Dolt::RepoActions do
|
|
58
58
|
|
59
59
|
describe "#tree" do
|
60
60
|
it "returns tree, repo and ref" do
|
61
|
-
data = @
|
61
|
+
data = @lookup.tree("gitorious", "fc5f5fb50b435e18", "lib")
|
62
62
|
repo = @resolver.resolved.last
|
63
63
|
assert_equal "264c348a80906538018616fa16fc35d04bdf38b0", data[:tree].oid
|
64
64
|
assert_equal "fc5f5fb50b435e18", data[:ref]
|
@@ -70,7 +70,7 @@ describe Dolt::RepoActions do
|
|
70
70
|
it "includes readmes which can be rendered" do
|
71
71
|
readme_name = "README.org"
|
72
72
|
Makeup::Markup.stubs(:can_render?).with(readme_name).returns(true)
|
73
|
-
data = @
|
73
|
+
data = @lookup.tree("gitorious","fc5f5fb50b435e18","")
|
74
74
|
repo = @resolver.resolved.last
|
75
75
|
assert_equal "#{readme_name}", data[:readme][:path]
|
76
76
|
end
|
@@ -78,13 +78,13 @@ describe Dolt::RepoActions do
|
|
78
78
|
|
79
79
|
describe "#tree_entry" do
|
80
80
|
it "returns tree, repo and ref" do
|
81
|
-
data = @
|
81
|
+
data = @lookup.tree_entry("gitorious", "fc5f5fb50b435e18", "")
|
82
82
|
repo = @resolver.resolved.last
|
83
83
|
assert_equal :tree, data[:type]
|
84
84
|
end
|
85
85
|
|
86
86
|
it "returns blob, repo and ref" do
|
87
|
-
data = @
|
87
|
+
data = @lookup.tree_entry("gitorious", "fc5f5fb50b435e18", "lib/foo.rb")
|
88
88
|
|
89
89
|
assert_equal "lib/foo.rb", data[:path]
|
90
90
|
assert_equal "fc5f5fb50b435e18", data[:ref]
|
@@ -94,12 +94,12 @@ describe Dolt::RepoActions do
|
|
94
94
|
|
95
95
|
describe "#blame" do
|
96
96
|
it "resolves repository" do
|
97
|
-
@
|
97
|
+
@lookup.blame("gitorious", "master", "lib")
|
98
98
|
assert_equal 1, @resolver.resolved.size
|
99
99
|
end
|
100
100
|
|
101
101
|
it "returns blame, repo and ref" do
|
102
|
-
data = @
|
102
|
+
data = @lookup.blame("gitorious", "fc5f5fb50b435e18", "lib")
|
103
103
|
assert Dolt::Git::Blame === data[:blame]
|
104
104
|
assert_equal "gitorious", data[:repository_slug]
|
105
105
|
assert_equal "fc5f5fb50b435e18", data[:ref]
|
@@ -109,7 +109,7 @@ describe Dolt::RepoActions do
|
|
109
109
|
|
110
110
|
describe "#history" do
|
111
111
|
it "returns commits, repo and ref" do
|
112
|
-
data = @
|
112
|
+
data = @lookup.history("gitorious", "fc5f5fb50b435e18", "app", 2)
|
113
113
|
|
114
114
|
assert_equal({
|
115
115
|
:commits => [],
|
@@ -122,7 +122,7 @@ describe Dolt::RepoActions do
|
|
122
122
|
|
123
123
|
describe "#refs" do
|
124
124
|
it "returns repositories, tags and heads" do
|
125
|
-
data = @
|
125
|
+
data = @lookup.refs("gitorious")
|
126
126
|
|
127
127
|
assert data[:tags].detect {|name, ref|
|
128
128
|
name == "testable-tag" && ref == "fc5f5fb50b435e183925b341909610aace90a413"
|
@@ -132,7 +132,7 @@ describe Dolt::RepoActions do
|
|
132
132
|
|
133
133
|
describe "#tree_history" do
|
134
134
|
it "returns repository, path, ref and history" do
|
135
|
-
data = @
|
135
|
+
data = @lookup.tree_history("gitorious", "testable-tag", "", 1)
|
136
136
|
assert_equal "testable-tag", data[:ref]
|
137
137
|
assert_equal 2, data[:tree].length
|
138
138
|
assert_equal "", data[:path]
|
@@ -142,8 +142,8 @@ describe Dolt::RepoActions do
|
|
142
142
|
describe "repository meta data" do
|
143
143
|
it "is returned with other data" do
|
144
144
|
resolver = MetaResolver.new
|
145
|
-
|
146
|
-
data =
|
145
|
+
lookup = Dolt::RepositoryLookup.new(resolver)
|
146
|
+
data = lookup.blob("gitorious", "fc5f5fb50b435e18", "lib")
|
147
147
|
|
148
148
|
assert_equal "Meta data is cool", data[:repository_meta]
|
149
149
|
end
|
@@ -152,7 +152,7 @@ describe Dolt::RepoActions do
|
|
152
152
|
describe "#rev_parse_oid" do
|
153
153
|
it "resolves ref oid" do
|
154
154
|
oid = "fc5f5fb50b435e183925b341909610aace90a413"
|
155
|
-
assert_equal oid, @
|
155
|
+
assert_equal oid, @lookup.rev_parse_oid("gitorious", "testable-tag")
|
156
156
|
end
|
157
157
|
end
|
158
158
|
end
|
data/views/commits.erb
CHANGED
@@ -35,11 +35,11 @@
|
|
35
35
|
<%= commit[:summary] %>
|
36
36
|
</p>
|
37
37
|
<p>
|
38
|
-
<
|
38
|
+
<span class="gts-commit-author">
|
39
39
|
<img width="24" height="24" src="<%= gravatar(commit[:author][:email]) %>" alt="avatar" class="gts-avatar">
|
40
40
|
<%= commit[:author][:name] %>
|
41
|
-
</
|
42
|
-
<span class="
|
41
|
+
</span>
|
42
|
+
<span class="gts-commit-time"><%= commit[:date].strftime("%H:%M") %></span>
|
43
43
|
</p>
|
44
44
|
</div>
|
45
45
|
<% end %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libdolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rugged
|
@@ -211,7 +211,7 @@ files:
|
|
211
211
|
- lib/libdolt/git/submodule.rb
|
212
212
|
- lib/libdolt/git/tree.rb
|
213
213
|
- lib/libdolt/gitorious_repo_resolver.rb
|
214
|
-
- lib/libdolt/
|
214
|
+
- lib/libdolt/repository_lookup.rb
|
215
215
|
- lib/libdolt/version.rb
|
216
216
|
- lib/libdolt/view.rb
|
217
217
|
- lib/libdolt/view/binary_blob_embedder.rb
|
@@ -254,7 +254,7 @@ files:
|
|
254
254
|
- test/libdolt/git/blame_test.rb
|
255
255
|
- test/libdolt/git/commit_test.rb
|
256
256
|
- test/libdolt/git/repository_test.rb
|
257
|
-
- test/libdolt/
|
257
|
+
- test/libdolt/repository_lookup_test.rb
|
258
258
|
- test/libdolt/templates/blame_test.rb
|
259
259
|
- test/libdolt/templates/blob_test.rb
|
260
260
|
- test/libdolt/templates/commits_test.rb
|