jbox-gitolite 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f37bb126327d01abd1e3fb270b1da512d823c68f
4
- data.tar.gz: 0d8485bf1ac13abebfeba9329cb2a31829941d69
3
+ metadata.gz: a5373d0735ecddbde38ff701ac4e7d8d22abb4eb
4
+ data.tar.gz: 2666968db7834b8baca9ccf4ed3d5b7968d08ffa
5
5
  SHA512:
6
- metadata.gz: 6beb1f436fabad483f7e88c0a9633a7d24c1cf2393fa61046b32c2fd678da7c2f0abde8200624aa48f52aac9235e962df0dc037afde248df562493da437dba41
7
- data.tar.gz: dee2cb5e1f9c97988cb9ccea6ad0b63e1eecb45a08a19c16365450228ce3f310016a277027dacc1edcfecddaddc71c79baa1226539f472390b7ab17fdc22174c
6
+ metadata.gz: 0aca10595c306a81bbe36b8cce66b0ce7a8189617248c0f22d2d97d6003a3a5d7d82a25986141d223ef2577aac6d0ec343074d073ac514e288e7266bf5fd37de
7
+ data.tar.gz: 6bf8e50d3c55910fde08b42d587a879509a63d52e92e1aae109a11f351516504e17d211bba18e134c40fb8c52fb0433d3c58645f195a0dc3579e13f03ac116f5
@@ -67,6 +67,8 @@ module Gitolite
67
67
 
68
68
  new_conf = File.join(path, filename)
69
69
  File.open(new_conf, "w") do |f|
70
+ f.sync = true
71
+
70
72
  #Output groups
71
73
  dep_order = build_groups_depgraph
72
74
  dep_order.each {|group| f.write group.to_s }
@@ -63,27 +63,31 @@ module Gitolite
63
63
  #Writes all changed aspects out to the file system
64
64
  #will also stage all changes
65
65
  def save
66
- Dir.chdir(@gl_admin.working_dir) do
67
- #Process config file (if loaded, i.e. may be modified)
68
- if @config
69
- new_conf = @config.to_file(@confdir)
70
- @gl_admin.add(new_conf)
71
- end
66
+ confdir = File.join(@gl_admin.working_dir, @confdir)
67
+ keydir = File.join(@gl_admin.working_dir, @keydir)
72
68
 
73
- #Process ssh keys (if loaded, i.e. may be modified)
74
- if @ssh_keys
75
- files = list_keys(@keydir).map{|f| File.basename f}
76
- keys = @ssh_keys.values.map{|f| f.map {|t| t.filename}}.flatten
69
+ #Process config file (if loaded, i.e. may be modified)
70
+ if @config
71
+ new_conf = @config.to_file(confdir).gsub(@gl_admin.working_dir + '/', '')
72
+ @gl_admin.git.native(:add, {:chdir => @gl_admin.working_dir}, new_conf)
73
+ end
77
74
 
78
- to_remove = (files - keys).map { |f| File.join(@keydir, f)}
79
- @gl_admin.remove(to_remove)
75
+ #Process ssh keys (if loaded, i.e. may be modified)
76
+ if @ssh_keys
77
+ files = list_keys(keydir).map{|f| File.basename f}
78
+ keys = @ssh_keys.values.map{|f| f.map {|t| t.filename}}.flatten
79
+
80
+ to_remove = (files - keys).map { |f| File.join(@keydir, f) }
81
+ to_remove.each do |key|
82
+ @gl_admin.git.native(:rm, {:chdir => @gl_admin.working_dir}, key)
83
+ end
80
84
 
81
- @ssh_keys.each_value do |key|
82
- #Write only keys from sets that has been modified
83
- next if key.respond_to?(:dirty?) && !key.dirty?
84
- key.each do |k|
85
- @gl_admin.add(k.to_file(@keydir))
86
- end
85
+ @ssh_keys.each_value do |key|
86
+ #Write only keys from sets that has been modified
87
+ next if key.respond_to?(:dirty?) && !key.dirty?
88
+ key.each do |k|
89
+ new_key = k.to_file(keydir).gsub(@gl_admin.working_dir + '/', '')
90
+ @gl_admin.git.native(:add, {:chdir => @gl_admin.working_dir}, new_key)
87
91
  end
88
92
  end
89
93
  end
@@ -172,6 +176,10 @@ module Gitolite
172
176
  @config ||= load_config
173
177
  end
174
178
 
179
+ def config=(config)
180
+ @config = config
181
+ end
182
+
175
183
  private
176
184
  #Loads all .pub files in the gitolite-admin
177
185
  #keydir directory
@@ -197,10 +205,8 @@ module Gitolite
197
205
  end
198
206
 
199
207
  def list_keys(path)
200
- Dir.chdir(path) do
201
- keys = Dir.glob("**/*.pub")
202
- keys
203
- end
208
+ keys = %x[ find #{path} -name "\*.pub" -type f -exec basename {} \\; ].chomp.split("\n")
209
+ keys
204
210
  end
205
211
  end
206
212
  end
@@ -61,6 +61,7 @@ module Gitolite
61
61
  def to_file(path)
62
62
  key_file = File.join(path, self.filename)
63
63
  File.open(key_file, "w") do |f|
64
+ f.sync = true
64
65
  f.write(self.to_s)
65
66
  end
66
67
  key_file
@@ -1,3 +1,3 @@
1
1
  module Gitolite
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbox-gitolite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Rodriguez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-08 00:00:00.000000000 Z
11
+ date: 2013-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec