rjgit_grack 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +16 -9
- data/lib/rjgit_grack.rb +28 -38
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84344229b7966b8960708f9ca83b982ec60de07c
|
4
|
+
data.tar.gz: ddb642960dc5175ac9de200260beec3a00f63bf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f7f0d798f28ec5cfb730ec7b5f694d2c692a43e8e18a1c1f595b472122a2aa527fa374faaa96e813e0b26e93a7fb8d3390b7385865055844e5b38eca839ec09
|
7
|
+
data.tar.gz: 4565154688cea2e309af64fbbe89f30b5394ab84d908150ac38c1bc7c71b60224f29827d578afb9fd4ebbf3ca6bacc6583786489ad4549255f8b2b4b43f7c90c
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
rjgit_grack
|
2
2
|
===========
|
3
3
|
[](http://badge.fury.io/rb/rjgit_grack)
|
4
|
-
[](https://travis-ci.org/
|
5
|
-
[](https://gemnasium.com/
|
4
|
+
[](https://travis-ci.org/grackorg/rjgit_grack)
|
5
|
+
[](https://gemnasium.com/grackorg/rjgit_grack)
|
6
6
|
|
7
|
-
Alternative Adapter for [grack](http://github.com/
|
7
|
+
Alternative Adapter for [grack](http://github.com/grackorg/grack); uses the [RJGit](http://github.com/repotag/rjgit) gem for a pure jruby interface to git repos. Together with Grack, this yields a pure jruby implementation of git's smart-http protocol.
|
8
8
|
|
9
9
|
Installation
|
10
10
|
===========
|
@@ -15,14 +15,21 @@ Usage
|
|
15
15
|
===========
|
16
16
|
|
17
17
|
1. Get grack.
|
18
|
-
2. After requiring `rjgit_grack.rb`, you can tell Grack to use the `RJGitAdapter` by editing its configuration,
|
18
|
+
2. After requiring `rjgit_grack.rb`, you can tell Grack to use the `RJGitAdapter` by editing its configuration, for example:
|
19
19
|
|
20
20
|
```ruby
|
21
|
+
require 'grack/app'
|
22
|
+
require 'grack/git_adapter'
|
23
|
+
require 'rjgit_grack'
|
24
|
+
|
21
25
|
config = {
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
26
|
+
:root => '/path/to/bare/repositories',
|
27
|
+
:allow_push => true,
|
28
|
+
:allow_pull => true,
|
29
|
+
:git_adapter_factory => ->{ Grack::RJGitAdapter.new }
|
25
30
|
}
|
31
|
+
|
32
|
+
run Grack::App.new(config)
|
26
33
|
```
|
27
34
|
|
28
35
|
Specs
|
@@ -35,8 +42,8 @@ Run the specs:
|
|
35
42
|
Dependencies
|
36
43
|
===========
|
37
44
|
|
38
|
-
- [Grack](http://github.com/
|
39
|
-
- The [RJGit](http://github.com/repotag/rjgit) gem, which requires
|
45
|
+
- [Grack](http://github.com/grackorg/grack) >= 0.1.0.pre
|
46
|
+
- The [RJGit](http://github.com/repotag/rjgit) gem, which requires JRuby
|
40
47
|
|
41
48
|
License
|
42
49
|
========================
|
data/lib/rjgit_grack.rb
CHANGED
@@ -2,63 +2,53 @@ require "rjgit"
|
|
2
2
|
|
3
3
|
module Grack
|
4
4
|
|
5
|
-
class RJGitAdapter
|
5
|
+
class RJGitAdapter < GitAdapter
|
6
6
|
|
7
|
-
def
|
8
|
-
|
7
|
+
def initialize
|
8
|
+
@repository_path = nil
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
pack = case
|
13
|
-
when
|
14
|
-
RJGit::RJGitUploadPack.new(repo
|
15
|
-
when
|
16
|
-
RJGit::RJGitReceivePack.new(repo
|
17
|
-
else
|
18
|
-
nil
|
11
|
+
def handle_pack(pack_type, io_in, io_out, opts = {})
|
12
|
+
pack = case pack_type
|
13
|
+
when 'git-upload-pack'
|
14
|
+
RJGit::RJGitUploadPack.new(repo)
|
15
|
+
when 'git-receive-pack'
|
16
|
+
RJGit::RJGitReceivePack.new(repo)
|
19
17
|
end
|
20
18
|
return nil unless pack
|
21
19
|
if opts[:advertise_refs] then
|
22
|
-
|
20
|
+
io_out.write advertisement_prefix(pack_type)
|
21
|
+
result = pack.advertise_refs
|
23
22
|
else
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
yield result
|
28
|
-
else
|
29
|
-
return result.read
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def upload_pack(repository_path, opts = {}, &block)
|
35
|
-
self.service_command(:upload_pack, repository_path, opts, &block)
|
36
|
-
end
|
37
|
-
|
38
|
-
def receive_pack(repository_path, opts = {}, &block)
|
39
|
-
self.service_command(:receive_pack, repository_path, opts, &block)
|
23
|
+
result = pack.process(io_in.read).first.read
|
24
|
+
end
|
25
|
+
io_out.write(result)
|
40
26
|
end
|
41
|
-
|
42
|
-
def update_server_info
|
43
|
-
repo
|
27
|
+
|
28
|
+
def update_server_info
|
29
|
+
repo.update_server_info
|
44
30
|
end
|
45
31
|
|
46
|
-
def
|
47
|
-
repository = repo(repository_path)
|
48
|
-
domains = key.split(".")
|
32
|
+
def config(key)
|
49
33
|
begin
|
50
|
-
|
34
|
+
settings = repo.config
|
51
35
|
rescue
|
52
36
|
return nil
|
53
37
|
end
|
54
|
-
|
38
|
+
key.split(".").each do |domain|
|
55
39
|
begin
|
56
|
-
|
40
|
+
settings = settings[domain]
|
57
41
|
rescue
|
58
42
|
return nil
|
59
43
|
end
|
60
44
|
end
|
61
|
-
|
45
|
+
settings.is_a?(Hash) ? settings : settings.to_s
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def repo
|
51
|
+
RJGit::Repo.new(repository_path)
|
62
52
|
end
|
63
53
|
|
64
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjgit_grack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dawa Ometto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rjgit
|
@@ -16,15 +16,15 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
19
|
+
version: '4.0'
|
20
20
|
requirement: !ruby/object:Gem::Requirement
|
21
21
|
requirements:
|
22
22
|
- - ~>
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: '0
|
24
|
+
version: '4.0'
|
25
25
|
prerelease: false
|
26
26
|
type: :runtime
|
27
|
-
description: Alternative Adapter for grack; uses the RJGit gem for a pure jruby interface to git repos. Together with Grack, this yields a pure
|
27
|
+
description: Alternative Adapter for grack; uses the RJGit gem for a pure jruby interface to git repos. Together with Grack, this yields a pure JRuby implementation of git's smart-http protocol.
|
28
28
|
email: d.ometto@gmail.com
|
29
29
|
executables: []
|
30
30
|
extensions: []
|
@@ -34,7 +34,7 @@ files:
|
|
34
34
|
- LICENSE
|
35
35
|
- README.md
|
36
36
|
- lib/rjgit_grack.rb
|
37
|
-
homepage: http://github.com/
|
37
|
+
homepage: http://github.com/grackorg/rjgit_grack
|
38
38
|
licenses:
|
39
39
|
- MIT
|
40
40
|
metadata: {}
|
@@ -57,5 +57,5 @@ rubyforge_project:
|
|
57
57
|
rubygems_version: 2.4.5
|
58
58
|
signing_key:
|
59
59
|
specification_version: 4
|
60
|
-
summary: Adapts grack (http://github.com/
|
60
|
+
summary: Adapts grack (http://github.com/grackorg/grack) to use JGit.
|
61
61
|
test_files: []
|