dtk-common 0.5.14 → 0.5.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/lib/dtk-common/version.rb +1 -1
- data/lib/gitolite/grit/adapter.rb +17 -17
- data/lib/gitolite/repo.rb +5 -4
- data/lib/grit_adapter.rb +7 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
N2I5MWQxMzAwMWI0MjdjNTEwNjc3NjhkYjU5OTliMTFiMjYxMjk2NQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2ZhODkzZjNhOTI3ODk4MGE5M2FiMzJjMGYwMDIwYThlYTRlYmFiMg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDk3ZjRlMGExNTE2MWEyYTg5NDkzOGE3MzI5OTY3NDFlYjM3MDU2OTUxYmM2
|
10
|
+
ZmQ3OWZmZGEwMjFkOWY3Nzg3YzhlZDVmMzdhMDI4NWIwOWUzOGRhMjQ0NDYx
|
11
|
+
YzgyNmU2ZTJiZTY4ZDk5NGY0Y2YxYmQ0NmQxMTBkNTUxMDE1NDg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MmJhZmE0YTk0M2JhOGE3OThmODI3NWUwNDA0Y2M2NGQ4MmUyMzg1OThjNDJm
|
14
|
+
MTlmNGY5ZWNlMzlmYTE4MTNmNzcwNDI5OGVjMzFlMjJhMmU5Yjk1YWZkZmU5
|
15
|
+
NmJhZTRhOWVlMzc5NDQxZGY5YjJjODY3NzhiZWU4ZmFiMTVhMWU=
|
data/lib/dtk-common/version.rb
CHANGED
@@ -3,9 +3,9 @@ require 'grit'
|
|
3
3
|
module Gitolite
|
4
4
|
module Git
|
5
5
|
class Adapter
|
6
|
-
|
6
|
+
|
7
7
|
DEFAULT_BRANCH = 'master'
|
8
|
-
|
8
|
+
|
9
9
|
def initialize(repo_dir,branch=DEFAULT_BRANCH)
|
10
10
|
@repo_dir = repo_dir
|
11
11
|
@branch = branch
|
@@ -20,53 +20,53 @@ module Gitolite
|
|
20
20
|
raise e
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def branches()
|
25
25
|
@grit_repo.branches.map{|h|h.name}
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def ls_r(depth=nil,opts={})
|
29
29
|
tree_contents = tree.contents
|
30
30
|
ls_r_aux(depth,tree_contents,opts)
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def path_exists?(path)
|
34
34
|
not (tree/path).nil?
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
def file_content(path)
|
38
38
|
tree_or_blob = tree/path
|
39
39
|
tree_or_blob && tree_or_blob.kind_of?(::Grit::Blob) && tree_or_blob.data
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
def push()
|
43
|
-
Git_command__push_mutex.synchronize do
|
43
|
+
Git_command__push_mutex.synchronize do
|
44
44
|
git_command(:push,"origin", "#{@branch}:refs/heads/#{@branch}")
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def push_to_mirror_repo(mirror_repo)
|
49
49
|
git_command(:push,"--mirror",mirror_repo)
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
Git_command__push_mutex = Mutex.new
|
53
|
-
|
53
|
+
|
54
54
|
def pull()
|
55
55
|
git_command(:pull,"origin",@branch)
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
private
|
59
59
|
def tree()
|
60
60
|
@grit_repo.tree(@branch)
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
def ls_r_aux(depth,tree_contents,opts={})
|
64
64
|
ret = Array.new
|
65
65
|
return ret if tree_contents.empty?
|
66
66
|
if depth == 1
|
67
67
|
ret = tree_contents.map do |tc|
|
68
68
|
if opts[:file_only]
|
69
|
-
tc.kind_of?(::Grit::Blob) && tc.name
|
69
|
+
tc.kind_of?(::Grit::Blob) && tc.name
|
70
70
|
elsif opts[:directory_only]
|
71
71
|
tc.kind_of?(::Grit::Tree) && tc.name
|
72
72
|
else
|
@@ -75,7 +75,7 @@ module Gitolite
|
|
75
75
|
end.compact
|
76
76
|
return ret
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
tree_contents.each do |tc|
|
80
80
|
if tc.kind_of?(::Grit::Blob)
|
81
81
|
unless opts[:directory_only]
|
@@ -88,14 +88,14 @@ module Gitolite
|
|
88
88
|
end
|
89
89
|
ret
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def git_command(cmd,*args)
|
93
93
|
@grit_repo.git.send(cmd, cmd_opts(),*args)
|
94
94
|
end
|
95
95
|
def cmd_opts()
|
96
96
|
{:raise => true, :timeout => 60}
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
data/lib/gitolite/repo.rb
CHANGED
@@ -7,8 +7,9 @@ module Gitolite
|
|
7
7
|
include Utils
|
8
8
|
|
9
9
|
attr_accessor :repo_name, :rights_hash, :commit_messages, :user_groups, :logger
|
10
|
+
attr_reader :repo_dir_path
|
10
11
|
|
11
|
-
GIOLITE_ALL_GROUP = '@all'
|
12
|
+
GIOLITE_ALL_GROUP = '@all'
|
12
13
|
|
13
14
|
#
|
14
15
|
# We check if there are users in addition to tenant with line,
|
@@ -38,7 +39,7 @@ module Gitolite
|
|
38
39
|
|
39
40
|
def initialize(repo_name, configuration_, logger_, gitolite_path, gitolite_branch="master")
|
40
41
|
# IMPORTANT! Tenants user are always included with each module
|
41
|
-
|
42
|
+
|
42
43
|
@rights_hash = { 'R' => [], 'W' => [], 'RW' => ['@tenants'], 'RW+' => []}
|
43
44
|
@repo_name = repo_name
|
44
45
|
@user_groups = []
|
@@ -50,7 +51,7 @@ module Gitolite
|
|
50
51
|
|
51
52
|
if exists?
|
52
53
|
load_repo()
|
53
|
-
end
|
54
|
+
end
|
54
55
|
end
|
55
56
|
|
56
57
|
def rights_for_username(username)
|
@@ -88,7 +89,7 @@ module Gitolite
|
|
88
89
|
|
89
90
|
@rights_hash[access_rights.upcase] << username
|
90
91
|
@commit_messages << "Added access rights ('#{access_rights}') for user/group '#{username}', in repo '#{@repo_name}'"
|
91
|
-
|
92
|
+
|
92
93
|
# add to user groups if user group is added
|
93
94
|
if username.match(/^@/)
|
94
95
|
@user_groups << username
|
data/lib/grit_adapter.rb
CHANGED
@@ -7,7 +7,7 @@ module DTK
|
|
7
7
|
module Common
|
8
8
|
|
9
9
|
require File.expand_path('require_first',File.dirname(__FILE__))
|
10
|
-
class GritAdapter
|
10
|
+
class GritAdapter
|
11
11
|
require File.expand_path('grit_adapter/file_access', File.dirname(__FILE__))
|
12
12
|
require File.expand_path('grit_adapter/object_access', File.dirname(__FILE__))
|
13
13
|
def initialize(repo_dir,branch=nil,opts={})
|
@@ -39,7 +39,7 @@ module DTK
|
|
39
39
|
end
|
40
40
|
clone_cmd_opts = {:raise => true, :timeout => 60}
|
41
41
|
clone_args = [git_server_url,target_repo_dir]
|
42
|
-
if branch = opts[:branch]
|
42
|
+
if branch = opts[:branch]
|
43
43
|
clone_args += ["-b",branch]
|
44
44
|
end
|
45
45
|
::Grit::Git.new("").clone(clone_cmd_opts,*clone_args)
|
@@ -79,14 +79,14 @@ module DTK
|
|
79
79
|
|
80
80
|
def push(remote_branch_ref=nil)
|
81
81
|
remote_repo,remote_branch = parse_remote_branch_ref(remote_branch_ref)
|
82
|
-
Git_command__push_mutex.synchronize do
|
82
|
+
Git_command__push_mutex.synchronize do
|
83
83
|
git_command(:push,remote_repo||"origin", "#{@branch}:refs/heads/#{remote_branch||@branch}")
|
84
84
|
end
|
85
85
|
end
|
86
86
|
Git_command__push_mutex = Mutex.new
|
87
87
|
#returns [remote_repo,remote_branch]
|
88
88
|
def parse_remote_branch_ref(remote_branch_ref)
|
89
|
-
if remote_branch_ref
|
89
|
+
if remote_branch_ref
|
90
90
|
split = remote_branch_ref.split("/")
|
91
91
|
case split.size
|
92
92
|
when 1 then [nil,split[0]]
|
@@ -116,7 +116,7 @@ module DTK
|
|
116
116
|
|
117
117
|
def create_for_existing_repo(repo_dir,opts={})
|
118
118
|
unless File.exists?("#{repo_dir}/.git")
|
119
|
-
raise DTK::Client::DtkError, "#{repo_dir} does not contain .git folder."
|
119
|
+
raise DTK::Client::DtkError, "#{repo_dir} does not contain .git folder."
|
120
120
|
end
|
121
121
|
::Grit::Repo.new(repo_dir)
|
122
122
|
end
|
@@ -141,7 +141,7 @@ module DTK
|
|
141
141
|
def ret_config_keys()
|
142
142
|
::Grit::Config.new(@grit_repo).keys
|
143
143
|
end
|
144
|
-
|
144
|
+
|
145
145
|
def ret_config_key_value(key)
|
146
146
|
::Grit::Config.new(@grit_repo).fetch(key)
|
147
147
|
end
|
@@ -167,7 +167,7 @@ module DTK
|
|
167
167
|
if depth == 1
|
168
168
|
ret = tree_contents.map do |tc|
|
169
169
|
if opts[:file_only]
|
170
|
-
tc.kind_of?(::Grit::Blob) && tc.name
|
170
|
+
tc.kind_of?(::Grit::Blob) && tc.name
|
171
171
|
elsif opts[:directory_only]
|
172
172
|
tc.kind_of?(::Grit::Tree) && tc.name
|
173
173
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtk-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich PELAVIN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rugged
|
@@ -188,12 +188,12 @@ require_paths:
|
|
188
188
|
- lib
|
189
189
|
required_ruby_version: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
|
-
- - '>='
|
191
|
+
- - ! '>='
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
195
|
requirements:
|
196
|
-
- - '>='
|
196
|
+
- - ! '>='
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|