rjgit_grack 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c120bee899ad48c317673385f483c4bf782f4462
4
+ data.tar.gz: b3a4605897c893252bede1547f0a27b4d2d88bc7
5
+ SHA512:
6
+ metadata.gz: 86a8ec1ada212e5b94d9507ac5c4f7fd7f2f4677593492fc8dc6998cd0c90dadad8c3b91b5b53f0fdab3f4d862c4bdac6270c7cb63b1a873315d50ff9fefb6c9
7
+ data.tar.gz: 776bc8fda334167d6b84f497c49134a7fe0727bbddceb4ba0e436c5cf952972a28b201afd3bdda7ed90f13d3f5e8fb730cf21b51d8a65f3e436e664b7d9beb44
data/Gemfile CHANGED
@@ -1,10 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rjgit'
3
+ gem 'rake'
4
4
  gem 'coveralls', require: false
5
5
 
6
6
  group :test do
7
7
  gem "test"
8
8
  gem "mocha"
9
- gem "rcov"
9
+ gem "simplecov", :require => false
10
10
  end
11
+
12
+ gemspec
data/README.md CHANGED
@@ -1,18 +1,21 @@
1
1
  rjgit_grack
2
2
  ===========
3
+ [![Gem Version](https://badge.fury.io/rb/rjgit_grack.svg)](http://badge.fury.io/rb/rjgit_grack)
4
+ [![Build Status](https://travis-ci.org/dometto/rjgit_grack.svg?branch=master)](https://travis-ci.org/dometto/rjgit_grack)
5
+ [![Dependency Status](https://gemnasium.com/dometto/rjgit_grack.svg)](https://gemnasium.com/dometto/rjgit_grack)
3
6
 
4
7
  Alternative Adapter for [grack](http://github.com/schacon/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.
5
8
 
6
9
  Installation
7
10
  ===========
8
11
 
9
- $ gem install rjgit_grack
12
+ `gem install rjgit_grack`
10
13
 
11
14
  Usage
12
15
  ===========
13
16
 
14
17
  1. Get grack.
15
- 2. After requiring rjgit_adapter.rb, you can tell Grack to use the RJGitAdapter by editing its configuration, like so:
18
+ 2. After requiring `rjgit_grack.rb`, you can tell Grack to use the `RJGitAdapter` by editing its configuration, like so:
16
19
 
17
20
  ```ruby
18
21
  config = {
@@ -22,6 +25,13 @@ config = {
22
25
  }
23
26
  ```
24
27
 
28
+ Specs
29
+ ======
30
+
31
+ Run the specs:
32
+
33
+ `rake`
34
+
25
35
  Dependencies
26
36
  ===========
27
37
 
data/lib/rjgit_grack.rb CHANGED
@@ -1 +1,66 @@
1
- require "rjgit_adapter.rb"
1
+ require "rjgit"
2
+
3
+ module Grack
4
+
5
+ class RJGitAdapter
6
+
7
+ def repo(repository_path)
8
+ RJGit::Repo.new(repository_path)
9
+ end
10
+
11
+ def service_command(cmd, repository_path, opts = {}, &block)
12
+ pack = case cmd
13
+ when :upload_pack
14
+ RJGit::RJGitUploadPack.new(repo repository_path)
15
+ when :receive_pack
16
+ RJGit::RJGitReceivePack.new(repo repository_path)
17
+ else
18
+ nil
19
+ end
20
+ return nil unless pack
21
+ if opts[:advertise_refs] then
22
+ return pack.advertise_refs
23
+ else
24
+ msg = opts.has_key?(:msg) ? opts[:msg] : ""
25
+ result, err = pack.process(msg)
26
+ if block_given? then
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)
40
+ end
41
+
42
+ def update_server_info(repository_path, opts = {}, &block)
43
+ repo(repository_path).update_server_info
44
+ end
45
+
46
+ def get_config_setting(repository_path, key)
47
+ repository = repo(repository_path)
48
+ domains = key.split(".")
49
+ begin
50
+ loop_settings = repository.config
51
+ rescue
52
+ return nil
53
+ end
54
+ domains.each do |domain|
55
+ begin
56
+ loop_settings = loop_settings[domain]
57
+ rescue
58
+ return nil
59
+ end
60
+ end
61
+ return loop_settings.is_a?(Hash) ? loop_settings : loop_settings.to_s
62
+ end
63
+
64
+ end
65
+
66
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjgit_grack
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.4
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dawa Ometto
@@ -15,18 +14,14 @@ dependencies:
15
14
  name: rjgit
16
15
  version_requirements: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - ">="
17
+ - - ~>
19
18
  - !ruby/object:Gem::Version
20
- version: !binary |-
21
- MA==
22
- none: false
19
+ version: '0.3'
23
20
  requirement: !ruby/object:Gem::Requirement
24
21
  requirements:
25
- - - ">="
22
+ - - ~>
26
23
  - !ruby/object:Gem::Version
27
- version: !binary |-
28
- MA==
29
- none: false
24
+ version: '0.3'
30
25
  prerelease: false
31
26
  type: :runtime
32
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.
@@ -35,36 +30,32 @@ executables: []
35
30
  extensions: []
36
31
  extra_rdoc_files: []
37
32
  files:
38
- - lib/rjgit_grack.rb
39
- - lib/rjgit_adapter.rb
40
- - README.md
41
- - LICENSE
42
33
  - Gemfile
34
+ - LICENSE
35
+ - README.md
36
+ - lib/rjgit_grack.rb
43
37
  homepage: http://github.com/dometto/rjgit_grack
44
38
  licenses:
45
39
  - MIT
40
+ metadata: {}
46
41
  post_install_message:
47
42
  rdoc_options: []
48
43
  require_paths:
49
44
  - lib
50
45
  required_ruby_version: !ruby/object:Gem::Requirement
51
46
  requirements:
52
- - - ">="
47
+ - - '>='
53
48
  - !ruby/object:Gem::Version
54
- version: !binary |-
55
- MA==
56
- none: false
49
+ version: '0'
57
50
  required_rubygems_version: !ruby/object:Gem::Requirement
58
51
  requirements:
59
- - - ">="
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
- version: !binary |-
62
- MA==
63
- none: false
54
+ version: '0'
64
55
  requirements: []
65
56
  rubyforge_project:
66
- rubygems_version: 1.8.24
57
+ rubygems_version: 2.4.5
67
58
  signing_key:
68
- specification_version: 3
59
+ specification_version: 4
69
60
  summary: Adapts grack (http://github.com/schacon/grack) to use JGit.
70
61
  test_files: []
data/lib/rjgit_adapter.rb DELETED
@@ -1,66 +0,0 @@
1
- require "rjgit"
2
-
3
- module Grack
4
-
5
- class RJGitAdapter
6
-
7
- def repo(repository_path)
8
- RJGit::Repo.new(repository_path)
9
- end
10
-
11
- def service_command(cmd, repository_path, opts = {}, &block)
12
- pack = case cmd
13
- when :upload_pack
14
- RJGit::RJGitUploadPack.new(repo repository_path)
15
- when :receive_pack
16
- RJGit::RJGitReceivePack.new(repo repository_path)
17
- else
18
- nil
19
- end
20
- return nil unless pack
21
- if opts[:advertise_refs] then
22
- return pack.advertise_refs
23
- else
24
- msg = opts.has_key?(:msg) ? opts[:msg] : ""
25
- result, err = pack.process(msg)
26
- if block_given? then
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)
40
- end
41
-
42
- def update_server_info(repository_path, opts = {}, &block)
43
- repo(repository_path).update_server_info
44
- end
45
-
46
- def get_config_setting(repository_path, key)
47
- repository = repo(repository_path)
48
- domains = key.split(".")
49
- begin
50
- loop_settings = repository.config
51
- rescue
52
- return nil
53
- end
54
- domains.each do |domain|
55
- begin
56
- loop_settings = loop_settings[domain]
57
- rescue
58
- return nil
59
- end
60
- end
61
- return loop_settings.is_a?(Hash) ? loop_settings : loop_settings.to_s
62
- end
63
-
64
- end
65
-
66
- end