Client library and CLI to handle Git repositories on Codeplane. For more about Codeplane see codeplane.com.
gem install codeplane
First, you'll need to set up your username and API key. You can discover this information by accessing your account at codeplane.com/account.
Codeplane.configure do |config| config.username = "john" config.api_key = "d09513d5bab641f7ff0b" end
Then you can simply instantiate a new Codeplane::Client object.
cp = Codeplane::Client.new
List repositories you have access:
Create new repository:
myrepo = cp.repositories.build(:name => "myrepo") myrepo.save # or myrepo = cp.repositories.create(:name => "myrepo")
Destroy a repository created by you:
myrepo.destroy if myrepo.mine?
SSH public keys
List SSH public keys:
Add a new public key:
mykey = cp.public_keys.build(:name => "Macbook") mykey.save # or mykey = cp.public_keys.create(:name => "Macbook")
Destroy a public key:
users = myrepo.collaborators.all
Invite new collaborators:
Revoke permissions on a repository:
The codeplane gem also comes with a command line.
$ codeplane help
You can use it to manage repositories, SSH public keys and collaborators.
First, you have to set up your credentials. Just run codeplane setup and follow the on-screen instructions.
# List repositories $ codeplane repo some-repo => email@example.com:john/some-repo.git server-confs => firstname.lastname@example.org:john/server-confs.git app => email@example.com:mary/server-confs.git # Show info about repository $ codeplane repo:info some-repo Name: some-repo Git url: firstname.lastname@example.org:john/some-repo.git Usage: 1.5MB # Create a new repository called `my-new-repo` $ codeplane repo:add my-new-repo Your clone uri is email@example.com:john/my-new-repo.git Give it some time before cloning it. # Remove the `my-new-repo` repository $ codeplane repo:remove my-new-repo $ codeplane repo:remove test Do you want to continue? (yes/no): yes The repository 'my-new-repo' has been removed
SSH Public Keys
# List all public keys $ codeplane auth example.com # ba:b2:51:45:68:68:d8:2c:11:02:c8:0c:6b:07:3c:00 # Add a new public key (~/.ssh/id_rsa.pub) named "Macbook" $ codeplane auth:add Macbook ~/.ssh/id_rsa.pub Your SSH public key 'Macbook' was added # Remove a public key. You need to provide the id # returned by `codeplane ssh`. $ codeplane auth:remove Macbook The SSH key 'Macbook' has been removed
# List all collaborators on a given repository $ codeplane user some-repo Mary Doe # firstname.lastname@example.org Tim Doe # email@example.com # Add new collaborator $ codeplane user:add some-repo firstname.lastname@example.org We sent an invitation to email@example.com # Remove collaborator $ codeplane user:add some-repo firstname.lastname@example.org We revoked email@example.com permissions on 'some-repo'
(The MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.