gitolite 0.0.2.alpha → 0.0.3.alpha

Sign up to get free protection for your applications and to get access to all the features.
@@ -238,6 +238,9 @@ repo linux perl
238
238
  # give gitweb access as described above if you're specifying a description
239
239
 
240
240
  gitolite "Sitaram Chamarty" = "fast, secure, access control for git in a corporate environment"
241
+ foo = "Foo is a nice test repo"
242
+ foobar "Bob Zilla" = "Foobar is top secret"
243
+ bar = "A nice place to get drinks"
241
244
 
242
245
  # REPO SPECIFIC GITCONFIG
243
246
  # -----------------------
@@ -0,0 +1,126 @@
1
+ require 'gitolite/config/group'
2
+ require 'spec_helper'
3
+
4
+ describe Gitolite::Config::Group do
5
+ describe "#new" do
6
+ it "should create a new group with an empty list of users" do
7
+ group = Gitolite::Config::Group.new("testgroup")
8
+ group.users.empty?.should be true
9
+ group.name.should == "testgroup"
10
+ end
11
+
12
+ it "should create a new group with a name containing #{Gitolite::Config::Group::PREPEND_CHAR}" do
13
+ name = "#{Gitolite::Config::Group::PREPEND_CHAR}testgroup"
14
+ group = Gitolite::Config::Group.new(name)
15
+ group.name.should == "testgroup"
16
+ end
17
+ end
18
+
19
+ describe "users" do
20
+ before :each do
21
+ @group = Gitolite::Config::Group.new('testgroup')
22
+ end
23
+
24
+ describe "#add_user" do
25
+ it "should allow adding one user with a string" do
26
+ @group.add_user("bob")
27
+ @group.size.should == 1
28
+ @group.users.first.should == "bob"
29
+ end
30
+
31
+ it "should allow adding one user with a symbol" do
32
+ @group.add_user(:bob)
33
+ @group.size.should == 1
34
+ @group.users.first.should == "bob"
35
+ end
36
+
37
+ it "should not add the same user twice" do
38
+ @group.add_user("bob")
39
+ @group.size.should == 1
40
+ @group.add_user(:bob)
41
+ @group.size.should == 1
42
+ @group.users.first.should == "bob"
43
+ end
44
+
45
+ it "should maintain users in sorted order" do
46
+ @group.add_user("susan")
47
+ @group.add_user("peyton")
48
+ @group.add_user("bob")
49
+ @group.users.first.should == "bob"
50
+ @group.users.last.should == "susan"
51
+ end
52
+ end
53
+
54
+ describe "#add_users" do
55
+ it "should allow adding multiple users at once" do
56
+ @group.add_users("bob", "joe", "sue", "sam", "dan")
57
+ @group.size.should == 5
58
+ end
59
+
60
+ it "should allow adding multiple users in nested arrays" do
61
+ @group.add_users(["bob", "joe", ["sam", "sue", "dan"]], "bill")
62
+ @group.size.should == 6
63
+ end
64
+
65
+ it "should allow adding users of symbols and strings" do
66
+ @group.add_users("bob", :joe, :sue, "sam")
67
+ @group.size.should == 4
68
+ end
69
+
70
+ it "should not add the same user twice" do
71
+ @group.add_users("bob", :bob, "bob", "sam")
72
+ @group.size.should == 2
73
+ end
74
+ end
75
+
76
+ describe "#rm_user" do
77
+ before :each do
78
+ @group.add_users("bob", "joe", "susan", "sam", "alex")
79
+ end
80
+
81
+ it "should support removing a user via a String" do
82
+ @group.rm_user("bob")
83
+ @group.size.should == 4
84
+ end
85
+
86
+ it "should support removing a user via a Symbol" do
87
+ @group.rm_user(:bob)
88
+ @group.size.should == 4
89
+ end
90
+ end
91
+
92
+ describe "#empty!" do
93
+ it "should clear all users from the group" do
94
+ @group.add_users("bob", "joe", "sue", "jim")
95
+ @group.size.should == 4
96
+ @group.empty!
97
+ @group.size.should == 0
98
+ end
99
+ end
100
+
101
+ describe "#size" do
102
+ it "should reflect how many users are in the group" do
103
+ @group.add_users("bob", "joe", "sue", "jim")
104
+ @group.users.length.should == @group.size
105
+ end
106
+ end
107
+
108
+ describe "#has_user?" do
109
+ it "should search for a user via a String" do
110
+ @group.add_user("bob")
111
+ @group.has_user?("bob").should be true
112
+ end
113
+
114
+ it "should search for a user via a Symbol" do
115
+ @group.add_user(:bob)
116
+ @group.has_user?(:bob).should be true
117
+ end
118
+ end
119
+ end
120
+
121
+ describe "#to_s" do
122
+ group = Gitolite::Config::Group.new("testgroup")
123
+ group.add_users("bob", "joe", "sam", "sue")
124
+ group.to_s.should == "@testgroup = bob joe sam sue\n" #10 spaces after @testgroup
125
+ end
126
+ end
@@ -0,0 +1 @@
1
+ ssh-rsa AAAAB3NzaC1yc2EAAA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F3p4GqSt4/L79nR0LV45grS4NbcN+fCnjWZ8PQhmJ+WPLKkydgR1YvobeY7zDHdHJXWLhsPa+SjwI3WfzrB+GQ== bob@zilla.com
@@ -0,0 +1,97 @@
1
+ require 'gitolite/config/repo'
2
+ require 'spec_helper'
3
+
4
+ describe Gitolite::Config::Repo do
5
+ before(:each) do
6
+ @repo = Gitolite::Config::Repo.new("CoolRepo")
7
+ end
8
+
9
+ describe '#new' do
10
+ it 'should create a repo called "CoolRepo"' do
11
+ @repo.name.should == "CoolRepo"
12
+ end
13
+ end
14
+
15
+ describe "deny rules" do
16
+ it 'should maintain the order of rules for a repository' do
17
+ @repo.add_permission("RW+", "", "bob", "joe", "sam")
18
+ @repo.add_permission("R", "", "sue", "jen", "greg")
19
+ @repo.add_permission("-", "refs/tags/test[0-9]", "@students", "jessica")
20
+ @repo.add_permission("RW", "refs/tags/test[0-9]", "@teachers", "bill", "todd")
21
+ @repo.add_permission("R", "refs/tags/test[0-9]", "@profs")
22
+
23
+ @repo.permissions.length.should == 2
24
+ @repo.permissions[0].size.should == 2
25
+ @repo.permissions[1].size.should == 3
26
+ end
27
+ end
28
+
29
+ describe '#add_permission' do
30
+ it 'should allow adding a permission to the permissions list' do
31
+ @repo.add_permission("RW+")
32
+ @repo.permissions.length.should == 1
33
+ @repo.permissions.first.keys.first.should == "RW+"
34
+ end
35
+
36
+ it 'should allow adding a permission while specifying a refex' do
37
+ @repo.add_permission("RW+", "refs/heads/master")
38
+ @repo.permissions.length.should == 1
39
+ @repo.permissions.first.keys.first.should == "RW+"
40
+ @repo.permissions.first.values.last.first.first.should == "refs/heads/master"
41
+ end
42
+
43
+ it 'should allow specifying users individually' do
44
+ @repo.add_permission("RW+", "", "bob", "joe", "susan", "sam", "bill")
45
+ @repo.permissions.first["RW+"][""].should == %w[bob joe susan sam bill]
46
+ end
47
+
48
+ it 'should allow specifying users as an array' do
49
+ users = %w[bob joe susan sam bill]
50
+
51
+ @repo.add_permission("RW+", "", users)
52
+ @repo.permissions.first["RW+"][""].should == users
53
+ end
54
+
55
+ it 'should not allow adding an invalid permission via an InvalidPermissionError' do
56
+ expect {@repo.add_permission("BadPerm")}.to raise_error
57
+ end
58
+ end
59
+
60
+ describe 'git config options' do
61
+ it 'should allow setting a git configuration option' do
62
+ email = "bob@zilla.com"
63
+ @repo.set_git_config("email", email).should == email
64
+ end
65
+
66
+ it 'should allow deletion of an existing git configuration option' do
67
+ email = "bob@zilla.com"
68
+ @repo.set_git_config("email", email)
69
+ @repo.unset_git_config("email").should == email
70
+ end
71
+
72
+ end
73
+
74
+ describe 'permission management' do
75
+ it 'should combine two entries for the same permission and refex' do
76
+ users = %w[bob joe susan sam bill]
77
+ more_users = %w[sally peyton andrew erin]
78
+
79
+ @repo.add_permission("RW+", "", users)
80
+ @repo.add_permission("RW+", "", more_users)
81
+ @repo.permissions.first["RW+"][""].should == users.concat(more_users)
82
+ @repo.permissions.first["RW+"][""].length.should == 9
83
+ end
84
+
85
+ it 'should not list the same users twice for the same permission level' do
86
+ users = %w[bob joe susan sam bill]
87
+ more_users = %w[bob peyton andrew erin]
88
+ even_more_users = %w[bob jim wayne courtney]
89
+
90
+ @repo.add_permission("RW+", "", users)
91
+ @repo.add_permission("RW+", "", more_users)
92
+ @repo.add_permission("RW+", "", even_more_users)
93
+ @repo.permissions.first["RW+"][""].should == users.concat(more_users).concat(even_more_users).uniq!
94
+ @repo.permissions.first["RW+"][""].length.should == 11
95
+ end
96
+ end
97
+ end
@@ -1,2 +1,2 @@
1
- require 'Forgery'
2
- require 'tmpdir'
1
+ require 'forgery'
2
+ require 'tmpdir'
@@ -24,6 +24,18 @@ describe Gitolite::SSHKey do
24
24
  s.owner.should == 'bob@zilla.com'
25
25
  end
26
26
 
27
+ it "owner should be joe-bob@god-zilla.com for joe-bob@god-zilla.com@desktop.pub" do
28
+ key = File.join(key_dir, 'joe-bob@god-zilla.com@desktop.pub')
29
+ s = SSHKey.from_file(key)
30
+ s.owner.should == 'joe-bob@god-zilla.com'
31
+ end
32
+
33
+ it "owner should be bob.joe@test.zilla.com for bob.joe@test.zilla.com@desktop.pub" do
34
+ key = File.join(key_dir, 'bob.joe@test.zilla.com@desktop.pub')
35
+ s = SSHKey.from_file(key)
36
+ s.owner.should == 'bob.joe@test.zilla.com'
37
+ end
38
+
27
39
  it 'owner should be bob@zilla.com for bob@zilla.com@desktop.pub' do
28
40
  key = File.join(key_dir, 'bob@zilla.com@desktop.pub')
29
41
  s = SSHKey.from_file(key)
@@ -254,4 +266,4 @@ describe Gitolite::SSHKey do
254
266
  s1.should == s2
255
267
  end
256
268
  end
257
- end
269
+ end
metadata CHANGED
@@ -1,108 +1,217 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gitolite
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.2.alpha
3
+ version: !ruby/object:Gem::Version
4
+ hash: -1851332174
5
5
  prerelease: 6
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ - alpha
11
+ version: 0.0.3.alpha
6
12
  platform: ruby
