jbox-gitolite 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/gitolite.gemspec +11 -14
- data/lib/gitolite/gitolite_admin.rb +14 -10
- data/lib/gitolite/version.rb +1 -1
- data/spec/config_spec.rb +85 -85
- data/spec/dirty_proxy_spec.rb +8 -8
- data/spec/gitolite_admin_spec.rb +3 -3
- data/spec/group_spec.rb +26 -24
- data/spec/repo_spec.rb +23 -23
- data/spec/ssh_key_spec.rb +54 -54
- metadata +101 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f75c8c516f589f46bd632bca406db19dcd203b0
|
4
|
+
data.tar.gz: f82ec5ddd831a347a618ea5ca3485e7d9c64967b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a57407c0b06c0aa6ccd885a6a3732923fa030edd28fcd920e6d246fa5873d03b4456893df3da25cbeeba06d758ee4d73be7fdf8334efeaf55889e529227eb8f
|
7
|
+
data.tar.gz: 95f921301d318b4e7f103da5a0cf79e191de48821478637b2900f54f5b2ea4534a9f6d9ccdb6755af2e9d5dd7250eb1c1a8b4072fc004cdcb5afe8db4002e420
|
data/Rakefile
CHANGED
@@ -44,7 +44,7 @@ desc "Start unit tests"
|
|
44
44
|
task :test => :default
|
45
45
|
task :default do
|
46
46
|
RSpec::Core::RakeTask.new(:spec) do |config|
|
47
|
-
config.rspec_opts = "--color --format
|
47
|
+
config.rspec_opts = "--color --format documentation"
|
48
48
|
end
|
49
49
|
Rake::Task["spec"].invoke
|
50
50
|
end
|
data/gitolite.gemspec
CHANGED
@@ -15,21 +15,18 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.rubyforge_project = "jbox-gitolite"
|
17
17
|
|
18
|
-
s.add_development_dependency
|
19
|
-
s.add_development_dependency
|
20
|
-
s.add_development_dependency
|
21
|
-
s.add_development_dependency
|
22
|
-
s.add_development_dependency
|
23
|
-
s.add_development_dependency
|
24
|
-
s.add_development_dependency
|
18
|
+
s.add_development_dependency 'rake', '~> 10.3', '>= 10.3.1'
|
19
|
+
s.add_development_dependency 'rdoc', '~> 4.1', '>= 4.1.1'
|
20
|
+
s.add_development_dependency 'rspec', '~> 3.0', '>= 3.0.0'
|
21
|
+
s.add_development_dependency 'guard-rspec', '~> 4.2', '>= 4.2.8'
|
22
|
+
s.add_development_dependency 'guard-spork', '~> 1.5', '>= 1.5.1'
|
23
|
+
s.add_development_dependency 'forgery', '~> 0.6', '>= 0.6.0'
|
24
|
+
s.add_development_dependency 'simplecov', '~> 0.8', '>= 0.8.2'
|
25
|
+
s.add_development_dependency 'simplecov-rcov', '~> 0.2', '>= 0.2.3'
|
26
|
+
s.add_development_dependency 'rspec_junit_formatter', '~> 0.2', '>= 0.2.0'
|
25
27
|
|
26
|
-
s.
|
27
|
-
s.
|
28
|
-
|
29
|
-
s.add_development_dependency "rspec_junit_formatter", "~> 0.1.6"
|
30
|
-
|
31
|
-
s.add_dependency "gitlab-grit", "~> 2.6.5"
|
32
|
-
s.add_dependency "gratr19", "~> 0.4.4.1"
|
28
|
+
s.add_runtime_dependency 'gitlab-grit', '~> 2.7', '>= 2.7.0'
|
29
|
+
s.add_runtime_dependency 'gratr19', '~> 0.4', '>= 0.4.4.1'
|
33
30
|
|
34
31
|
s.files = `git ls-files`.split("\n")
|
35
32
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -63,8 +63,8 @@ module Gitolite
|
|
63
63
|
config = c.to_file(File.join(path, "conf"))
|
64
64
|
|
65
65
|
gl_admin = Grit::Repo.init(path)
|
66
|
-
gl_admin.git.native(:add, {
|
67
|
-
gl_admin.git.native(:commit, {
|
66
|
+
gl_admin.git.native(:add, {}, config)
|
67
|
+
gl_admin.git.native(:commit, {}, '-a', '-m', options[:message] || "Config bootstrapped by the gitolite gem")
|
68
68
|
|
69
69
|
self.new(path)
|
70
70
|
end
|
@@ -125,8 +125,8 @@ module Gitolite
|
|
125
125
|
# git repo to HEAD and reloading the entire repository
|
126
126
|
# Note that this will also delete all untracked files
|
127
127
|
def reset!
|
128
|
-
@gl_admin.git.native(:reset, {:env => @env, :
|
129
|
-
@gl_admin.git.native(:clean, {:env => @env, :
|
128
|
+
@gl_admin.git.native(:reset, {:env => @env, :hard => true}, 'HEAD')
|
129
|
+
@gl_admin.git.native(:clean, {:env => @env, :d => true, :q => true, :f => true})
|
130
130
|
reload!
|
131
131
|
end
|
132
132
|
|
@@ -146,7 +146,7 @@ module Gitolite
|
|
146
146
|
#Process config file (if loaded, i.e. may be modified)
|
147
147
|
if @config
|
148
148
|
new_conf = @config.to_file(@conf_dir_path)
|
149
|
-
@gl_admin.git.native(:add, {:env => @env
|
149
|
+
@gl_admin.git.native(:add, {:env => @env}, new_conf)
|
150
150
|
end
|
151
151
|
|
152
152
|
#Process ssh keys (if loaded, i.e. may be modified)
|
@@ -156,7 +156,7 @@ module Gitolite
|
|
156
156
|
|
157
157
|
to_remove = (files - keys).map { |f| File.join(@key_dir, f) }
|
158
158
|
to_remove.each do |key|
|
159
|
-
@gl_admin.git.native(:rm, {:env => @env
|
159
|
+
@gl_admin.git.native(:rm, {:env => @env}, key)
|
160
160
|
end
|
161
161
|
|
162
162
|
@ssh_keys.each_value do |key|
|
@@ -164,24 +164,28 @@ module Gitolite
|
|
164
164
|
next if key.respond_to?(:dirty?) && !key.dirty?
|
165
165
|
key.each do |k|
|
166
166
|
new_key = k.to_file(@key_dir_path)
|
167
|
-
@gl_admin.git.native(:add, {:env => @env
|
167
|
+
@gl_admin.git.native(:add, {:env => @env}, new_key)
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
172
|
args = []
|
173
173
|
|
174
|
+
args << '-a'
|
175
|
+
args << '-m'
|
176
|
+
args << commit_message
|
177
|
+
|
174
178
|
if options.has_key?(:author) && !options[:author].empty?
|
175
179
|
args << "--author='#{options[:author]}'"
|
176
180
|
end
|
177
181
|
|
178
|
-
@gl_admin.git.native(:commit, {:env => @env
|
182
|
+
@gl_admin.git.native(:commit, {:env => @env}, *args)
|
179
183
|
end
|
180
184
|
|
181
185
|
|
182
186
|
# Push back to origin
|
183
187
|
def apply
|
184
|
-
@gl_admin.git.native(:push, {:env => @env
|
188
|
+
@gl_admin.git.native(:push, {:env => @env}, "origin", "master")
|
185
189
|
end
|
186
190
|
|
187
191
|
|
@@ -198,7 +202,7 @@ module Gitolite
|
|
198
202
|
|
199
203
|
reset! if options[:reset]
|
200
204
|
|
201
|
-
@gl_admin.git.native(:pull, {:env => @env, :
|
205
|
+
@gl_admin.git.native(:pull, {:env => @env, :rebase => options[:rebase]}, "origin", "master")
|
202
206
|
|
203
207
|
reload!
|
204
208
|
end
|
data/lib/gitolite/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -9,14 +9,14 @@ describe Gitolite::Config do
|
|
9
9
|
describe "#new" do
|
10
10
|
it 'should read a simple configuration' do
|
11
11
|
c = Gitolite::Config.new(File.join(conf_dir, 'simple.conf'))
|
12
|
-
c.repos.length.
|
13
|
-
c.groups.length.
|
12
|
+
expect(c.repos.length).to eq 2
|
13
|
+
expect(c.groups.length).to eq 0
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should read a complex configuration' do
|
17
17
|
c = Gitolite::Config.new(File.join(conf_dir, 'complicated.conf'))
|
18
|
-
c.groups.length.
|
19
|
-
c.repos.length.
|
18
|
+
expect(c.groups.length).to eq 5
|
19
|
+
expect(c.repos.length).to eq 13
|
20
20
|
end
|
21
21
|
|
22
22
|
describe 'gitweb operations' do
|
@@ -26,26 +26,26 @@ describe Gitolite::Config do
|
|
26
26
|
|
27
27
|
it 'should correctly read gitweb options for an existing repo' do
|
28
28
|
r = @config.get_repo('gitolite')
|
29
|
-
r.owner.
|
30
|
-
r.description.
|
29
|
+
expect(r.owner).to eq "Sitaram Chamarty"
|
30
|
+
expect(r.description).to eq "fast, secure, access control for git in a corporate environment"
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should correctly read a gitweb option with no owner for an existing repo' do
|
34
34
|
r = @config.get_repo('foo')
|
35
|
-
r.owner.
|
36
|
-
r.description.
|
35
|
+
expect(r.owner).to be nil
|
36
|
+
expect(r.description).to eq "Foo is a nice test repo"
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should correctly read gitweb options for a new repo' do
|
40
40
|
r = @config.get_repo('foobar')
|
41
|
-
r.owner.
|
42
|
-
r.description.
|
41
|
+
expect(r.owner).to eq "Bob Zilla"
|
42
|
+
expect(r.description).to eq "Foobar is top secret"
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should correctly read gitweb options with no owner for a new repo' do
|
46
46
|
r = @config.get_repo('bar')
|
47
|
-
r.owner.
|
48
|
-
r.description.
|
47
|
+
expect(r.owner).to be nil
|
48
|
+
expect(r.description).to eq "A nice place to get drinks"
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should raise a ParseError when a description is not specified' do
|
@@ -53,7 +53,7 @@ describe Gitolite::Config do
|
|
53
53
|
t.write('gitolite "Bob Zilla"')
|
54
54
|
t.close
|
55
55
|
|
56
|
-
lambda { Gitolite::Config.new(t.path) }.
|
56
|
+
expect(lambda { Gitolite::Config.new(t.path) }).to raise_error(Gitolite::Config::ParseError)
|
57
57
|
|
58
58
|
t.unlink
|
59
59
|
end
|
@@ -63,7 +63,7 @@ describe Gitolite::Config do
|
|
63
63
|
t.write('@gitolite "Bob Zilla" = "Test description"')
|
64
64
|
t.close
|
65
65
|
|
66
|
-
lambda { Gitolite::Config.new(t.path) }.
|
66
|
+
expect(lambda { Gitolite::Config.new(t.path) }).to raise_error(Gitolite::Config::ParseError)
|
67
67
|
|
68
68
|
t.unlink
|
69
69
|
end
|
@@ -76,7 +76,7 @@ describe Gitolite::Config do
|
|
76
76
|
|
77
77
|
it 'should correctly read in git config settings' do
|
78
78
|
r = @config.get_repo(:gitolite)
|
79
|
-
r.config.length.
|
79
|
+
expect(r.config.length).to eq 4
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -87,7 +87,7 @@ describe Gitolite::Config do
|
|
87
87
|
|
88
88
|
it 'should correctly read in gitolite options' do
|
89
89
|
r = @config.get_repo(:foo)
|
90
|
-
r.options.length.
|
90
|
+
expect(r.options.length).to eq 3
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'should raise a ParseError when a value is not specified' do
|
@@ -95,7 +95,7 @@ describe Gitolite::Config do
|
|
95
95
|
t.write("repo foobar\n option mirror.master =")
|
96
96
|
t.close
|
97
97
|
|
98
|
-
lambda { Gitolite::Config.new(t.path) }.
|
98
|
+
expect(lambda { Gitolite::Config.new(t.path) }).to raise_error(Gitolite::Config::ParseError)
|
99
99
|
|
100
100
|
t.unlink
|
101
101
|
end
|
@@ -106,24 +106,24 @@ describe Gitolite::Config do
|
|
106
106
|
it 'should create a valid, blank Gitolite::Config' do
|
107
107
|
c = Gitolite::Config.init
|
108
108
|
|
109
|
-
c.
|
110
|
-
c.repos.
|
111
|
-
c.repos.length.
|
112
|
-
c.groups.
|
113
|
-
c.groups.length.
|
114
|
-
c.filename.
|
109
|
+
expect(c).to be_an_instance_of Gitolite::Config
|
110
|
+
expect(c.repos).to_not be nil
|
111
|
+
expect(c.repos.length).to be 0
|
112
|
+
expect(c.groups).to_not be nil
|
113
|
+
expect(c.groups.length).to be 0
|
114
|
+
expect(c.filename).to eq "gitolite.conf"
|
115
115
|
end
|
116
116
|
|
117
117
|
it 'should create a valid, blank Gitolite::Config with the given filename' do
|
118
118
|
filename = "test.conf"
|
119
119
|
c = Gitolite::Config.init(filename)
|
120
120
|
|
121
|
-
c.
|
122
|
-
c.repos.
|
123
|
-
c.repos.length.
|
124
|
-
c.groups.
|
125
|
-
c.groups.length.
|
126
|
-
c.filename.
|
121
|
+
expect(c).to be_an_instance_of Gitolite::Config
|
122
|
+
expect(c.repos).to_not be nil
|
123
|
+
expect(c.repos.length).to be 0
|
124
|
+
expect(c.groups).to_not be nil
|
125
|
+
expect(c.groups.length).to be 0
|
126
|
+
expect(c.filename).to eq filename
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -134,40 +134,40 @@ describe Gitolite::Config do
|
|
134
134
|
|
135
135
|
describe "#get_repo" do
|
136
136
|
it 'should fetch a repo by a string containing the name' do
|
137
|
-
@config.get_repo('gitolite').
|
137
|
+
expect(@config.get_repo('gitolite')).to be_an_instance_of Gitolite::Config::Repo
|
138
138
|
end
|
139
139
|
|
140
140
|
it 'should fetch a repo via a symbol representing the name' do
|
141
|
-
@config.get_repo(:gitolite).
|
141
|
+
expect(@config.get_repo(:gitolite)).to be_an_instance_of Gitolite::Config::Repo
|
142
142
|
end
|
143
143
|
|
144
144
|
it 'should return nil for a repo that does not exist' do
|
145
|
-
@config.get_repo(:glite).
|
145
|
+
expect(@config.get_repo(:glite)).to be nil
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
149
|
describe "#has_repo?" do
|
150
150
|
it 'should return false for a repo that does not exist' do
|
151
|
-
@config.has_repo?(:glite).
|
151
|
+
expect(@config.has_repo?(:glite)).to be false
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'should check for the existance of a repo given a repo object' do
|
155
155
|
r = @config.repos["gitolite"]
|
156
|
-
@config.has_repo?(r).
|
156
|
+
expect(@config.has_repo?(r)).to be true
|
157
157
|
end
|
158
158
|
|
159
159
|
it 'should check for the existance of a repo given a string containing the name' do
|
160
|
-
@config.has_repo?('gitolite').
|
160
|
+
expect(@config.has_repo?('gitolite')).to be true
|
161
161
|
end
|
162
162
|
|
163
163
|
it 'should check for the existance of a repo given a symbol representing the name' do
|
164
|
-
@config.has_repo?(:gitolite).
|
164
|
+
expect(@config.has_repo?(:gitolite)).to be true
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
168
|
describe "#add_repo" do
|
169
169
|
it 'should throw an ArgumentError for non-Gitolite::Config::Repo objects passed in' do
|
170
|
-
lambda{ @config.add_repo("not-a-repo") }.
|
170
|
+
expect(lambda{ @config.add_repo("not-a-repo") }).to raise_error(ArgumentError)
|
171
171
|
end
|
172
172
|
|
173
173
|
it 'should add a given repo to the list of repos' do
|
@@ -175,8 +175,8 @@ describe Gitolite::Config do
|
|
175
175
|
nrepos = @config.repos.size
|
176
176
|
@config.add_repo(r)
|
177
177
|
|
178
|
-
@config.repos.size.
|
179
|
-
@config.has_repo?(:cool_repo).
|
178
|
+
expect(@config.repos.size).to eq nrepos + 1
|
179
|
+
expect(@config.has_repo?(:cool_repo)).to be true
|
180
180
|
end
|
181
181
|
|
182
182
|
it 'should merge a given repo with an existing repo' do
|
@@ -227,28 +227,28 @@ describe Gitolite::Config do
|
|
227
227
|
it 'should remove a repo for the Gitolite::Config::Repo object given' do
|
228
228
|
r = @config.get_repo(:gitolite)
|
229
229
|
r2 = @config.rm_repo(r)
|
230
|
-
r2.name.
|
231
|
-
r2.permissions.length.
|
232
|
-
r2.owner.
|
233
|
-
r2.description.
|
230
|
+
expect(r2.name).to eq r.name
|
231
|
+
expect(r2.permissions.length).to eq r.permissions.length
|
232
|
+
expect(r2.owner).to eq r.owner
|
233
|
+
expect(r2.description).to eq r.description
|
234
234
|
end
|
235
235
|
|
236
236
|
it 'should remove a repo given a string containing the name' do
|
237
237
|
r = @config.get_repo(:gitolite)
|
238
238
|
r2 = @config.rm_repo('gitolite')
|
239
|
-
r2.name.
|
240
|
-
r2.permissions.length.
|
241
|
-
r2.owner.
|
242
|
-
r2.description.
|
239
|
+
expect(r2.name).to eq r.name
|
240
|
+
expect(r2.permissions.length).to eq r.permissions.length
|
241
|
+
expect(r2.owner).to eq r.owner
|
242
|
+
expect(r2.description).to eq r.description
|
243
243
|
end
|
244
244
|
|
245
245
|
it 'should remove a repo given a symbol representing the name' do
|
246
246
|
r = @config.get_repo(:gitolite)
|
247
247
|
r2 = @config.rm_repo(:gitolite)
|
248
|
-
r2.name.
|
249
|
-
r2.permissions.length.
|
250
|
-
r2.owner.
|
251
|
-
r2.description.
|
248
|
+
expect(r2.name).to eq r.name
|
249
|
+
expect(r2.permissions.length).to eq r.permissions.length
|
250
|
+
expect(r2.owner).to eq r.owner
|
251
|
+
expect(r2.description).to eq r.description
|
252
252
|
end
|
253
253
|
end
|
254
254
|
end
|
@@ -260,44 +260,44 @@ describe Gitolite::Config do
|
|
260
260
|
|
261
261
|
describe "#has_group?" do
|
262
262
|
it 'should find the staff group using a symbol' do
|
263
|
-
@config.has_group?(:staff).
|
263
|
+
expect(@config.has_group?(:staff)).to be true
|
264
264
|
end
|
265
265
|
|
266
266
|
it 'should find the staff group using a string' do
|
267
|
-
@config.has_group?('staff').
|
267
|
+
expect(@config.has_group?('staff')).to be true
|
268
268
|
end
|
269
269
|
|
270
270
|
it 'should find the staff group using a Gitolite::Config::Group object' do
|
271
271
|
g = Gitolite::Config::Group.new("staff")
|
272
|
-
@config.has_group?(g).
|
272
|
+
expect(@config.has_group?(g)).to be true
|
273
273
|
end
|
274
274
|
end
|
275
275
|
|
276
276
|
describe "#get_group" do
|
277
277
|
it 'should return the Gitolite::Config::Group object for the group name String' do
|
278
278
|
g = @config.get_group("staff")
|
279
|
-
g.is_a?(Gitolite::Config::Group).
|
280
|
-
g.size.
|
279
|
+
expect(g.is_a?(Gitolite::Config::Group)).to be true
|
280
|
+
expect(g.size).to eq 6
|
281
281
|
end
|
282
282
|
|
283
283
|
it 'should return the Gitolite::Config::Group object for the group name Symbol' do
|
284
284
|
g = @config.get_group(:staff)
|
285
|
-
g.is_a?(Gitolite::Config::Group).
|
286
|
-
g.size.
|
285
|
+
expect(g.is_a?(Gitolite::Config::Group)).to be true
|
286
|
+
expect(g.size).to eq 6
|
287
287
|
end
|
288
288
|
end
|
289
289
|
|
290
290
|
describe "#add_group" do
|
291
291
|
it 'should throw an ArgumentError for non-Gitolite::Config::Group objects passed in' do
|
292
|
-
lambda{ @config.add_group("not-a-group") }.
|
292
|
+
expect(lambda{ @config.add_group("not-a-group") }).to raise_error(ArgumentError)
|
293
293
|
end
|
294
294
|
|
295
295
|
it 'should add a given group to the groups list' do
|
296
296
|
g = Gitolite::Config::Group.new('cool_group')
|
297
297
|
ngroups = @config.groups.size
|
298
298
|
@config.add_group(g)
|
299
|
-
@config.groups.size.
|
300
|
-
@config.has_group?(:cool_group).
|
299
|
+
expect(@config.groups.size).to be ngroups + 1
|
300
|
+
expect(@config.has_group?(:cool_group)).to be true
|
301
301
|
end
|
302
302
|
|
303
303
|
end
|
@@ -306,20 +306,20 @@ describe Gitolite::Config do
|
|
306
306
|
it 'should remove a group for the Gitolite::Config::Group object given' do
|
307
307
|
g = @config.get_group(:oss_repos)
|
308
308
|
g2 = @config.rm_group(g)
|
309
|
-
g.
|
310
|
-
g2.name.
|
309
|
+
expect(g).to_not be nil
|
310
|
+
expect(g2.name).to eq g.name
|
311
311
|
end
|
312
312
|
|
313
313
|
it 'should remove a group given a string containing the name' do
|
314
314
|
g = @config.get_group(:oss_repos)
|
315
315
|
g2 = @config.rm_group('oss_repos')
|
316
|
-
g2.name.
|
316
|
+
expect(g2.name).to eq g.name
|
317
317
|
end
|
318
318
|
|
319
319
|
it 'should remove a group given a symbol representing the name' do
|
320
320
|
g = @config.get_group(:oss_repos)
|
321
321
|
g2 = @config.rm_group(:oss_repos)
|
322
|
-
g2.name.
|
322
|
+
expect(g2.name).to eq g.name
|
323
323
|
end
|
324
324
|
end
|
325
325
|
|
@@ -329,14 +329,14 @@ describe Gitolite::Config do
|
|
329
329
|
it 'should create a file at the given path with the config\'s file name' do
|
330
330
|
c = Gitolite::Config.init
|
331
331
|
file = c.to_file(output_dir)
|
332
|
-
File.file?(File.join(output_dir, c.filename)).
|
332
|
+
expect(File.file?(File.join(output_dir, c.filename))).to be true
|
333
333
|
File.unlink(file)
|
334
334
|
end
|
335
335
|
|
336
336
|
it 'should create a file at the given path with the config file passed' do
|
337
337
|
c = Gitolite::Config.new(File.join(conf_dir, 'complicated.conf'))
|
338
338
|
file = c.to_file(output_dir)
|
339
|
-
File.file?(File.join(output_dir, c.filename)).
|
339
|
+
expect(File.file?(File.join(output_dir, c.filename))).to be true
|
340
340
|
end
|
341
341
|
|
342
342
|
it 'should create a file at the given path when a different filename is specified' do
|
@@ -344,18 +344,18 @@ describe Gitolite::Config do
|
|
344
344
|
c = Gitolite::Config.init
|
345
345
|
c.filename = filename
|
346
346
|
file = c.to_file(output_dir)
|
347
|
-
File.file?(File.join(output_dir, filename)).
|
347
|
+
expect(File.file?(File.join(output_dir, filename))).to be true
|
348
348
|
File.unlink(file)
|
349
349
|
end
|
350
350
|
|
351
351
|
it 'should raise an ArgumentError when an invalid path is specified' do
|
352
352
|
c = Gitolite::Config.init
|
353
|
-
lambda { c.to_file('/does/not/exist') }.
|
353
|
+
expect(lambda { c.to_file('/does/not/exist') }).to raise_error(ArgumentError)
|
354
354
|
end
|
355
355
|
|
356
356
|
it 'should raise an ArgumentError when a filename is specified in the path' do
|
357
357
|
c = Gitolite::Config.init
|
358
|
-
lambda{ c.to_file('/home/test.rb') }.
|
358
|
+
expect(lambda{ c.to_file('/home/test.rb') }).to raise_error(ArgumentError)
|
359
359
|
end
|
360
360
|
|
361
361
|
it 'should resolve group dependencies such that all groups are defined before they are used' do
|
@@ -387,10 +387,10 @@ describe Gitolite::Config do
|
|
387
387
|
lines = f.lines.map {|l| l.strip}
|
388
388
|
|
389
389
|
# Compare the file lines. Spacing is important here since we are doing a direct comparision
|
390
|
-
lines[0].
|
391
|
-
lines[1].
|
392
|
-
lines[2].
|
393
|
-
lines[3].
|
390
|
+
expect(lines[0]).to eq "@groupb = andrew joe sam susan"
|
391
|
+
expect(lines[1]).to eq "@groupc = @groupb brandon jane"
|
392
|
+
expect(lines[2]).to eq "@groupd = @groupc larry"
|
393
|
+
expect(lines[3]).to eq "@groupa = @groupb bob"
|
394
394
|
|
395
395
|
# Cleanup
|
396
396
|
File.unlink(file)
|
@@ -418,7 +418,7 @@ describe Gitolite::Config do
|
|
418
418
|
c.add_group(g)
|
419
419
|
|
420
420
|
# Attempt to write the config file
|
421
|
-
lambda{ c.to_file(output_dir)}.
|
421
|
+
expect(lambda{ c.to_file(output_dir)}).to raise_error(Gitolite::Config::GroupDependencyError)
|
422
422
|
end
|
423
423
|
|
424
424
|
it 'should resolve group dependencies even when there are disconnected portions of the graph' do
|
@@ -450,10 +450,10 @@ describe Gitolite::Config do
|
|
450
450
|
lines = f.lines.map {|l| l.strip}
|
451
451
|
|
452
452
|
# Compare the file lines. Spacing is important here since we are doing a direct comparision
|
453
|
-
lines[0].
|
454
|
-
lines[1].
|
455
|
-
lines[2].
|
456
|
-
lines[3].
|
453
|
+
expect(lines[0]).to eq "@groupd = chris emily larry"
|
454
|
+
expect(lines[1]).to eq "@groupb = andrew joe sam susan"
|
455
|
+
expect(lines[2]).to eq "@groupa = bob stephanie timmy"
|
456
|
+
expect(lines[3]).to eq "@groupc = @groupa brandon earl jane"
|
457
457
|
|
458
458
|
# Cleanup
|
459
459
|
File.unlink(file)
|
@@ -467,32 +467,32 @@ describe Gitolite::Config do
|
|
467
467
|
|
468
468
|
it 'should remove comments' do
|
469
469
|
s = "#comment"
|
470
|
-
@config.instance_eval { cleanup_config_line(s) }.empty
|
470
|
+
expect(@config.instance_eval { cleanup_config_line(s) }.empty?).to eq true
|
471
471
|
end
|
472
472
|
|
473
473
|
it 'should remove inline comments, keeping content before the comment' do
|
474
474
|
s = "blablabla #comment"
|
475
|
-
@config.instance_eval { cleanup_config_line(s) }.
|
475
|
+
expect(@config.instance_eval { cleanup_config_line(s) }).to eq "blablabla"
|
476
476
|
end
|
477
477
|
|
478
478
|
it 'should pad = with spaces on each side' do
|
479
479
|
s = "bob=joe"
|
480
|
-
@config.instance_eval { cleanup_config_line(s) }.
|
480
|
+
expect(@config.instance_eval { cleanup_config_line(s) }).to eq "bob = joe"
|
481
481
|
end
|
482
482
|
|
483
483
|
it 'should replace multiple space characters with a single space' do
|
484
484
|
s = "bob = joe"
|
485
|
-
@config.instance_eval { cleanup_config_line(s) }.
|
485
|
+
expect(@config.instance_eval { cleanup_config_line(s) }).to eq "bob = joe"
|
486
486
|
end
|
487
487
|
|
488
488
|
it 'should cleanup whitespace at the beginning and end of lines' do
|
489
489
|
s = " bob = joe "
|
490
|
-
@config.instance_eval { cleanup_config_line(s) }.
|
490
|
+
expect(@config.instance_eval { cleanup_config_line(s) }).to eq "bob = joe"
|
491
491
|
end
|
492
492
|
|
493
493
|
it 'should cleanup whitespace and comments effectively' do
|
494
494
|
s = " bob = joe #comment"
|
495
|
-
@config.instance_eval { cleanup_config_line(s) }.
|
495
|
+
expect(@config.instance_eval { cleanup_config_line(s) }).to eq "bob = joe"
|
496
496
|
end
|
497
497
|
end
|
498
498
|
end
|