dtk-common 0.5.12 → 0.5.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGU3ZDY1NjdiMmQ2ZGY0ZGQ4NDIxMWJmZGUwNGRlODMxMTcwMzBmNw==
4
+ OWEwN2NmNjgzMDljMTg5NmY0NmRjMmVmZDUzYzU5NmYwOWFiMDlkZQ==
5
5
  data.tar.gz: !binary |-
6
- MTI5OTVkZDM5YWRlNTcxMjViODA0NzdiN2FhOWNlNTdmMTRmMmY3MQ==
6
+ YjljN2ExMDlhNmM4NDM5ZjBiNDQ3OTdlZDMwZjZjMTc4N2M3ZDA2ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTMyNzJmNjE5ZTUzMWFhY2IwMTQ2YzZhMDBhNGM4N2Q3NzU4NWY5MGUzMTRj
10
- ZGYyM2E2Y2VkZTM4MDYyNjIyMmI5Y2QwZWM3MWRhOWQxOTQyMGEyYjU4ZjMy
11
- MGFjZDQ0ZWEzNWEwMDQ0ZTJlYjdmNGVhODVhMzEzNWMzMDM5NGY=
9
+ OGE1YWM0ZGFiMGM4ZDAxZTdkYmJlMjlmYjJmZGNlZGVhMTgwMTA5Mzg5YzMz
10
+ NDhiZmUzYWYyZTgyZmU3M2RmMjQ3OWMwYzcyYmUxZGJmNzY1M2ExNDgxNmMw
11
+ ZWU4OGU4NDBlNzllNzJiNDdhYjY3NjNkNDcwMTE4NWM1NmRhZjg=
12
12
  data.tar.gz: !binary |-
13
- OTJlNmY0Y2Q3YzFmOGE1Zjc0MTczMWQ2YTdkOTQxNTRkNDU3M2IzNDUzNzQ2
14
- N2IwYmMxMGE2MmY2OTg4YzEwNzAyYjVhMzE0YzZiZjQ5ZGQyZjhmNmZjNGIy
15
- NTEyNjI3ZjUzYWRiZWIwOTY5YzNhMjYzZmY1YjQzNzcxMTM5NzA=
13
+ NmFlNmFmZTQ0YzA3NmQ2OGIzYjdiYzg2NTE5MDg2MDM3NjNhMzI1MWMyN2Y1
14
+ Njg5Nzk3MTU5MWUzNjcxMDFiZGJhOWQ5NTBiNWIyMjljZjA0MmZiMGExMjk4
15
+ MjllNDJkOTliMWQwYjRlNDE5ZmIwMjA0Mjc0YTlmYmM5MmYyNWM=
@@ -1,3 +1,3 @@
1
1
  module DtkCommon
2
- VERSION = "0.5.12"
2
+ VERSION = "0.5.13"
3
3
  end
@@ -6,7 +6,7 @@ module Gitolite
6
6
 
7
7
  DEFAULT_BRANCH = 'master'
8
8
 
9
- def initialize(repo_dir,branch='master')
9
+ def initialize(repo_dir,branch=DEFAULT_BRANCH)
10
10
  @repo_dir = repo_dir
11
11
  @branch = branch
12
12
  @grit_repo = nil
@@ -2,6 +2,8 @@ module Gitolite
2
2
  module Git
3
3
  class FileAccess < Adapter
4
4
 
5
+
6
+
5
7
  def add_file(file_rel_path,content)
6
8
  content ||= String.new
7
9
  file_path = qualified_path(file_rel_path)
@@ -33,15 +35,19 @@ module Gitolite
33
35
  "#{@repo_dir}/#{file_rel_path}"
34
36
  end
35
37
 
38
+ Change_dir_mutex = Mutex.new
39
+
36
40
  def chdir_and_checkout(branch=nil,&block)
37
- branch ||= @branch
38
- Dir.chdir(@repo_dir) do
39
- current_head = @grit_repo.head.name
40
- git_command(:checkout,branch) unless current_head == branch
41
- return unless block
42
- yield
43
- unless current_head == branch
44
- git_command(:checkout,current_head)
41
+ Change_dir_mutex.synchronize do
42
+ branch ||= @branch
43
+ Dir.chdir(@repo_dir) do
44
+ current_head = @grit_repo.head.name
45
+ git_command(:checkout,branch) unless current_head == branch
46
+ return unless block
47
+ yield
48
+ unless current_head == branch
49
+ git_command(:checkout,current_head)
50
+ end
45
51
  end
46
52
  end
47
53
  end
@@ -51,6 +51,10 @@ module Gitolite
51
51
  key_path
52
52
  end
53
53
 
54
+ def create_user_depracated(username, rsa_pub_key)
55
+ create_user(username, rsa_pub_key, 'default')
56
+ end
57
+
54
58
  def delete_user(username)
55
59
  key_path = @configuration.user_key_path(username)
56
60
 
@@ -87,6 +91,17 @@ module Gitolite
87
91
  true
88
92
  end
89
93
 
94
+ def rename_pub_key!(old_username, new_username, rsa_pub_key_name, rsa_pub_key_value)
95
+ file_name = "#{old_username}@#{rsa_pub_key_name}"
96
+ new_file_name = "#{new_username}@#{rsa_pub_key_name}"
97
+
98
+ key_path = @configuration.user_key_path(file_name)
99
+ new_key_path = @configuration.user_key_path(new_file_name)
100
+
101
+ remove_file(key_path, "Rename public key (#{rsa_pub_key_name}) from old user (#{old_username}) to new (#{new_username}) - REMOVE")
102
+ add_commit_file(new_key_path, rsa_pub_key_value, "Rename public key (#{rsa_pub_key_name}) from old user (#{old_username}) to new (#{new_username}) - ADD")
103
+ end
104
+
90
105
  def delete_user_group!(group_name)
91
106
  group_path = @configuration.user_group_path(group_name)
92
107
 
@@ -122,6 +137,7 @@ module Gitolite
122
137
  end
123
138
 
124
139
  # only to help with migration, to be deleted later TODO: Delete
140
+ # Depracated: To be removed
125
141
  def migrate_to_multiple_pub_keys()
126
142
  all_pub_keys = users_public_keys()
127
143
  base_path = @configuration.keydir_path
@@ -137,7 +153,7 @@ module Gitolite
137
153
  remove_file(pub_key_path, "Migrating user ('#{file_name}') to new annotation, temporary removing user")
138
154
 
139
155
  # create user
140
- create_user(file_name, pub_content)
156
+ create_user_depracated(file_name, pub_content)
141
157
  end
142
158
  end
143
159
  puts "End migration of pub keys"
@@ -180,6 +196,10 @@ module Gitolite
180
196
  @commit_messages << commit_msg
181
197
  end
182
198
 
199
+ def file_content(file_path)
200
+ gitolite_admin_repo().file_content(file_path)
201
+ end
202
+
183
203
  def extract_file_name(full_path_name, file_path, file_extension)
184
204
  if full_path_name =~ Regexp.new("^#{file_path}/(.+)\.#{file_extension}")
185
205
  $1
data/lib/gitolite/repo.rb CHANGED
@@ -10,7 +10,6 @@ module Gitolite
10
10
 
11
11
  GIOLITE_ALL_GROUP = '@all'
12
12
 
13
-
14
13
  #
15
14
  # We check if there are users in addition to tenant with line,
16
15
  # (repo_conf.rights_hash.values.flatten.size > 1)
@@ -54,6 +53,16 @@ module Gitolite
54
53
  end
55
54
  end
56
55
 
56
+ def rights_for_username(username)
57
+ @rights_hash.each do |k,v|
58
+ if v.include?(username)
59
+ return k
60
+ end
61
+ end
62
+
63
+ return nil
64
+ end
65
+
57
66
  def remove_username(username)
58
67
  @rights_hash.each do |k,v|
59
68
  if v.include?(username)
@@ -51,7 +51,7 @@ module Gitolite
51
51
  elsif permission.match(/^R/)
52
52
  return 'R'
53
53
  else
54
- raise ::Error::NotSupported, "Not supported permission '#{permission}'!"
54
+ return nil
55
55
  end
56
56
  end
57
57
 
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.12
4
+ version: 0.5.13
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-04-21 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged