rubolite 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +72 -6
- data/lib/rubolite/client.rb +1 -0
- data/lib/rubolite/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,13 +1,79 @@
|
|
1
|
-
|
1
|
+
Rubolite
|
2
2
|
========
|
3
3
|
|
4
4
|
Rubolite is an interface to Gitolite (https://github.com/sitaramc/gitolite)
|
5
5
|
|
6
|
-
|
6
|
+
@robertross
|
7
7
|
|
8
|
+
|
9
|
+
Usage
|
10
|
+
=====
|
11
|
+
|
12
|
+
```gem "rubolite"```
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
admin = Rubolite::Admin.new("/Users/robertross/Sites/gitolite-admin")
|
16
|
+
client = admin.client
|
17
|
+
client.repos # Get a list of repos
|
18
|
+
|
19
|
+
repo = Rubolite::Repo.new("newrepository")
|
20
|
+
user = Rubolite::User.new("robert", "RW+")
|
21
|
+
|
22
|
+
repo.add_user user
|
23
|
+
|
24
|
+
client.add_repo repo
|
25
|
+
|
26
|
+
client.save_and_push!
|
8
27
|
```
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
28
|
+
|
29
|
+
### Wait what?
|
30
|
+
|
31
|
+
* Rubolite requires that you tell it where your admin repository is on your box. It does not bootstrap this for you. Gitolite must be setup.
|
32
|
+
* Once you have that, the Rubolite::Admin class returns a client object by calling ```admin.client```. You do most of your calls on this interface.
|
33
|
+
* To get a list of repos in the current config, call ```client.repos```
|
34
|
+
* To add a repository to your config, insantiate a Repo object with a name.
|
35
|
+
* Repo objects take users which are instantiated with a name and permission level. Example: ```user = Rubolite::User.new("robert", "RW+")```
|
36
|
+
* Then we add the user to the repo with ```Repo#add_user```
|
37
|
+
* Then we add the repo to the client with ```Client#add_repo```
|
38
|
+
|
39
|
+
Calling ```save_and_push!``` does the following:
|
40
|
+
|
41
|
+
* Writes the new configuration file.
|
42
|
+
* Saves any SSH Keys you may have added (see below)
|
43
|
+
* Commits the changes to the gitolite-admin repo
|
44
|
+
* Pushes them to your origin remote.
|
45
|
+
|
46
|
+
If you really desire, you may call the methods individually. The methods are:
|
47
|
+
|
48
|
+
* ```save!``` Writes the config.
|
49
|
+
* ```save_ssh_keys!``` Writes SSH keys that may have been added.
|
50
|
+
* ```commit!``` Commits the changes on gitolite-admin.
|
51
|
+
* ```push!``` Pushes the repository to origin master.
|
52
|
+
|
53
|
+
### Dealing with SSH Keys
|
54
|
+
|
55
|
+
SSH Keys are handled by the Rubolite::SSHKey object.
|
56
|
+
|
57
|
+
#### From a string
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
ssh_key = Rubolite::SSHKey.from_string("ssh-rsa awesomekeyprint robertross@local")
|
61
|
+
```
|
62
|
+
|
63
|
+
#### From a file
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
ssh_key = Rubolite::SSHKey.from_file("~/.ssh/id_rsa.pub")
|
67
|
+
```
|
68
|
+
|
69
|
+
### Adding them to a gitolite-admin repo
|
70
|
+
|
71
|
+
Call ```add_ssh_key``` on your client with 2 parameters: username, and the ssh key object.
|
72
|
+
|
73
|
+
Your username must be the same name as the Rubolite::User name you add to repositories.
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
repo = Rubolite::Repo.new("new-repo")
|
77
|
+
repo.add_user Rubolite::User.new("robert", "RW+")
|
78
|
+
client.add_ssh_key "robert", ssh_key
|
13
79
|
```
|
data/lib/rubolite/client.rb
CHANGED
data/lib/rubolite/version.rb
CHANGED