7
- authors:
13
+ authors:
8
14
  - Stafford Brunk
9
- autorequire: !!null
15
+ autorequire:
10
16
  bindir: bin
11
17
  cert_chain: []
12
- date: 2011-02-01 00:00:00.000000000 -05:00
13
- default_executable: !!null
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
18
+
19
+ date: 2011-10-23 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
16
22
  name: rspec
17
- requirement: &23994300 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
18
25
  none: false
19
- requirements:
26
+ requirements:
20
27
  - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 2.4.0
28
+ - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 2
32
+ - 6
33
+ - 0
34
+ version: 2.6.0
23
35
  type: :development
24
- prerelease: false
25
- version_requirements: *23994300
26
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
27
38
  name: forgery
28
- requirement: &23993928 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 11
46
+ segments:
47
+ - 0
48
+ - 5
49
+ - 0
50
+ version: 0.5.0
51
+ type: :development
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rdoc
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
29
57
  none: false
30
- requirements:
58
+ requirements:
31
59
  - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 0.3.6
60
+ - !ruby/object:Gem::Version
61
+ hash: 43
62
+ segments:
63
+ - 3
64
+ - 9
65
+ - 4
66
+ version: 3.9.4
34
67
  type: :development
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: rcov
35
71
  prerelease: false
36
- version_requirements: *23993928
37
- - !ruby/object:Gem::Dependency
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 45
78
+ segments:
79
+ - 0
80
+ - 9
81
+ - 11
82
+ version: 0.9.11
83
+ type: :development
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
38
86
  name: grit
39
- requirement: &23993640 !ruby/object:Gem::Requirement
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
40
89
  none: false
41
- requirements:
90
+ requirements:
42
91
  - - ~>
43
- - !ruby/object:Gem::Version
92
+ - !ruby/object:Gem::Version
93
+ hash: 29
94
+ segments:
95
+ - 2
96
+ - 4
97
+ - 1
44
98
  version: 2.4.1
45
99
  type: :runtime
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ name: hashery
46
103
  prerelease: false
47
- version_requirements: *23993640
48
- description: This gem is designed to provide a Ruby interface to the gitolite git
49
- backend system. This gem aims to provide all management functionality that is available
50
- via the gitolite-admin repository (like SSH keys, repository permissions, etc)
51
- email:
104
+ requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ hash: 7
110
+ segments:
111
+ - 1
112
+ - 4
113
+ - 0
114
+ version: 1.4.0
115
+ type: :runtime
116
+ version_requirements: *id006
117
+ description: This gem is designed to provide a Ruby interface to the gitolite git backend system. This gem aims to provide all management functionality that is available via the gitolite-admin repository (like SSH keys, repository permissions, etc)
118
+ email:
52
119
  - wingrunr21@gmail.com
