gitolite-rugged 1.2.pre.devel

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gemtest +0 -0
  3. data/.gitignore +9 -0
  4. data/.travis.yml +14 -0
  5. data/Gemfile +5 -0
  6. data/Guardfile +13 -0
  7. data/LICENSE.txt +26 -0
  8. data/README.md +108 -0
  9. data/Rakefile +59 -0
  10. data/gitolite.gemspec +36 -0
  11. data/lib/gitolite/config/group.rb +62 -0
  12. data/lib/gitolite/config/repo.rb +107 -0
  13. data/lib/gitolite/config.rb +284 -0
  14. data/lib/gitolite/dirty_proxy.rb +32 -0
  15. data/lib/gitolite/gitolite_admin.rb +276 -0
  16. data/lib/gitolite/ssh_key.rb +103 -0
  17. data/lib/gitolite/version.rb +3 -0
  18. data/lib/gitolite.rb +10 -0
  19. data/spec/config_spec.rb +498 -0
  20. data/spec/dirty_proxy_spec.rb +66 -0
  21. data/spec/fixtures/configs/complicated-output.conf +72 -0
  22. data/spec/fixtures/configs/complicated.conf +311 -0
  23. data/spec/fixtures/configs/simple.conf +5 -0
  24. data/spec/fixtures/keys/bob+joe@test.zilla.com@desktop.pub +1 -0
  25. data/spec/fixtures/keys/bob-ins@zilla-site.com@desktop.pub +1 -0
  26. data/spec/fixtures/keys/bob.joe@test.zilla.com@desktop.pub +1 -0
  27. data/spec/fixtures/keys/bob.pub +1 -0
  28. data/spec/fixtures/keys/bob@desktop.pub +1 -0
  29. data/spec/fixtures/keys/bob@foo-bar.pub +1 -0
  30. data/spec/fixtures/keys/bob@zilla.com.pub +1 -0
  31. data/spec/fixtures/keys/bob@zilla.com@desktop.pub +1 -0
  32. data/spec/fixtures/keys/jakub123.pub +1 -0
  33. data/spec/fixtures/keys/jakub123@foo.net.pub +1 -0
  34. data/spec/fixtures/keys/joe-bob@god-zilla.com@desktop.pub +1 -0
  35. data/spec/fixtures/keys/joe@sch.ool.edu.pub +1 -0
  36. data/spec/fixtures/keys/joe@sch.ool.edu@desktop.pub +1 -0
  37. data/spec/gitolite_admin_spec.rb +40 -0
  38. data/spec/group_spec.rb +125 -0
  39. data/spec/repo_spec.rb +202 -0
  40. data/spec/spec_helper.rb +21 -0
  41. data/spec/ssh_key_spec.rb +355 -0
  42. metadata +280 -0
@@ -0,0 +1,311 @@
1
+ # example conf file for gitolite
2
+
3
+ # ----------------------------------------------------------------------------
4
+ # overall syntax:
5
+ # - everything is space-separated; no commas, semicolons, etc (except in
6
+ # the description string for gitweb)
7
+ # - comments in the normal shell-ish style; no surprises there
8
+ # - there are NO continuation lines of any kind
9
+ # - user/repo names as simple as possible; they must start with an
10
+ # alphanumeric, but after that they can also contain ".", "_", "-".
11
+ # - usernames can optionally be followed by an "@" and a domainname
12
+ # containing at least one "." (this allows you to use an email
13
+ # address as someone's username)
14
+ # - reponames can contain "/" characters (this allows you to
15
+ # put your repos in a tree-structure for convenience)
16
+
17
+ # objectives, over and above gitosis:
18
+ # - simpler syntax
19
+ # - easier gitweb/daemon control
20
+ # - specify who can push a branch/tag
21
+ # - specify who can rewind a branch/rewrite a tag
22
+
23
+ # ----------------------------------------------------------------------------
24
+
25
+ # GROUPS
26
+ # ------
27
+
28
+ # syntax:
29
+ # @groupname = [one or more names]
30
+
31
+ # groups let you club (user or group) names together for convenience
32
+
33
+ # * a group is like a #define in C except that it can *accumulate* values
34
+ # * the config file is parsed in a single-pass, so later *additions* to a
35
+ # group name cannot affect earlier *uses* of it
36
+
37
+ # The following examples should illustrate all this:
38
+
39
+ # you can have a group of people...
40
+ @staff = sitaram some_dev another-dev
41
+
42
+ # ...or a group of repos
43
+ @oss_repos = gitolite linux git perl rakudo entrans vkc
44
+
45
+ # ...or even a group of refexes
46
+ @important = master$ QA_done refs/tags/v[0-9]
47
+ # (see later for what "refex"s are; I'm only mentioning it
48
+ # here to emphasise that you can group them too)
49
+
50
+ # even sliced and diced differently
51
+ @admins = sitaram admin2
52
+ # notice that sitaram is in 2 groups (staff and admins)
53
+
54
+ # if you repeat a group name in another definition line, the
55
+ # new ones get added to the old ones (they accumulate)
56
+ @staff = au.thor
57
+ # so now "@staff" expands to all 4 names
58
+
59
+ # groups can include other groups, and the included group will
60
+ # be expanded to whatever value it currently has
61
+ @interns = indy james
62
+ @staff = bob @interns
63
+ # "@staff" expands to 7 names now
64
+ @interns = han
65
+ # "@interns" now has 3 names in it, but note that this does
66
+ # not change @staff
67
+
68
+ # REPO AND BRANCH PERMISSIONS
69
+ # ---------------------------
70
+
71
+ # syntax:
72
+ # start line:
73
+ # repo [one or more repos and/or repo groups]
74
+ # followed by one or more permissions lines:
75
+ # (C|R|RW|RW+|RWC|RW+C|RWD|RW+D|RWCD|RW+CD) [zero or more refexes] = [one or more users]
76
+
77
+ # there are 6 types of permissions: R, RW, and RW+ are simple (the "+" means
78
+ # permission to "rewind" -- force push a non-fast forward to -- a branch).
79
+ # The *standalone* C permission pertains to creating a REPO and is described
80
+ # in doc/wildcard-repositories.mkd. The C and D *suffixes* to the RW/RW+
81
+ # permissions pertain to creating or deleting a BRANCH, and are described in
82
+ # doc/3-faq-tips-etc.mkd, in the sections on "separating push and create
83
+ # rights" and "separating delete and rewind rights" respectively.
84
+
85
+ # how permissions are matched:
86
+ # - user, repo, and access (W or +) are known. For that combination, if
87
+ # any of the refexes match the refname being updated, the push succeeds.
88
+ # If none of them match, it fails
89
+
90
+ # what's a refex? a regex to match against the ref being updated (get it?)
91
+ # See next section for more on refexes
92
+
93
+ # BASIC PERMISSIONS (repo level only; apply to all branches/tags in repo)
94
+
95
+ # most important rule of all -- specify who can make changes
96
+ # to *this* file take effect
97
+ repo gitolite-admin
98
+ RW+ = @admins
99
+
100
+ # "@all" is a special, predefined, group name of all users
101
+ # (everyone who has a pubkey in keydir)
102
+ repo testing
103
+ RW+ = @all
104
+
105
+ # this repo is visible to staff but only sitaram can write to it
106
+ repo gitolite
107
+ R = @staff
108
+ RW+ = sitaram
109
+
110
+ # you can split up access rules for a repo for convenience
111
+ # (notice that @oss_repos contains gitolite also)
112
+ repo @oss_repos
113
+ R = @all
114
+
115
+ # set permissions to all repos. *Please* do see
116
+ # doc/3-faq-tips-etc.mkd for notes on this feature
117
+ repo @all
118
+ RW+ = @admins
119
+
120
+ # SPECIFYING AND USING A REFEX
121
+
122
+ # - refexes are specified in perl regex syntax
123
+ # - refexes are prefix-matched (they are internally anchored with "^"
124
+ # before being used), which means a refex like "refs/tags/v[0-9]"
125
+ # matches anything *starting with* that pattern. There may be text
126
+ # after it (example: refs/tags/v4-r3/p7), and it will still match
127
+
128
+ # ADVANCED PERMISSIONS USING REFEXES
129
+
130
+ # - if no refex appears, the rule applies to all refs in that repo
131
+ # - a refex is automatically prefixed by "refs/heads/" if it doesn't start
132
+ # with "refs/" (so tags have to be explicitly named as
133
+ # refs/tags/pattern)
134
+
135
+ # here's the example from
136
+ # Documentation/howto/update-hook-example.txt:
137
+
138
+ # refs/heads/master junio
139
+ # +refs/heads/pu junio
140
+ # refs/heads/cogito$ pasky
141
+ # refs/heads/bw/.* linus
142
+ # refs/heads/tmp/.* .*
143
+ # refs/tags/v[0-9].* junio
144
+
145
+ # and here're the equivalent gitolite refexes
146
+ repo git
147
+ RW = bobzilla
148
+ RW master = junio
149
+ RW+ pu = junio
150
+ RW cogito$ = pasky
151
+ RW bw/ = linus
152
+ RW tmp/ = @all
153
+ RW refs/tags/v[0-9] = junio
154
+
155
+ # DENY/EXCLUDE RULES
156
+
157
+ # ***IMPORTANT NOTES ABOUT "DENY" RULES***:
158
+
159
+ # - deny rules do NOT affect read access. They only apply to write access.
160
+ #
161
+ # - when using deny rules, the order of your rules starts to matter, where
162
+ # earlier it did not. The first matching rule applies, where "matching" is
163
+ # defined as either permitting the operation you're attempting (`W` or `+`),
164
+ # which results in success, or a "deny" (`-`), which results in failure.
165
+ # (As before, a fallthrough also results in failure).
166
+
167
+ # in the example above, you cannot easily say "anyone can write any tag,
168
+ # except version tags can only be written by junio". The following might look
169
+ # like it works but it doesn't:
170
+
171
+ # RW refs/tags/v[0-9] = junio
172
+ # RW refs/tags/ = junio linus pasky @others
173
+
174
+ # if you use "deny" rules, however, you can do this (a "deny" rule just uses
175
+ # "-" instead of "R" or "RW" or "RW+" in the permission field)
176
+
177
+ RW refs/tags/v[0-9] = junio
178
+ - refs/tags/v[0-9] = linus pasky @others
179
+ RW refs/tags/ = junio linus pasky @others
180
+
181
+ # FILE/DIR NAME BASED RESTRICTIONS
182
+ # --------------------------------
183
+
184
+ # Here's a hopefully self-explanatory example. Assume the project has the
185
+ # following contents at the top level: a README, a "doc/" directory, and an
186
+ # "src/" directory.
187
+
188
+ repo foo
189
+ RW+ = lead_dev # rule 1
190
+ RW = dev1 dev2 dev3 dev4 # rule 2
191
+
192
+ RW NAME/ = lead_dev # rule 3
193
+ RW NAME/doc/ = dev1 dev2 # rule 4
194
+ RW NAME/src/ = dev1 dev2 dev3 dev4 # rule 5
195
+ option mirror.master = mars
196
+ option mirror.slaves = phobos deimos
197
+ option mirror.redirectOK = all
198
+
199
+
200
+ repo foo2
201
+ RW+ = @all-devs
202
+ - VREF/COUNT/5 = @junior-devs
203
+ - VREF/NAME/Makefile = @junior-devs
204
+
205
+ # Notes
206
+
207
+ # - the "NAME/" is part of the syntax; think of it as a keyword if you like.
208
+ # The rest of it is treated as a refex to match against each file being
209
+ # touched (see "SPECIFYING AND USING A REFEX" above for details)
210
+
211
+ # - file/dir NAME-based restrictions are *in addition* to normal (branch-name
212
+ # based) restrictions; they are not a *replacement* for them. This is why
213
+ # rule #2 (or something like it, maybe with a more specific branch-name) is
214
+ # needed; without it, dev1/2/3/4 cannot push any branches.
215
+
216
+ # - if a repo has *any* NAME/ rules, then NAME-based restrictions are checked
217
+ # for *all* users. This is why rule 3 is needed, even though we don't
218
+ # actually have any NAME-based restrictions on lead_dev. Notice the pattern
219
+ # on rule 3.
220
+
221
+ # - *each* file touched by the commits being pushed is checked against those
222
+ # rules. So, lead_dev can push changes to any files, dev1/2 can push
223
+ # changes to files in "doc/" and "src/" (but not the top level README), and
224
+ # dev3/4 can only push changes to files in "src/".
225
+
226
+ # GITWEB AND DAEMON STUFF
227
+ # -----------------------
228
+
229
+ # No specific syntax for gitweb and daemon access; just make the repo readable
230
+ # ("R" access) to the special users "gitweb" and "daemon"
231
+
232
+ # make "@oss_repos" (all 7 of them!) accessible via git daemon
233
+ repo @oss_repos
234
+ R = daemon
235
+
236
+ # make the two *large* repos accessible via gitweb
237
+ repo linux perl
238
+ R = gitweb
239
+
240
+ # REPO OWNER/DESCRIPTION LINE FOR GITWEB
241
+
242
+ # syntax, one of:
243
+ # reponame = "some description string in double quotes"
244
+ # reponame "owner name" = "some description string in double quotes"
245
+
246
+ # note: setting a description also gives gitweb access; you do not have to
247
+ # give gitweb access as described above if you're specifying a description
248
+
249
+ gitolite "Sitaram Chamarty" = "fast, secure, access control for git in a corporate environment"
250
+ foo = "Foo is a nice test repo"
251
+ foobar "Bob Zilla" = "Foobar is top secret"
252
+ bar = "A nice place to get drinks"
253
+
254
+ # REPO SPECIFIC GITCONFIG
255
+ # -----------------------
256
+
257
+ # update 2010-02-06; this won't work unless the rc file has the right
258
+ # settings; please see comments around the variable $GL_GITCONFIG_KEYS in
259
+ # conf/example.gitolite.rc for details and security information.
260
+
261
+ # (Thanks to teemu dot matilainen at iki dot fi)
262
+
263
+ # this should be specified within a "repo" stanza
264
+
265
+ # syntax:
266
+ # config sectionname.keyname = [optional value_string]
267
+
268
+ # example usage: if you placed a hook in hooks/common that requires
269
+ # configuration information that is specific to each repo, you could do this:
270
+
271
+ repo gitolite
272
+ config hooks.mailinglist = gitolite-commits@example.tld
273
+ config hooks.emailprefix = "[gitolite] "
274
+ config foo.bar = ""
275
+ config foo.baz =
276
+
277
+ # This does either a plain "git config section.key value" (for the first 3
278
+ # examples above) or "git config --unset-all section.key" (for the last
279
+ # example). Other forms (--add, the value_regex, etc) are not supported.
280
+
281
+ # INCLUDE SOME OTHER FILE
282
+ # -----------------------
283
+
284
+ include "foo.conf"
285
+ subconf "bar.conf"
286
+
287
+ # this includes the contents of $GL_ADMINDIR/conf/foo.conf here
288
+
289
+ # Notes:
290
+ # - the include statement is not allowed inside delegated fragments for
291
+ # security reasons.
292
+ # - you can also use an absolute path if you like, although in the interests
293
+ # of cloning the admin-repo sanely you should avoid doing this!
294
+
295
+ # EXTERNAL COMMAND HELPERS -- RSYNC
296
+ # ---------------------------------
297
+
298
+ # If $RSYNC_BASE is non-empty, the following config entries come into play
299
+ # (otherwise they are ignored):
300
+
301
+ # a "fake" git repository to collect rsync rules. Gitolite does not
302
+ # auto-create any repo whose name starts with EXTCMD/
303
+ repo EXTCMD/rsync
304
+ # grant permissions to files/dirs within the $RSYNC_BASE tree. A leading
305
+ # NAME/ is required as a prefix; the actual path starts after that. Matching
306
+ # follows the same rules as given in "FILE/DIR NAME BASED RESTRICTIONS" above
307
+ RW NAME/ = sitaram
308
+ RW NAME/foo/ = user1
309
+ R NAME/bar/ = user2
310
+ # just to remind you that these are perl regexes, not shell globs
311
+ RW NAME/baz/.*/*.c = user3
@@ -0,0 +1,5 @@
1
+ repo gitolite-admin
2
+ RW+ = bobzilla
3
+
4
+ repo testing
5
+ RW+ = @all
@@ -0,0 +1 @@
1
+ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsRofYfjAUdw0McxGpLTxBbZyKN05HGY19ZIjEQmBPUe2Skt1i/SLwIYzTzKv6vEgAdT9SwmCsO/jpDY/ZM+MhWy4okBisn04yIHCW10q4+YNo2WatzttEa1W+hC58nKtoq/0HkvPVdoeOZxcNtpjvgvkrXH2zdmX7xnA1AAWtqRNkRYWPKjiojkg92aqmJLISSIDeZs2wvXbFO3BJhkvyr3W60cinKhGBBscvdCYUi5pb9dXIFhEEqRf1JkT5CEmF3p4GqSt4/L79nR0LV45grS4NbcN+fCnjWZ8PQhmJ+WPLKkydgR1YvobeY7zDHdHJXWLhsPa+SjwI3WfzrB+GQ== bob@zilla.com
@@ -0,0 +1 @@
1
+ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsRofYfjAUdw0McxGpLTxBb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FBSrfMirQCEneTiLOO/vAibWLzTRWSVyRT9YJYeH0Cp5dXnu3MqPL6+PhaP+iDtx6Vo/h2jeCJZpJUJb7dX9nl/Q== joe@sch.ool.edu
@@ -0,0 +1 @@
1
+ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAt6+DWErgYKwCLQ+1DiD05iZc1FFgU2n+QXSqAOIjU5O2FKVgGU5JLOGydidOUK/vWRrPmS045Iv4BxTPIUPMLjn9lBjUkY7ZxfJb5aSW+9zwE/5/073DswRwHVZuxsxfScgqkwenTjN6bbM+qnASn+b6yxfRLmp86IzIXxKp2EiJ4Anw/9oUxre/K25WemTo8eUfKLfTS+z0KLSs1C9TJpO/MkDkHiv1S2wcnduA+nVcbSo7MuxrVDdQIQcDf0gKwwLwxtvKZXtUWC3Ji9kn3F86aRVBuMcl068t+UbbKvLc0BKo7RFMQ+nHXHosu1GJBwal+wWygbBksTk+92hRGQ== joe@sch.ool.edu
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ require 'fakefs/spec_helpers'
3
+
4
+ describe Gitolite::GitoliteAdmin do
5
+ conf_dir = File.join(File.dirname(__FILE__), 'fixtures', 'configs')
6
+ repo_dir = File.join(File.dirname(__FILE__), 'fixtures', 'gitolite-admin')
7
+
8
+ # Rugged doesn't complain when giving nil keys for testing
9
+ settings = {private_key: nil, public_key: nil}
10
+
11
+ describe '#is_gitolite_admin_repo?' do
12
+ it 'should detect a non gitolite-admin repository' do
13
+ expect(GitoliteAdmin.is_gitolite_admin_repo?('/tmp')).to be false
14
+ end
15
+ end
16
+
17
+ describe '#save' do
18
+ it 'should commit file to gitolite-admin repository' do
19
+ Dir.mktmpdir('gitolite-rugged-admin-repo') do |dir|
20
+
21
+ tmp_repo = File.join(dir, "gitolite-admin")
22
+ FileUtils.cp_r(repo_dir, tmp_repo)
23
+ FileUtils.mv(File.join(tmp_repo, ".gitted"), File.join(tmp_repo, '.git'))
24
+
25
+ gl_admin = GitoliteAdmin.new(tmp_repo, settings)
26
+
27
+ c = Gitolite::Config.new(File.join(conf_dir, 'complicated.conf'))
28
+ c.filename = 'gitolite.conf'
29
+
30
+ gl_admin.config = c
31
+ gl_admin.save
32
+
33
+ new_file = File.join(tmp_repo, 'conf', c.filename)
34
+ expect(File.file?(new_file)).to be true
35
+ expect(IO.read(new_file)).to eq IO.read(File.join(conf_dir, 'complicated-output.conf'))
36
+ end
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,125 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gitolite::Config::Group do
4
+ describe "#new" do
5
+ it "should create a new group with an empty list of users" do
6
+ group = Gitolite::Config::Group.new("testgroup")
7
+ group.users.empty?.should be true
8
+ group.name.should == "testgroup"
9
+ end
10
+
11
+ it "should create a new group with a name containing #{Gitolite::Config::Group::PREPEND_CHAR}" do
12
+ name = "#{Gitolite::Config::Group::PREPEND_CHAR}testgroup"
13
+ group = Gitolite::Config::Group.new(name)
14
+ group.name.should == "testgroup"
15
+ end
16
+ end
17
+
18
+ describe "users" do
19
+ before :each do
20
+ @group = Gitolite::Config::Group.new('testgroup')
21
+ end
22
+
23
+ describe "#add_user" do
24
+ it "should allow adding one user with a string" do
25
+ @group.add_user("bob")
26
+ @group.size.should == 1
27
+ @group.users.first.should == "bob"
28
+ end
29
+
30
+ it "should allow adding one user with a symbol" do
31
+ @group.add_user(:bob)
32
+ @group.size.should == 1
33
+ @group.users.first.should == "bob"
34
+ end
35
+
36
+ it "should not add the same user twice" do
37
+ @group.add_user("bob")
38
+ @group.size.should == 1
39
+ @group.add_user(:bob)
40
+ @group.size.should == 1
41
+ @group.users.first.should == "bob"
42
+ end
43
+
44
+ it "should maintain users in sorted order" do
45
+ @group.add_user("susan")
46
+ @group.add_user("peyton")
47
+ @group.add_user("bob")
48
+ @group.users.first.should == "bob"
49
+ @group.users.last.should == "susan"
50
+ end
51
+ end
52
+
53
+ describe "#add_users" do
54
+ it "should allow adding multiple users at once" do
55
+ @group.add_users("bob", "joe", "sue", "sam", "dan")
56
+ @group.size.should == 5
57
+ end
58
+
59
+ it "should allow adding multiple users in nested arrays" do
60
+ @group.add_users(["bob", "joe", ["sam", "sue", "dan"]], "bill")
61
+ @group.size.should == 6
62
+ end
63
+
64
+ it "should allow adding users of symbols and strings" do
65
+ @group.add_users("bob", :joe, :sue, "sam")
66
+ @group.size.should == 4
67
+ end
68
+
69
+ it "should not add the same user twice" do
70
+ @group.add_users("bob", :bob, "bob", "sam")
71
+ @group.size.should == 2
72
+ end
73
+ end
74
+
75
+ describe "#rm_user" do
76
+ before :each do
77
+ @group.add_users("bob", "joe", "susan", "sam", "alex")
78
+ end
79
+
80
+ it "should support removing a user via a String" do
81
+ @group.rm_user("bob")
82
+ @group.size.should == 4
83
+ end
84
+
85
+ it "should support removing a user via a Symbol" do
86
+ @group.rm_user(:bob)
87
+ @group.size.should == 4
88
+ end
89
+ end
90
+
91
+ describe "#empty!" do
92
+ it "should clear all users from the group" do
93
+ @group.add_users("bob", "joe", "sue", "jim")
94
+ @group.size.should == 4
95
+ @group.empty!
96
+ @group.size.should == 0
97
+ end
98
+ end
99
+
100
+ describe "#size" do
101
+ it "should reflect how many users are in the group" do
102
+ @group.add_users("bob", "joe", "sue", "jim")
103
+ @group.users.length.should == @group.size
104
+ end
105
+ end
106
+
107
+ describe "#has_user?" do
108
+ it "should search for a user via a String" do
109
+ @group.add_user("bob")
110
+ @group.has_user?("bob").should be true
111
+ end
112
+
113
+ it "should search for a user via a Symbol" do
114
+ @group.add_user(:bob)
115
+ @group.has_user?(:bob).should be true
116
+ end
117
+ end
118
+ end
119
+
120
+ describe "#to_s" do
121
+ group = Gitolite::Config::Group.new("testgroup")
122
+ group.add_users("bob", "joe", "sam", "sue")
123
+ group.to_s.should == "@testgroup = bob joe sam sue\n" #10 spaces after @testgroup
124
+ end
125
+ end