cabal-api 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4957b73cca1d91aade54e4361f941dc513e17d2e
4
- data.tar.gz: a1014f814ab8b620b427e383bb01556bc1309304
3
+ metadata.gz: e347e3023c8af9e9765984b986201d023f4bc13c
4
+ data.tar.gz: ae6ac8fc86ebb16576011b9f3265a0069396f3e4
5
5
  SHA512:
6
- metadata.gz: 8d59ca9b093b66a678a03a0b343dbfdab9f34ffd1b512825ff18f672bfc63aeb3706ec3f7fa6f2dc8e86169e03f2640445c05c1dd888447b776ed2157acd02ad
7
- data.tar.gz: a1ce4dde5dae99749aaff8864f285581292e995c7d042c571df96e592901bec432466c505b6b1f971a0dfc08e965a2d351893d1b613884755cb3d2a473aacce1
6
+ metadata.gz: 7cc38762dbe44aab4d7308eeb3773bc42991a3beba93b8437899734f601d1638b8a2e8ab1b14072ff0fa36de03336da34e3f829868291c11891a7f4804d64995
7
+ data.tar.gz: 0b81be37313d635bb98041164b5c86da68b55406e592a50a450282e98aeab5ab2020429f75f3ae161ff2f66df0eeb6610b3242c49422cde05f3eaa6898c07a93
data/README.md CHANGED
@@ -1,15 +1,13 @@
1
- # Cabal::Api
1
+ # Cabal::API #
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cabal/api`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Delete this and the text above, and describe your gem
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-api
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
- ## Usage
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
- TODO: Write usage instructions here
69
+ ## Development ##
26
70
 
27
- ## Development
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
75
+ ## Contributing ##
32
76
 
33
- ## Contributing
77
+ **Note: Please base all feature branches on the `develop` branch.**
34
78
 
35
- 1. Fork it ( https://github.com/[my-github-username]/cabal-api/fork )
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/ess/cabal-api"
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.add_runtime_dependency "cabal", '~> 0.4'
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"
@@ -1,5 +1,5 @@
1
1
  module Cabal
2
2
  module Api
3
- VERSION = "0.0.4"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
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
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-13 00:00:00.000000000 Z
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: cabal
140
+ name: yard
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0.4'
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.4'
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/ess/cabal-api
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
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
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