53
120
  executables: []
121
+
54
122
  extensions: []
123
+
55
124
  extra_rdoc_files: []
56
- files:
125
+
126
+ files:
127
+ - .gemtest
57
128
  - .gitignore
58
129
  - Gemfile
59
130
  - Gemfile.lock
131
+ - LICENSE
60
132
  - README.rdoc
61
133
  - Rakefile
62
134
  - gitolite.gemspec
63
135
  - lib/gitolite.rb
64
136
  - lib/gitolite/config.rb
137
+ - lib/gitolite/config/group.rb
138
+ - lib/gitolite/config/repo.rb
65
139
  - lib/gitolite/gitolite_admin.rb
66
140
  - lib/gitolite/ssh_key.rb
67
141
  - lib/gitolite/version.rb
142
+ - spec/concurrency_spec.rb
68
143
  - spec/config_spec.rb
69
144
  - spec/configs/complicated.conf
70
145
  - spec/configs/simple.conf
71
146
  - spec/gitolite_admin_spec.rb
147
+ - spec/group_spec.rb
148
+ - spec/keys/bob-ins@zilla-site.com@desktop.pub
149
+ - spec/keys/bob.joe@test.zilla.com@desktop.pub
72
150
  - spec/keys/bob.pub
73
151
  - spec/keys/bob@desktop.pub
74
152
  - spec/keys/bob@zilla.com.pub
75
153
  - spec/keys/bob@zilla.com@desktop.pub
76
154
  - spec/keys/jakub123.pub
77
155
  - spec/keys/jakub123@foo.net.pub
156
+ - spec/keys/joe-bob@god-zilla.com@desktop.pub
78
157
  - spec/keys/joe@sch.ool.edu.pub
79
158
  - spec/keys/joe@sch.ool.edu@desktop.pub
159
+ - spec/repo_spec.rb
80
160
  - spec/spec_helper.rb
81
161
  - spec/ssh_key_spec.rb
82
- has_rdoc: true
83
162
  homepage: https://www.github.com/wingrunr21/gitolite
84
163
  licenses: []
85
- post_install_message: !!null
164
+
165
+ post_install_message:
86
166
  rdoc_options: []
87
- require_paths:
167
+
168
+ require_paths:
88
169
  - lib
89
- required_ruby_version: !ruby/object:Gem::Requirement
170
+ required_ruby_version: !ruby/object:Gem::Requirement
90
171
  none: false
91
- requirements:
92
- - - ! '>='
93
- - !ruby/object:Gem::Version
94
- version: '0'
95
- required_rubygems_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ hash: 3
176
+ segments:
177
+ - 0
178
+ version: "0"
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
180
  none: false
97
- requirements:
98
- - - ! '>'
99
- - !ruby/object:Gem::Version
181
+ requirements:
182
+ - - ">"
183
+ - !ruby/object:Gem::Version
184
+ hash: 25
185
+ segments:
186
+ - 1
187
+ - 3
188
+ - 1
100
189
  version: 1.3.1
101
190
  requirements: []
191
+
102
192
  rubyforge_project: gitolite
103
- rubygems_version: 1.5.0
104
- signing_key: !!null
193
+ rubygems_version: 1.8.10
194
+ signing_key:
105
195
  specification_version: 3
106
- summary: A Ruby gem for manipulating the gitolite git backend via the gitolite-admin
107
- repository.
108
- test_files: []
196
+ summary: A Ruby gem for manipulating the gitolite git backend via the gitolite-admin repository.
197
+ test_files:
198
+ - spec/concurrency_spec.rb
199
+ - spec/config_spec.rb
200
+ - spec/configs/complicated.conf
201
+ - spec/configs/simple.conf
202
+ - spec/gitolite_admin_spec.rb
203
+ - spec/group_spec.rb
204
+ - spec/keys/bob-ins@zilla-site.com@desktop.pub
205
+ - spec/keys/bob.joe@test.zilla.com@desktop.pub
206
+ - spec/keys/bob.pub
207
+ - spec/keys/bob@desktop.pub
208
+ - spec/keys/bob@zilla.com.pub
209
+ - spec/keys/bob@zilla.com@desktop.pub
210
+ - spec/keys/jakub123.pub
211
+ - spec/keys/jakub123@foo.net.pub
212
+ - spec/keys/joe-bob@god-zilla.com@desktop.pub
213
+ - spec/keys/joe@sch.ool.edu.pub
214
+ - spec/keys/joe@sch.ool.edu@desktop.pub
215
+ - spec/repo_spec.rb
216
+ - spec/spec_helper.rb
217
+ - spec/ssh_key_spec.rb