Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
chore: adds docs and build framework
Browse files Browse the repository at this point in the history
  • Loading branch information
kbknapp committed Jun 3, 2015
1 parent 8f07146 commit 677e087
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 114 deletions.
10 changes: 10 additions & 0 deletions .clog.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[clog]
repository = "https://github.com/kbknapp/docli-rs"
outfile = "CHANGELOG.md"
from-latest-tag = true

[sections]
Performance = ["perf"]
Improvements = ["impr", "im", "imp"]
Documentation = ["docs"]
Deprecations = ["depr"]
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: rust
rust:
- nightly
before_script:
- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
script:
- travis-cargo build
- travis-cargo test
- travis-cargo doc
after_success:
- travis-cargo doc-upload
env:
global:
secure: JLBlgHY6OEmhJ8woewNJHmuBokTNUv7/WvLkJGV8xk0t6bXBwSU0jNloXwlH7FiQTc4TccX0PumPDD4MrMgxIAVFPmmmlQOCmdpYP4tqZJ8xo189E5zk8lKF5OyaVYCs5SMmFC3cxCsKjfwGIexNu3ck5Uhwe9jI0tqgkgM3URA=
41 changes: 21 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "docli"
version = "0.1.0"
version = "0.1.0-alpha"
authors = ["Kevin K <kbknapp@gmail.com>"]
description = "A command line interface to managing DigitalOcean infrastructure"
description = "A command line utility to managing DigitalOcean infrastructure"
license = "MIT"
repository = "https://github.com/kbknapp/docli-rs.git"
documentation = "http://kbknapp.github.io/docli-rs"
Expand All @@ -12,11 +12,7 @@ keywords = ["do", "cli", "digitalocean", "digital", "ocean"]

[dependencies]
clap = "*"


[dependencies.doapi]
# git = "https://github.com/kbknapp/doapi-rs"
path = "../doapi-rs"
doapi = {git = "https://github.com/kbknapp/doapi-rs"}


[features]
Expand Down
File renamed without changes.
126 changes: 124 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,124 @@
# docli-rs
Command-line utility for managing DigitalOcean infrastructure
# docli-rs (pronounced "dockly")

[![Build Status](https://travis-ci.org/kbknapp/docli-rs.svg?branch=master)](https://travis-ci.org/kbknapp/docli-rs) [![Crates.io](https://img.shields.io/crates/v/docli.svg)]() [![Crates.io](https://img.shields.io/crates/l/docli.svg)]() [![Join the chat at https://gitter.im/kbknapp/docli-rs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kbknapp/docli-rs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

A command-line utility for managing DigitalOcean infrastructure via the [DigitalOcean API v2](https://developers.digitalocean.com/documentation/)

## Disclaimer
This library is in alpha - it may do anything up to, and including, eating your laundry. You can check the request being sent to DigitalOcean without sending via the `--nosend --verbose` flags

## Installation

### Linux / OSX

If you are on Arch linux, you can install from the AUR via the `docli-git` (requires a nightly Rust compiler) or `docli-bin` package. Otherwise you can try one of the pre-compiled binaries:

#### Linux x86_64

Assuming you're familiar `$PATH`, download the tar.gz, unzip, and copy to somewhere in your `$PATH`

```sh
$ wget http://wod.twentyfives.net/bin/docli/docli-v0.1.0-alpha_linux-x64.tar.gz
$ tar xvf docli-v0.1.0-alpha_linux-x64.tar.gz
$ cp docli ~/.bin
```
In the example `~/.bin` is in `$PATH`

#### OSX x86_64

Assuming you're familiar `$PATH`, download the tar.gz, unzip, and copy to somewhere in your `$PATH`

```sh
$ wget http://wod.twentyfives.net/bin/docli/docli-v0.1.0-alpha_osx-x64.tar.gz
$ tar xvf docli-v0.1.0-alpha_osx-x64.tar.gz
$ cp docli ~/.bin
```
In the example `~/.bin` is in `$PATH`

### Windows

I have not tried compiling on Windows yet. Feel free to clone the repository and attempt to compile with a nightly Rust compiler

## Compile from source

If you'd rather compile from source (takes about 2 minutes on a decent machine) use the following (Assuming you already have a nightly Rust compiler):

```sh
$ git clone https://github.com/kbknapp/docli-rs
$ cd docli-rs
$ cargo build --release
$ cp target/release/docli ~/.bin
```

## Usage

You can run `docli` from the command line and various subcommands. In order to see what commands are available, run `docli --help` or `docli <command> --help`

```sh
docli v0.1.0alpha
Kevin K. <kbknapp@gmail.com>
A utility for managing DigitalOcean infrastructure

USAGE:
docli [FLAGS] [OPTIONS] [SUBCOMMANDS]

FLAGS:
-h, --help Prints help information
-n, --nosend Does NOT send request over the network (useful with --verbose)
--version Prints version information
-v, --verbose Displays the request being sent to server

OPTIONS:
-t, --token <token> Digital Ocean Auth Token (Defaults to contents of DO_AUTH_TOKEN env var if omitted)

SUBCOMMANDS:
account Commands related to a single account
dns Commands for managing DNS records on a specific domain
domains Commands for managing domains
droplet Commands for managing a single droplet
droplets Commands for managing droplets
help Prints this message
image Commands for managing images
list Commands for displaying available information
ssh-keys Commands for managing SSH keys
```
### DigitalOcean Personal Auth Token
In order to use the DigitalOcean v2 API (which is what `docli` uses under the covers, you must generate a Personal Authentication Token. This token can then either be passed to `docli` directly with `--token <token>` or you can set a `DO_AUTH_TOKEN` environmental variable before using `docli`. To do using Linux or OSX, open a terminal and run the following (test with `docli account` which lists your account information):
```sh
$ export DO_AUTH_TOKEN=<PAST YOUR TOKEN HERE>
$ docli account
```
Personal Auth Token's can be Read/Write, or Read Only/Write Only. In order to process destructive API calls (i.e. ones that modify existing information) you *must* have a token with Write priviledges.
To generate a new Personal Auth Token see the [following DigitalOcean details](https://developers.digitalocean.com/documentation/v2/#authentication)
## Contributing
Contributions are always welcome! And there is a multitude of ways in which you can help depending on what you like to do, or are good at. Anything from documentation, code cleanup, issue completion, new features, you name it, even filing issues is contributing and greatly appreciated!
**NOTE:** One of the best ways to help right now is to simply use the utility and report issues!
1. Fork `docli`
2. Clone your fork (`git clone https://github.com/$YOUR_USERNAME/docli-rs && cd docli-rs`)
3. Create new branch (`git checkout -b new-branch`)
4. Make your changes, and commit (`git commit -am "your message"`)
* I use a [conventional](https://github.com/ajoslin/conventional-changelog/blob/master/CONVENTIONS.md) changelog format so I can update my changelog using [clog](https://github.com/thoughtram/clog)
* Format your commit subject line using the following format: `TYPE(COMPONENT): MESSAGE` where `TYPE` is one of the following:
- `feat` - A new feature
- `imp` - An improvement to an existing feature
- `perf` - A performance improvement
- `docs` - Changes to documentation only
- `tests` - Changes to the testing framework or tests only
- `fix` - A bug fix
- `refactor` - Code functionality doesn't change, but underlying structure may
- `style` - Stylistic changes only, no functionality changes
- `wip` - A work in progress commit (Should typically be `git rebase`'ed away)
- `chore` - Catch all or things that have to do with the build system, etc
* The `COMPONENT` is optional, and may be a single file, directory, or logical component. Can be omitted if commit applies globally
5. `git rebase` into concise commits and remove `--fixup`s (`git rebase -i HEAD~NUM` where `NUM` is number of commits back)
6. Push your changes back to your fork (`git push origin $your-branch`)
7. Create a pull request! (You can also create the pull request first, and we'll merge when ready. This a good way to discuss proposed changes.)
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="refresh" content="0; url=http://kbknapp.github.io/docli-rs/docs/docli/index.html" />
31 changes: 31 additions & 0 deletions pkg/os/arch/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Maintainer: Kevin K. <kbknapp at google mail>

_pkgname=docli
pkgname=${_pkgname}-git
pkgver=0.1.0-alpha
pkgrel=1
pkgdesc='command line utility for managing digitalocean infrastructure'
arch=('i686' 'x86_64')
url="https://github.com/kbknapp/${_pkgname}-rs"
license=('MIT')
makedepends=('git' 'cargo' 'rust')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=("git://github.com/kbknapp/${_pkgname}-rs.git")
md5sums=('SKIP')

pkgver() {
cd "$srcdir/$_pkgname"
git rev-list --count HEAD
}

build() {
cd "$srcdir/$_pkgname"
cargo build --release
}

package() {
cd "$srcdir/$_pkgname"
mkdir -p "${pkgdir}/usr/bin"
cp -p "target/release/${_pkgname}" "${pkgdir}/usr/bin"
}
4 changes: 2 additions & 2 deletions src/cli/droplet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn run(m: &ArgMatches, cfg: &mut Config) {
}
}
}
CliMessage::DropletKernels(id).display();
CliMessage::DropletSnapshots(id).display();
match domgr.droplet(id).snapshots().retrieve() {
Ok(v) => {
CliMessage::Success.display();
Expand Down Expand Up @@ -752,7 +752,7 @@ pub fn run(m: &ArgMatches, cfg: &mut Config) {
}
}
}
CliMessage::SnapshotDroplet(id).display();
CliMessage::SnapshotDroplet(id, name).display();
match domgr.droplet(id).snapshot(name).retrieve() {
Ok(s) => {
CliMessage::Success.display();
Expand Down
Loading

0 comments on commit 677e087

Please sign in to comment.