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 CHANGED
@@ -1,13 +1,79 @@
1
- rubolite
1
+ Rubolite
2
2
  ========
3
3
 
4
4
  Rubolite is an interface to Gitolite (https://github.com/sitaramc/gitolite)
5
5
 
6
- This is a work in progress. It's end goal is to give a full interface to interact with Gitolite and save changes.
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
- >> admin = Rubolite::Admin.new("/Users/robertross/Sites/gitolite-admin")
10
- => #<Rubolite::Admin:0x007f96be332de8 @path="/Users/robertross/Sites/gitolite-admin">
11
- >> admin.parser.repos.first
12
- => #<Rubolite::Repo:0x007f96be347068 @name="gitolite-admin", @users=[#<Rubolite::User:0x007f96be346dc0 @name="gitolite", @permissions="RW+">]>
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
  ```
@@ -38,6 +38,7 @@ module Rubolite
38
38
  end
39
39
 
40
40
  def commit!
41
+ admin.git.add('.')
41
42
  admin.git.commit_all("Modified configuration by rubolite")
42
43
  end
43
44
 
@@ -1,3 +1,3 @@
1
1
  module Rubolite
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubolite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: