libdolt 0.17.0 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,10 +29,15 @@ module Dolt
29
29
 
30
30
  def all
31
31
  (Dir.entries(root).select do |e|
32
- File.exists?(File.join(root, e, ".git"))
32
+ git_repo?(e)
33
33
  end).sort
34
34
  end
35
35
 
36
+ def git_repo?(dir)
37
+ return true if dir.split(".").last == "git"
38
+ File.exists? File.join(root, dir, ".git")
39
+ end
40
+
36
41
  private
37
42
  def root; @root; end
38
43
  end
@@ -15,7 +15,6 @@
15
15
  # You should have received a copy of the GNU Affero General Public License
16
16
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  #++
18
- require "eventmachine"
19
18
 
20
19
  # Need consistent Time formatting in JSON
21
20
  require "time"
@@ -66,9 +65,7 @@ module Dolt
66
65
 
67
66
  def archive(repo, ref, format)
68
67
  repository = resolve_repository(repo)
69
- d = @archiver.archive(repository, ref, format)
70
- d.callback { |filename| block.call(nil, filename) }
71
- d.errback { |err| block.call(err, nil) }
68
+ @archiver.archive(repository, ref, format)
72
69
  end
73
70
 
74
71
  def repositories
@@ -17,5 +17,5 @@
17
17
  #++
18
18
 
19
19
  module Dolt
20
- VERSION = "0.17.0"
20
+ VERSION = "0.17.1"
21
21
  end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+ #--
3
+ # Copyright (C) 2013 Gitorious AS
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Affero General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ #++
18
+ require "test_helper"
19
+ require "fileutils"
20
+ describe Dolt::DiskRepoResolver do
21
+ before do
22
+ @root = FileUtils.mkdir_p("/tmp/libdolt-tests/")
23
+ FileUtils.mkdir_p(File.join(@root, "single/.git"))
24
+ @resolver = Dolt::DiskRepoResolver.new(@root)
25
+ end
26
+
27
+ after do
28
+ FileUtils.rm_f("/tmp/libdolt-tests")
29
+ end
30
+
31
+ it "resolves non-bare repositories" do
32
+ assert @resolver.git_repo?("single")
33
+ end
34
+
35
+ it "resolves bare repositories" do
36
+ assert @resolver.git_repo?("multi.git")
37
+ end
38
+
39
+ it "fails too" do
40
+ refute @resolver.git_repo?("nope")
41
+ end
42
+ 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.17.0
4
+ version: 0.17.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -229,6 +229,7 @@ files:
229
229
  - lib/libdolt/view/tree.rb
230
230
  - lib/libdolt/view/urls.rb
231
231
  - libdolt.gemspec
232
+ - test/libdolt/disk_repo_resolver_test.rb
232
233
  - test/libdolt/git/archiver_test.rb
233
234
  - test/libdolt/git/blame_test.rb
234
235
  - test/libdolt/git/commit_test.rb