gitolite 0.0.3.alpha → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,144 +0,0 @@
1
- = gitolite - In alpha
2
-
3
- This gem is designed to provide a Ruby interface to the {gitolite}[https://github.com/sitaramc/gitolite] git backend system. I am aiming to provide all management functionality that is available via the gitolite-admin repository (like SSH keys, repository permissions, etc)
4
-
5
- This gem is still under very active development. There are a number of issues with it still. It is not ready for production use.
6
-
7
- == Features
8
- * Allows for the creation and management of repos within gitolite
9
- * Allows for the creation and deletion of SSH keys within gitolite
10
- * Allows for the bootstrapping of a gitolite-admin repository
11
-
12
- == Issues
13
- * Gem is not thread safe. For now, the gem will change directories in order to perform git operations. It will, however, return to the old working directory once it is finished. I am looking into making the gem thread safe.
14
-
15
- == Requirements
16
- * Ruby 1.8.x or 1.9.x
17
- * a working {gitolite}[https://github.com/sitaramc/gitolite] installation
18
- * the <tt>gitolite-admin</tt> repository checked out locally
19
-
20
- == Installation
21
-
22
- gem install gitolite --pre
23
-
24
- == Usage
25
-
26
- === Load a gitolite-admin repo
27
-
28
- require 'gitolite'
29
- ga_repo = Gitolite::GitoliteAdmin.new("/path/to/gitolite/admin/repo")
30
-
31
- This method can only be called on an existing gitolite-admin repo. If you need to create a new gitolite-admin repo, see "Bootstrapping".
32
-
33
- === Configuration Files
34
-
35
- conf = ga_repo.config
36
-
37
- #Empty configs can also be initialized
38
- conf2 = Config.init # => defaults to a filename of gitolite.conf
39
- conf2 = Config.init("new_config.conf")
40
-
41
- #Filename is set to whatever the filename was when the config was created
42
- conf.filename # => "gitolite.conf"
43
- conf2.filename # => "new_config.conf")
44
-
45
- #filename can be changed via the setter
46
- conf2.filename = "new_config.conf"
47
-
48
- #to_file will write the config out to the file system
49
- #using the value of the filename attribute. An alternative
50
- #filename can also be specified
51
- conf.to_file("/new/config/path") # => writes /new/config/path/gitolite.conf
52
- conf.to_file("/new/config/path", "test.conf") # => writes /new/config/path/test.conf
53
-
54
- === Repo management
55
-
56
- repo = Gitolite::Config::Repo.new("AwesomeRepo")
57
-
58
- #For a list of permissions, see https://github.com/sitaramc/gitolite/blob/pu/doc/gitolite.conf.mkd
59
- repo.add_permission("RW+", "", "bob", "joe", "susan")
60
-
61
- #Add repo to config
62
- conf.add_repo(repo)
63
-
64
- #Delete repo by object
65
- conf.rm_repo(repo)
66
-
67
- #Delete a repo by name
68
- conf.rm_repo("AwesomeRepo")
69
- conf.rm_repo(:AwesomeRepo)
70
-
71
- #Test if repo exists by name
72
- conf.has_repo?('cool_repo') # => false
73
- conf.has_repo?(:cool_repo) # => false
74
-
75
- #Can also pass a Gitolite::Config::Repo object
76
- repo = Gitolite::Config::Repo.new('cool_repo')
77
- conf.has_repo?(repo) # => true
78
-
79
- #Get a repo object from the config
80
- repo = conf.get_repo('cool_repo')
81
- repo = conf.get_repo(:cool_repo)
82
-
83
- === SSH Key Management
84
-
85
- #Two ways to create keys: manually or from an existing key
86
- key = Gitolite::SSHKey.new("ssh-rsa", "big-public-key-blob", "email")
87
- key2 = Gitolite::SSHKey.from_file("/path/to/ssh/key.pub")
88
-
89
- #Add the keys
90
- ga_repo.add_key(key)
91
- ga_repo.add_key(key2)
92
-
93
- #Remove key2
94
- ga_repo.rm_key(key2)
95
-
96
- === Save changes
97
-
98
- ga_repo.save
99
-
100
- When this method is called, all changes get written to the file system and staged in git. For the time being, gitolite assumes full control of the gitolite-admin repository. This means that any keys in the keydir that are not being tracked will be removed and any human changes to gitolite.conf will be erased.
101
-
102
- === Apply changes
103
- ga_repo.apply
104
-
105
- This method will commit all changes with a generic message (will be improved upon later) and push to <tt>origin master</tt>.
106
-
107
- === Save and apply
108
- ga_repo.save_and_apply
109
-
110
- === Bootstrapping
111
- ga_repo = GitoliteAdmin.bootstrap("/path/to/new/gitolite/repo")
112
-
113
- This will create the folders <tt>conf</tt> and <tt>keydir</tt> in the supplied path. A config file will also be created in the conf directory. The default configuration supplies RW+ permissions to a user named git for a repo named <tt>gitolite-admin</tt>. You can specify an options hash to change some values:
114
-
115
- ga_repo = GitoliteAdmin.bootstrap("/path/to/new/gitolite/repo", {:user => "admin", :perm => "RW"})
116
-
117
- You can also pass a message to be used for the initial bootstrap commit:
118
-
119
- ga_repo = GitoliteAdmin.bootstrap("/path/to/new/gitolite/repo", {:message => "Bootstrapped new repo"})
120
-
121
- Please note that while bootstrapping is supported, I highly recommend that the initial gitolite-admin repo be created by gitolite itself.
122
-
123
- == Caveats
124
- === Windows compatibility
125
- The grit gem (which is used for under-the-hood git operations) does not currently support Windows. Until it does, gitolite will be unable to support Windows.
126
-
127
- == Contributing
128
- * Tests! If you ask me to pull changes that are not adequately tested, I'm not going to do it.
129
- * If you introduce new features/public methods on objects, you must update the README.
130
-
131
- === Contributors
132
- * Alexander Simonov - {simonoff}[https://github.com/simonoff]
133
-
134
- == Documentation
135
- * Rdoc is coming soon
136
-
137
- == Future
138
- * support folders in the keydir
139
- * support include tags
140
- * support pull operations to sync the local gitolite-admin repository with the server
141
- * cleanup methods to make adding and removing easier (like add_key should accept an array of keys)
142
- * Rails integration
143
- * Make the gem thread safe
144
- * Add full support for Wildcard repos