cabal-api 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +58 -14
- data/cabal-api.gemspec +4 -3
- data/lib/cabal/api/version.rb +1 -1
- metadata +21 -9
- data/bin/console +0 -14
- data/bin/setup +0 -7
- data/config/cucumber.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e347e3023c8af9e9765984b986201d023f4bc13c
|
4
|
+
data.tar.gz: ae6ac8fc86ebb16576011b9f3265a0069396f3e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cc38762dbe44aab4d7308eeb3773bc42991a3beba93b8437899734f601d1638b8a2e8ab1b14072ff0fa36de03336da34e3f829868291c11891a7f4804d64995
|
7
|
+
data.tar.gz: 0b81be37313d635bb98041164b5c86da68b55406e592a50a450282e98aeab5ab2020429f75f3ae161ff2f66df0eeb6610b3242c49422cde05f3eaa6898c07a93
|
data/README.md
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
# Cabal::
|
1
|
+
# Cabal::API #
|
2
2
|
|
3
|
-
|
3
|
+
Cabal is a simple system for SSH key distribution and consumption. This is the HTTP API that acts as the basis for both of those operations.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
## Installation
|
5
|
+
## Installation ##
|
8
6
|
|
9
7
|
Add this line to your application's Gemfile:
|
10
8
|
|
11
9
|
```ruby
|
12
|
-
gem 'cabal-api'
|
10
|
+
gem 'cabal-api', require: 'cabal/api'
|
13
11
|
```
|
14
12
|
|
15
13
|
And then execute:
|
@@ -18,22 +16,68 @@ And then execute:
|
|
18
16
|
|
19
17
|
Or install it yourself as:
|
20
18
|
|
21
|
-
$ gem install cabal-
|
19
|
+
$ gem install cabal-util
|
20
|
+
|
21
|
+
## Usage ##
|
22
|
+
|
23
|
+
This API is implemented via Grape, which means that you can mount it the same way that you can any Rack application. You'll need a Redis endpoint for the API to use (it defaults to `redis://localhost:6379`), and this is configured via the `REDIS_URL` environment variable.
|
24
|
+
|
25
|
+
Here's an example `config.ru` that mounts the API to the "/api" namespace:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'cabal/api'
|
29
|
+
|
30
|
+
map "/api" do
|
31
|
+
run Cabal::API::Base
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
You can then start that configuration like so:
|
36
|
+
|
37
|
+
```bash
|
38
|
+
REDIS_URL="redis://your-redis-server:port/db" rackup config.ru
|
39
|
+
```
|
40
|
+
|
41
|
+
### APIv1 ###
|
42
|
+
|
43
|
+
The v1 API is entirely public (no authenticated routes). The routes for this version are as follows (provided that the API is mounted on "/api"):
|
44
|
+
|
45
|
+
* *GET /api/v1/key/clustername*
|
46
|
+
|
47
|
+
> This returns the public key for the given cluster name. If the cluster is not already known, it is created and a key is generated. Supported formats are:
|
48
|
+
>
|
49
|
+
> * text - Returns the key raw
|
50
|
+
> * json - Returns an object with `name` and `public_ssh_key` attributes
|
51
|
+
> * xml - Returns a "hash" document with `name` and `public_ssh_key` elements
|
52
|
+
|
53
|
+
### APIv2 ###
|
54
|
+
|
55
|
+
The v2 API is made up of both public and private routes. Authentication is performed by setting the `Authorization` request header to `API_KEY:API_SECRET` prior to performing the request.
|
56
|
+
|
57
|
+
* **(public)** *GET /api/v2/key/clustername*
|
58
|
+
|
59
|
+
> This route is exactly equivalent to the `v1` key route.
|
60
|
+
|
61
|
+
* **(private)** *GET /api/v2/private-key/clustername*
|
22
62
|
|
23
|
-
|
63
|
+
> Returns the private key for the requested cluster. If the cluster is not already known, the request results in a 404. If authentication credentials are missing or invalid, the request results in a 404. Otherwise, the result depends on format:
|
64
|
+
>
|
65
|
+
> * text - Returns the raw key
|
66
|
+
> * json - Returns an object with `name` and `private_ssh_key` attributes
|
67
|
+
> * xml - Returns a "hash" document with `name` and `private_ssh_key` elements
|
24
68
|
|
25
|
-
|
69
|
+
## Development ##
|
26
70
|
|
27
|
-
|
71
|
+
Branches and releases for this project are managed by [git-flow](https://github.com/nvie/gitflow).
|
28
72
|
|
29
73
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
74
|
|
31
|
-
|
75
|
+
## Contributing ##
|
32
76
|
|
33
|
-
|
77
|
+
**Note: Please base all feature branches on the `develop` branch.**
|
34
78
|
|
35
|
-
1. Fork it ( https://github.com/
|
79
|
+
1. Fork it ( https://github.com/engineyard/cabal-api/fork )
|
36
80
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
81
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
82
|
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
-
5. Create a new Pull Request
|
83
|
+
5. Create a new Pull Request against the `develop` branch
|
data/cabal-api.gemspec
CHANGED
@@ -10,10 +10,10 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["dwalters@engineyard.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{A Grape API for creating and distributing SSH keys}
|
13
|
-
spec.homepage = "http://github.com/
|
13
|
+
spec.homepage = "http://github.com/engineyard/cabal-api"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|Procfile|config.ru|bin|config)/?}) }
|
17
17
|
spec.bindir = "exe"
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
@@ -27,7 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "simplecov", '~> 0.10'
|
28
28
|
spec.add_development_dependency "redis"
|
29
29
|
spec.add_development_dependency "database_cleaner"
|
30
|
-
spec.
|
30
|
+
spec.add_development_dependency "yard", "~> 0.8.7"
|
31
|
+
spec.add_runtime_dependency "cabal-util", '~> 0.1'
|
31
32
|
spec.add_runtime_dependency "grape", '~> 0.13'
|
32
33
|
spec.add_runtime_dependency "ohm"
|
33
34
|
spec.add_runtime_dependency "ohm-contrib"
|
data/lib/cabal/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cabal-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Walters
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,19 +137,33 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: yard
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 0.8.7
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.8.7
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: cabal-util
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.1'
|
146
160
|
type: :runtime
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0.
|
166
|
+
version: '0.1'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: grape
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,10 +250,7 @@ files:
|
|
236
250
|
- LICENSE.txt
|
237
251
|
- README.md
|
238
252
|
- Rakefile
|
239
|
-
- bin/console
|
240
|
-
- bin/setup
|
241
253
|
- cabal-api.gemspec
|
242
|
-
- config/cucumber.yml
|
243
254
|
- lib/cabal/api.rb
|
244
255
|
- lib/cabal/api/base.rb
|
245
256
|
- lib/cabal/api/cluster.rb
|
@@ -254,7 +265,7 @@ files:
|
|
254
265
|
- lib/cabal/api/v2/private_key.rb
|
255
266
|
- lib/cabal/api/v2/public_key.rb
|
256
267
|
- lib/cabal/api/version.rb
|
257
|
-
homepage: http://github.com/
|
268
|
+
homepage: http://github.com/engineyard/cabal-api
|
258
269
|
licenses:
|
259
270
|
- MIT
|
260
271
|
metadata: {}
|
@@ -279,3 +290,4 @@ signing_key:
|
|
279
290
|
specification_version: 4
|
280
291
|
summary: A Grape API for creating and distributing SSH keys
|
281
292
|
test_files: []
|
293
|
+
has_rdoc:
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "cabal/api"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/config/cucumber.yml
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
-
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
-
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip --tags ~@deprecated -r features"
|
5
|
-
%>
|
6
|
-
default: <%= std_opts %> features
|
7
|
-
wip: --tags @wip:3 --wip features
|
8
|
-
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|