corl 0.5.5 → 0.5.6
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 +7 -7
- data/README.rdoc +586 -21
- data/VERSION +1 -1
- data/bootstrap/os/ubuntu/05_ruby.sh +1 -1
- data/corl.gemspec +4 -4
- data/lib/CORL/provisioner/puppetnode.rb +2 -2
- data/lib/core/plugin/fog_machine.rb +2 -0
- data/lib/core/plugin/node.rb +1 -1
- data/lib/core/util/puppet/resource.rb +75 -74
- data/lib/core/util/puppet/resource_group.rb +51 -49
- data/lib/core/util/puppet.rb +20 -12
- data/lib/nucleon/action/node/image.rb +18 -16
- data/lib/nucleon/action/node/provision.rb +5 -3
- data/locales/en.yml +21 -0
- metadata +151 -112
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 316f191cc1156d9936eac3c2dd380d597c221f9e
|
4
|
+
data.tar.gz: 6d5d7475ca709a66e073b531a4b0851572d45556
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a39a6f7959c64870c9bce05081e0fd587b4b55f2bd8b1e0fbad52900fe5ee75da732a71684c8afeb512c5ef7906871dec7b184bd6ad65334170b0638d57d675
|
7
|
+
data.tar.gz: 792a4c8c53f7b4f3f875d6f1e94bea2c3f57f9579f28ec4befe2cd3daf802bbd8cbea53757c8272785c3962023db1294c54b8b29e851fc68b999766041dc6cd1
|
data/README.rdoc
CHANGED
@@ -1,27 +1,592 @@
|
|
1
|
-
|
1
|
+
# CORL - Coral Orchestration and Research Library
|
2
2
|
|
3
|
-
|
3
|
+
[Nucleon](https://github.com/coralnexus/nucleon) plugin library and framework for building, synchronizing, and executing
|
4
|
+
distributed actions and agents across heterogenous networks.
|
4
5
|
|
5
|
-
|
6
|
+
[Nucleon](https://github.com/coralnexus/nucleon) powered
|
6
7
|
|
7
|
-
==== Contributing to CORL
|
8
|
-
|
9
|
-
* Check out the latest {major}.{minor} branch to make sure the feature hasn't
|
10
|
-
been implemented or the bug hasn't been fixed yet.
|
11
|
-
* Check out the issue tracker to make sure someone already hasn't requested
|
12
|
-
it and/or contributed it.
|
13
|
-
* Fork the project.
|
14
|
-
* Start a feature/bugfix branch.
|
15
|
-
* Commit and push until you are happy with your contribution.
|
16
|
-
* If possible, add tests for it. This is important so I don't break it in a
|
17
|
-
future version unintentionally.
|
18
|
-
* Please try not to mess with the Rakefile, version, or history. If you want
|
19
|
-
to have your own version, or is otherwise necessary, that is fine, but
|
20
|
-
please isolate to its own commit so I can cherry-pick around it.
|
21
8
|
|
22
|
-
==== Copyright
|
23
9
|
|
24
|
-
Licensed under Apache License 2.0. See LICENSE.txt for further details.
|
25
10
|
|
26
|
-
|
27
|
-
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
![Logo][logo]
|
23
|
+
[logo]: http://cl.ly/image/3Y013H0A2z3z/gundam-ruby.png
|
24
|
+
|
25
|
+
Upgrading? Check the [Upgrade Guide](#upgrading-guide) before bumping to a new
|
26
|
+
[major version][semver].
|
27
|
+
|
28
|
+
## Philosophy
|
29
|
+
|
30
|
+
API wrappers [should reflect the idioms of the language in which they were
|
31
|
+
written][wrappers]. Octokit.rb wraps the [GitHub API][github-api] in a flat API
|
32
|
+
client that follows Ruby conventions and requires little knowledge of REST.
|
33
|
+
Most methods have positional arguments for required input and an options hash
|
34
|
+
for optional parameters, headers, or other options:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
# Fetch a README with Accept header for HTML format
|
38
|
+
Octokit.readme 'al3x/sovereign', :accept => 'application/vnd.github.html'
|
39
|
+
```
|
40
|
+
|
41
|
+
|
42
|
+
[wrappers]: http://wynnnetherland.com/journal/what-makes-a-good-api-wrapper
|
43
|
+
[github-api]: http://developer.github.com
|
44
|
+
|
45
|
+
## Quick start
|
46
|
+
|
47
|
+
Install via Rubygems
|
48
|
+
|
49
|
+
gem install octokit
|
50
|
+
|
51
|
+
... or add to your Gemfile
|
52
|
+
|
53
|
+
gem "octokit", "~> 3.0"
|
54
|
+
|
55
|
+
### Making requests
|
56
|
+
|
57
|
+
[API methods][] are available as module methods (consuming module-level
|
58
|
+
configuration) or as client instance methods.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
# Provide authentication credentials
|
62
|
+
Octokit.configure do |c|
|
63
|
+
c.login = 'defunkt'
|
64
|
+
c.password = 'c0d3b4ssssss!'
|
65
|
+
end
|
66
|
+
|
67
|
+
# Fetch the current user
|
68
|
+
Octokit.user
|
69
|
+
```
|
70
|
+
or
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
# Provide authentication credentials
|
74
|
+
client = Octokit::Client.new(:login => 'defunkt', :password => 'c0d3b4ssssss!')
|
75
|
+
# Fetch the current user
|
76
|
+
client.user
|
77
|
+
```
|
78
|
+
|
79
|
+
[API methods]: http://octokit.github.io/octokit.rb/method_list.html
|
80
|
+
|
81
|
+
### Consuming resources
|
82
|
+
|
83
|
+
Most methods return a `Resource` object which provides dot notation and `[]`
|
84
|
+
access for fields returned in the API response.
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
# Fetch a user
|
88
|
+
user = Octokit.user 'jbarnette'
|
89
|
+
puts user.name
|
90
|
+
# => "John Barnette"
|
91
|
+
puts user.fields
|
92
|
+
# => <Set: {:login, :id, :gravatar_id, :type, :name, :company, :blog, :location, :email, :hireable, :bio, :public_repos, :followers, :following, :created_at, :updated_at, :public_gists}>
|
93
|
+
puts user[:company]
|
94
|
+
# => "GitHub"
|
95
|
+
user.rels[:gists].href
|
96
|
+
# => "https://api.github.com/users/jbarnette/gists"
|
97
|
+
```
|
98
|
+
|
99
|
+
**Note:** URL fields are culled into a separate `.rels` collection for easier
|
100
|
+
[Hypermedia](#hypermedia-agent) support.
|
101
|
+
|
102
|
+
### Accessing HTTP responses
|
103
|
+
|
104
|
+
While most methods return a `Resource` object or a Boolean, sometimes you may
|
105
|
+
need access to the raw HTTP response headers. You can access the last HTTP
|
106
|
+
response with `Client#last_response`:
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
user = Octokit.user 'andrewpthorp'
|
110
|
+
response = Octokit.last_response
|
111
|
+
etag = response.headers[:etag]
|
112
|
+
```
|
113
|
+
|
114
|
+
## Authentication
|
115
|
+
|
116
|
+
Octokit supports the various [authentication methods supported by the GitHub
|
117
|
+
API][auth]:
|
118
|
+
|
119
|
+
### Basic Authentication
|
120
|
+
|
121
|
+
Using your GitHub username and password is the easiest way to get started
|
122
|
+
making authenticated requests:
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
client = Octokit::Client.new \
|
126
|
+
:login => 'defunkt',
|
127
|
+
:password => 'c0d3b4ssssss!'
|
128
|
+
|
129
|
+
user = client.user
|
130
|
+
user.login
|
131
|
+
# => "defunkt"
|
132
|
+
```
|
133
|
+
While Basic Authentication allows you to get started quickly, OAuth access
|
134
|
+
tokens are the preferred way to authenticate on behalf of users.
|
135
|
+
|
136
|
+
### OAuth access tokens
|
137
|
+
|
138
|
+
[OAuth access tokens][oauth] provide two main benefits over using your username
|
139
|
+
and password:
|
140
|
+
|
141
|
+
* **Revokable access**. Access tokens can be revoked, removing access for only
|
142
|
+
that token without having to change your password everywhere.
|
143
|
+
* **Limited access**. Access tokens have [access scopes][] which allow for more
|
144
|
+
granular access to API resources. For instance, you can grant a third party
|
145
|
+
access to your gists but not your private repositories.
|
146
|
+
|
147
|
+
To use an access token with the Octokit client, pass your token in the
|
148
|
+
`:access_token` options parameter in lieu of your username and password:
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
client = Octokit::Client.new(:access_token => "<your 40 char token>")
|
152
|
+
|
153
|
+
user = client.user
|
154
|
+
user.login
|
155
|
+
# => "defunkt"
|
156
|
+
```
|
157
|
+
|
158
|
+
You can [create access tokens through your GitHub Account Settings](https://help.github.com/articles/creating-an-access-token-for-command-line-use)
|
159
|
+
or with a basic authenticated Octokit client:
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
client = Octokit::Client.new \
|
163
|
+
:login => 'defunkt',
|
164
|
+
:password => 'c0d3b4ssssss!'
|
165
|
+
|
166
|
+
client.create_authorization(:scopes => ["user"], :note => "Name of token")
|
167
|
+
# => <your new oauth token>
|
168
|
+
```
|
169
|
+
|
170
|
+
### Two-Factor Authentication
|
171
|
+
|
172
|
+
[Two-Factor Authentication](https://help.github.com/articles/about-two-factor-authentication) brings added security to the account by requiring more information to login.
|
173
|
+
|
174
|
+
Using two-factor authentication for API calls is as simple as adding the [required header](http://developer.github.com/v3/auth/#working-with-two-factor-authentication) as an option:
|
175
|
+
|
176
|
+
```ruby
|
177
|
+
client = Octokit::Client.new \
|
178
|
+
:login => 'defunkt',
|
179
|
+
:password => 'c0d3b4ssssss!'
|
180
|
+
|
181
|
+
user = client.user("defunkt", :headers => { "X-GitHub-OTP" => "<your 2FA token>" })
|
182
|
+
```
|
183
|
+
|
184
|
+
As you can imagine, this gets annoying quick since two-factor auth tokens are very short lived. So it is recommended to create an oauth token for the user to communicate with the API:
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
client = Octokit::Client.new \
|
188
|
+
:login => 'defunkt',
|
189
|
+
:password => 'c0d3b4ssssss!'
|
190
|
+
|
191
|
+
client.create_authorization(:scopes => ["user"], :note => "Name of token",
|
192
|
+
:headers => { "X-GitHub-OTP" => "<your 2FA token>" })
|
193
|
+
# => <your new oauth token>
|
194
|
+
```
|
195
|
+
|
196
|
+
### Using a .netrc file
|
197
|
+
|
198
|
+
Octokit supports reading credentials from a netrc file (defaulting to
|
199
|
+
`~/.netrc`). Given these lines in your netrc:
|
200
|
+
|
201
|
+
```
|
202
|
+
machine api.github.com
|
203
|
+
login defunkt
|
204
|
+
password c0d3b4ssssss!
|
205
|
+
```
|
206
|
+
You can now create a client with those credentials:
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
client = Octokit::Client.new(:netrc => true)
|
210
|
+
client.login
|
211
|
+
# => "defunkt"
|
212
|
+
```
|
213
|
+
But _I want to use OAuth_ you say. Since the GitHub API supports using an OAuth
|
214
|
+
token as a Basic password, you totally can:
|
215
|
+
|
216
|
+
```
|
217
|
+
machine api.github.com
|
218
|
+
login defunkt
|
219
|
+
password <your 40 char token>
|
220
|
+
```
|
221
|
+
|
222
|
+
**Note:** Support for netrc requires adding the [netrc gem][] to your Gemfile
|
223
|
+
or `.gemspec`.
|
224
|
+
|
225
|
+
### Application authentication
|
226
|
+
|
227
|
+
Octokit also supports application-only authentication [using OAuth application client
|
228
|
+
credentials][app-creds]. Using application credentials will result in making
|
229
|
+
anonymous API calls on behalf of an application in order to take advantage of
|
230
|
+
the higher rate limit.
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
client = Octokit::Client.new \
|
234
|
+
:client_id => "<your 20 char id>",
|
235
|
+
:client_secret => "<your 40 char secret>"
|
236
|
+
|
237
|
+
user = client.user 'defunkt'
|
238
|
+
```
|
239
|
+
|
240
|
+
[auth]: http://developer.github.com/v3/#authentication
|
241
|
+
[oauth]: http://developer.github.com/v3/oauth/
|
242
|
+
[access scopes]: http://developer.github.com/v3/oauth/#scopes
|
243
|
+
[app-creds]: http://developer.github.com/v3/#increasing-the-unauthenticated-rate-limit-for-oauth-applications
|
244
|
+
|
245
|
+
## Pagination
|
246
|
+
|
247
|
+
Many GitHub API resources are [paginated][]. While you may be tempted to start
|
248
|
+
adding `:page` parameters to your calls, the API returns links to the next,
|
249
|
+
previous, and last pages for you in the `Link` response header as [Hypermedia
|
250
|
+
link relations](#hypermedia-agent).
|
251
|
+
|
252
|
+
```ruby
|
253
|
+
issues = Octokit.issues 'rails/rails', :per_page => 100
|
254
|
+
issues.concat Octokit.last_response.rels[:next].get.data
|
255
|
+
```
|
256
|
+
|
257
|
+
### Auto pagination
|
258
|
+
|
259
|
+
For smallish resource lists, Octokit provides auto pagination. When this is
|
260
|
+
enabled, calls for paginated resources will fetch and concatenate the results
|
261
|
+
from every page into a single array:
|
262
|
+
|
263
|
+
```ruby
|
264
|
+
Octokit.auto_paginate = true
|
265
|
+
issues = Octokit.issues 'rails/rails'
|
266
|
+
issues.length
|
267
|
+
|
268
|
+
# => 702
|
269
|
+
```
|
270
|
+
|
271
|
+
**Note:** While Octokit auto pagination will set the page size to the maximum
|
272
|
+
`100`, and seek to not overstep your rate limit, you probably want to use a
|
273
|
+
custom pattern for traversing large lists.
|
274
|
+
|
275
|
+
[paginated]: http://developer.github.com/v3/#pagination
|
276
|
+
|
277
|
+
## Configuration and defaults
|
278
|
+
|
279
|
+
While `Octokit::Client` accepts a range of options when creating a new client
|
280
|
+
instance, Octokit's configuration API allows you to set your configuration
|
281
|
+
options at the module level. This is particularly handy if you're creating a
|
282
|
+
number of client instances based on some shared defaults.
|
283
|
+
|
284
|
+
### Configuring module defaults
|
285
|
+
|
286
|
+
Every writable attribute in {Octokit::Configurable} can be set one at a time:
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
Octokit.api_endpoint = 'http://api.github.dev'
|
290
|
+
Octokit.web_endpoint = 'http://github.dev'
|
291
|
+
```
|
292
|
+
|
293
|
+
or in batch:
|
294
|
+
|
295
|
+
```ruby
|
296
|
+
Octokit.configure do |c|
|
297
|
+
c.api_endpoint = 'http://api.github.dev'
|
298
|
+
c.web_endpoint = 'http://github.dev'
|
299
|
+
end
|
300
|
+
```
|
301
|
+
|
302
|
+
### Using ENV variables
|
303
|
+
|
304
|
+
Default configuration values are specified in {Octokit::Default}. Many
|
305
|
+
attributes will look for a default value from the ENV before returning
|
306
|
+
Octokit's default.
|
307
|
+
|
308
|
+
```ruby
|
309
|
+
# Given $OCTOKIT_API_ENDPOINT is "http://api.github.dev"
|
310
|
+
Octokit.api_endpoint
|
311
|
+
|
312
|
+
# => "http://api.github.dev"
|
313
|
+
```
|
314
|
+
|
315
|
+
Deprecation warnings and API endpoints in development preview warnings are
|
316
|
+
printed to STDOUT by default, these can be disabled by setting the ENV
|
317
|
+
`OCTOKIT_SILENT=true`.
|
318
|
+
|
319
|
+
## Hypermedia agent
|
320
|
+
|
321
|
+
Starting in version 2.0, Octokit is [hypermedia][]-enabled. Under the hood,
|
322
|
+
{Octokit::Client} uses [Sawyer][], a hypermedia client built on [Faraday][].
|
323
|
+
|
324
|
+
### Hypermedia in Octokit
|
325
|
+
|
326
|
+
Resources returned by Octokit methods contain not only data but hypermedia
|
327
|
+
link relations:
|
328
|
+
|
329
|
+
```ruby
|
330
|
+
user = Octokit.user 'technoweenie'
|
331
|
+
|
332
|
+
# Get the repos rel, returned from the API
|
333
|
+
# as repos_url in the resource
|
334
|
+
user.rels[:repos].href
|
335
|
+
# => "https://api.github.com/users/technoweenie/repos"
|
336
|
+
|
337
|
+
repos = user.rels[:repos].get.data
|
338
|
+
repos.last.name
|
339
|
+
# => "faraday-zeromq"
|
340
|
+
```
|
341
|
+
|
342
|
+
When processing API responses, all `*_url` attributes are culled in to the link
|
343
|
+
relations collection. Any `url` attribute becomes `.rels[:self]`.
|
344
|
+
|
345
|
+
### URI templates
|
346
|
+
|
347
|
+
You might notice many link relations have variable placeholders. Octokit
|
348
|
+
supports [URI Templates][uri-templates] for parameterized URI expansion:
|
349
|
+
|
350
|
+
```ruby
|
351
|
+
repo = Octokit.repo 'pengwynn/pingwynn'
|
352
|
+
rel = repo.rels[:issues]
|
353
|
+
# => #<Sawyer::Relation: issues: get https://api.github.com/repos/pengwynn/pingwynn/issues{/number}>
|
354
|
+
|
355
|
+
# Get a page of issues
|
356
|
+
rel.get.data
|
357
|
+
|
358
|
+
# Get issue #2
|
359
|
+
rel.get(:uri => {:number => 2}).data
|
360
|
+
```
|
361
|
+
|
362
|
+
### The Full Hypermedia Experience™
|
363
|
+
|
364
|
+
If you want to use Octokit as a pure hypermedia API client, you can start at
|
365
|
+
the API root and follow link relations from there:
|
366
|
+
|
367
|
+
```ruby
|
368
|
+
root = Octokit.root
|
369
|
+
root.rels[:repository].get :uri => {:owner => "octokit", :repo => "octokit.rb" }
|
370
|
+
```
|
371
|
+
|
372
|
+
Octokit 3.0 aims to be hypermedia-driven, removing the internal URL
|
373
|
+
construction currently used throughout the client.
|
374
|
+
|
375
|
+
[hypermedia]: http://en.wikipedia.org/wiki/Hypermedia
|
376
|
+
[Sawyer]: https://github.com/lostisland/sawyer
|
377
|
+
[Faraday]: https://github.com/lostisland/faraday
|
378
|
+
[uri-templates]: http://tools.ietf.org/html/rfc6570
|
379
|
+
|
380
|
+
## Upgrading guide
|
381
|
+
|
382
|
+
Version 3.0 includes a couple breaking changes when upgrading from v2.x.x:
|
383
|
+
|
384
|
+
The [default media type][default-media-type] is now `v3` instead of `beta`. If
|
385
|
+
you need to request the older media type, you can set the default media type
|
386
|
+
for the client:
|
387
|
+
|
388
|
+
```ruby
|
389
|
+
Octokit.default_media_type = "application/vnd.github.beta+json"
|
390
|
+
```
|
391
|
+
or per-request
|
392
|
+
|
393
|
+
```ruby
|
394
|
+
Octokit.emails(:accept => "application/vnd.github.beta+json")
|
395
|
+
```
|
396
|
+
|
397
|
+
The long-deprecated `Octokit::Client#create_download` method has been removed.
|
398
|
+
|
399
|
+
[default-media-type]: https://developer.github.com/changes/2014-01-07-upcoming-change-to-default-media-type/
|
400
|
+
|
401
|
+
### Upgrading from 1.x.x
|
402
|
+
|
403
|
+
Version 2.0 includes a completely rewritten `Client` factory that now memoizes
|
404
|
+
client instances based on unique configuration options. Breaking changes also
|
405
|
+
include:
|
406
|
+
|
407
|
+
* `:oauth_token` is now `:access_token`
|
408
|
+
* `:auto_traversal` is now `:auto_paginate`
|
409
|
+
* `Hashie::Mash` has been removed. Responses now return a `Sawyer::Resource`
|
410
|
+
object. This new type behaves mostly like a Ruby `Hash`, but does not fully
|
411
|
+
support the `Hashie::Mash` API.
|
412
|
+
* Two new client error types are raised where appropriate:
|
413
|
+
`Octokit::TooManyRequests` and `Octokit::TooManyLoginAttempts`
|
414
|
+
* The `search_*` methods from v1.x are now found at `legacy_search_*`
|
415
|
+
* Support for netrc requires including the [netrc gem][] in your Gemfile or
|
416
|
+
gemspec.
|
417
|
+
* DateTime fields are now proper `DateTime` objects. Previous versions outputted DateTime fields as 'String' objects.
|
418
|
+
|
419
|
+
[netrc gem]: https://rubygems.org/gems/netrc
|
420
|
+
|
421
|
+
|
422
|
+
## Advanced usage
|
423
|
+
|
424
|
+
Since Octokit employs [Faraday][faraday] under the hood, some behavior can be
|
425
|
+
extended via middleware.
|
426
|
+
|
427
|
+
### Debugging
|
428
|
+
|
429
|
+
Often, it helps to know what Octokit is doing under the hood. You can add a
|
430
|
+
logger to the middleware that enables you to peek into the underlying HTTP
|
431
|
+
traffic:
|
432
|
+
|
433
|
+
```ruby
|
434
|
+
stack = Faraday::RackBuilder.new do |builder|
|
435
|
+
builder.response :logger
|
436
|
+
builder.use Octokit::Response::RaiseError
|
437
|
+
builder.adapter Faraday.default_adapter
|
438
|
+
end
|
439
|
+
Octokit.middleware = stack
|
440
|
+
Octokit.user 'pengwynn'
|
441
|
+
```
|
442
|
+
```
|
443
|
+
I, [2013-08-22T15:54:38.583300 #88227] INFO -- : get https://api.github.com/users/pengwynn
|
444
|
+
D, [2013-08-22T15:54:38.583401 #88227] DEBUG -- request: Accept: "application/vnd.github.beta+json"
|
445
|
+
User-Agent: "Octokit Ruby Gem 2.0.0.rc4"
|
446
|
+
I, [2013-08-22T15:54:38.843313 #88227] INFO -- Status: 200
|
447
|
+
D, [2013-08-22T15:54:38.843459 #88227] DEBUG -- response: server: "GitHub.com"
|
448
|
+
date: "Thu, 22 Aug 2013 20:54:40 GMT"
|
449
|
+
content-type: "application/json; charset=utf-8"
|
450
|
+
transfer-encoding: "chunked"
|
451
|
+
connection: "close"
|
452
|
+
status: "200 OK"
|
453
|
+
x-ratelimit-limit: "60"
|
454
|
+
x-ratelimit-remaining: "39"
|
455
|
+
x-ratelimit-reset: "1377205443"
|
456
|
+
...
|
457
|
+
```
|
458
|
+
|
459
|
+
See the [Faraday README][faraday] for more middleware magic.
|
460
|
+
|
461
|
+
### Caching
|
462
|
+
|
463
|
+
If you want to boost performance, stretch your API rate limit, or avoid paying
|
464
|
+
the hypermedia tax, you can use [Faraday Http Cache][cache].
|
465
|
+
|
466
|
+
Add the gem to your Gemfile
|
467
|
+
|
468
|
+
gem 'faraday-http-cache'
|
469
|
+
|
470
|
+
Next, construct your own Faraday middleware:
|
471
|
+
|
472
|
+
```ruby
|
473
|
+
stack = Faraday::RackBuilder.new do |builder|
|
474
|
+
builder.use Faraday::HttpCache
|
475
|
+
builder.use Octokit::Response::RaiseError
|
476
|
+
builder.adapter Faraday.default_adapter
|
477
|
+
end
|
478
|
+
Octokit.middleware = stack
|
479
|
+
```
|
480
|
+
|
481
|
+
Once configured, the middleware will store responses in cache based on ETag
|
482
|
+
fingerprint and serve those back up for future `304` responses for the same
|
483
|
+
resource. See the [project README][cache] for advanced usage.
|
484
|
+
|
485
|
+
|
486
|
+
[cache]: https://github.com/plataformatec/faraday-http-cache
|
487
|
+
[faraday]: https://github.com/lostisland/faraday
|
488
|
+
|
489
|
+
## Hacking on Octokit.rb
|
490
|
+
|
491
|
+
If you want to hack on Octokit locally, we try to make [bootstrapping the
|
492
|
+
project][bootstrapping] as painless as possible. To start hacking, clone and run:
|
493
|
+
|
494
|
+
script/bootstrap
|
495
|
+
|
496
|
+
This will install project dependencies and get you up and running. If you want
|
497
|
+
to run a Ruby console to poke on Octokit, you can crank one up with:
|
498
|
+
|
499
|
+
script/console
|
500
|
+
|
501
|
+
Using the scripts in `./scripts` instead of `bundle exec rspec`, `bundle
|
502
|
+
console`, etc. ensures your dependencies are up-to-date.
|
503
|
+
|
504
|
+
### Running and writing new tests
|
505
|
+
|
506
|
+
Octokit uses [VCR][] for recording and playing back API fixtures during test
|
507
|
+
runs. These cassettes (fixtures) are part of the Git project in the `spec/cassettes`
|
508
|
+
folder. If you're not recording new cassettes you can run the specs with existing
|
509
|
+
cassettes with:
|
510
|
+
|
511
|
+
script/test
|
512
|
+
|
513
|
+
Octokit uses environmental variables for storing credentials used in testing.
|
514
|
+
If you are testing an API endpoint that doesn't require authentication, you
|
515
|
+
can get away without any additional configuration. For the most part, tests
|
516
|
+
use an authenticated client, using a token stored in `ENV['OCTOKIT_TEST_GITHUB_TOKEN']`.
|
517
|
+
There are several different authenticating method's used across the api.
|
518
|
+
Here is the full list of configurable environmental variables for testing
|
519
|
+
Octokit:
|
520
|
+
|
521
|
+
ENV Variable | Description |
|
522
|
+
:-------------------|:-----------------|
|
523
|
+
`OCTOKIT_TEST_GITHUB_LOGIN`| GitHub login name (preferably one created specifically for testing against).
|
524
|
+
`OCTOKIT_TEST_GITHUB_PASSWORD`| Password for the test GitHub login.
|
525
|
+
`OCTOKIT_TEST_GITHUB_TOKEN` | [Personal Access Token](https://github.com/blog/1509-personal-api-tokens) for the test GitHub login.
|
526
|
+
`OCTOKIT_TEST_GITHUB_CLIENT_ID` | Test OAuth application client id.
|
527
|
+
`OCTOKIT_TEST_GITHUB_CLIENT_SECRET` | Test OAuth application client secret.
|
528
|
+
`OCTOKIT_TEST_GITHUB_REPOSITORY` | Test repository to perform destructive actions against, this should not be set to any repository of importance. **Automatically created by the test suite if nonexistent** Default: `api-sandbox`
|
529
|
+
`OCTOKIT_TEST_GITHUB_ORGANIZATION` | Test organization.
|
530
|
+
|
531
|
+
Since we periodically refresh our cassettes, please keep some points in mind
|
532
|
+
when writing new specs.
|
533
|
+
|
534
|
+
* **Specs should be idempotent**. The HTTP calls made during a spec should be
|
535
|
+
able to be run over and over. This means deleting a known resource prior to
|
536
|
+
creating it if the name has to be unique.
|
537
|
+
* **Specs should be able to be run in random order.** If a spec depends on
|
538
|
+
another resource as a fixture, make sure that's created in the scope of the
|
539
|
+
spec and not depend on a previous spec to create the data needed.
|
540
|
+
* **Do not depend on authenticated user info.** Instead of asserting
|
541
|
+
actual values in resources, try to assert the existence of a key or that a
|
542
|
+
response is an Array. We're testing the client, not the API.
|
543
|
+
|
544
|
+
[bootstrapping]: http://wynnnetherland.com/linked/2013012801/bootstrapping-consistency
|
545
|
+
[VCR]: https://github.com/vcr/vcr
|
546
|
+
|
547
|
+
## Supported Ruby Versions
|
548
|
+
|
549
|
+
This library aims to support and is [tested against][travis] the following Ruby
|
550
|
+
implementations:
|
551
|
+
|
552
|
+
* Ruby 1.9.2
|
553
|
+
* Ruby 1.9.3
|
554
|
+
* Ruby 2.0.0
|
555
|
+
* Ruby 2.1.0
|
556
|
+
|
557
|
+
If something doesn't work on one of these Ruby versions, it's a bug.
|
558
|
+
|
559
|
+
This library may inadvertently work (or seem to work) on other Ruby
|
560
|
+
implementations, but support will only be provided for the versions listed
|
561
|
+
above.
|
562
|
+
|
563
|
+
If you would like this library to support another Ruby version, you may
|
564
|
+
volunteer to be a maintainer. Being a maintainer entails making sure all tests
|
565
|
+
run and pass on that implementation. When something breaks on your
|
566
|
+
implementation, you will be responsible for providing patches in a timely
|
567
|
+
fashion. If critical issues for a particular implementation exist at the time
|
568
|
+
of a major release, support for that Ruby version may be dropped.
|
569
|
+
|
570
|
+
[travis]: https://travis-ci.org/octokit/octokit.rb
|
571
|
+
|
572
|
+
## Versioning
|
573
|
+
|
574
|
+
This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
|
575
|
+
of this scheme should be reported as bugs. Specifically, if a minor or patch
|
576
|
+
version is released that breaks backward compatibility, that version should be
|
577
|
+
immediately yanked and/or a new version should be immediately released that
|
578
|
+
restores compatibility. Breaking changes to the public API will only be
|
579
|
+
introduced with new major versions. As a result of this policy, you can (and
|
580
|
+
should) specify a dependency on this gem using the [Pessimistic Version
|
581
|
+
Constraint][pvc] with two digits of precision. For example:
|
582
|
+
|
583
|
+
spec.add_dependency 'octokit', '~> 3.0'
|
584
|
+
|
585
|
+
[semver]: http://semver.org/
|
586
|
+
[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
587
|
+
|
588
|
+
## License
|
589
|
+
|
590
|
+
Licensed under Apache License 2.0. See LICENSE.txt for further details.
|
591
|
+
|
592
|
+
Copyright © 2013-2014 Adrian Webb <adrian.webb@coralnexus.com> Coral Technology Group LLC
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.6
|
data/corl.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: corl 0.5.
|
5
|
+
# stub: corl 0.5.6 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "corl"
|
9
|
-
s.version = "0.5.
|
9
|
+
s.version = "0.5.6"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Adrian Webb"]
|
14
|
-
s.date = "2014-12-
|
14
|
+
s.date = "2014-12-29"
|
15
15
|
s.description = "Framework that provides a simple foundation for growing organically in the cloud"
|
16
16
|
s.email = "adrian.webb@coralnexus.com"
|
17
17
|
s.executables = ["corl"]
|
@@ -171,7 +171,7 @@ Gem::Specification.new do |s|
|
|
171
171
|
s.rdoc_options = ["--title", "Coral Orchestration and Research Library", "--main", "README.rdoc", "--line-numbers"]
|
172
172
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
|
173
173
|
s.rubyforge_project = "corl"
|
174
|
-
s.rubygems_version = "2.4.
|
174
|
+
s.rubygems_version = "2.4.3"
|
175
175
|
s.summary = "Coral Orchestration and Research Library"
|
176
176
|
|
177
177
|
if s.respond_to? :specification_version then
|
@@ -260,7 +260,7 @@ class Puppetnode < Nucleon.plugin_class(:CORL, :provisioner)
|
|
260
260
|
|
261
261
|
@@puppet_lock.synchronize do
|
262
262
|
begin
|
263
|
-
info("Starting catalog generation", { :i18n => false })
|
263
|
+
info("Starting catalog generation at #{Time.now.to_s}", { :i18n => false })
|
264
264
|
|
265
265
|
@@status[id] = code.success
|
266
266
|
@@network = network
|
@@ -297,7 +297,7 @@ class Puppetnode < Nucleon.plugin_class(:CORL, :provisioner)
|
|
297
297
|
|
298
298
|
unless config.get(:dry_run, false)
|
299
299
|
info("\n", { :prefix => false, :i18n => false })
|
300
|
-
info("Starting configuration run", { :i18n => false })
|
300
|
+
info("Starting configuration run at #{Time.now.to_s}", { :i18n => false })
|
301
301
|
|
302
302
|
# Configure the machine
|
303
303
|
Puppet.push_context({ :current_environment => apply_environment }, "CORL environment for configurer transaction")
|