fleet-api 0.5.2 → 0.5.3

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: 727c5c16a53615f8eb94fe4a046698b93d476548
4
- data.tar.gz: 2ff6e2e7211c7c4800d429cfca1dc54dc4f6e0de
3
+ metadata.gz: 9884b83b1cc12a5a754d0026501f14d07f2a7eaf
4
+ data.tar.gz: e434bfd9213128f9c1e72e3af63251e98a116ab3
5
5
  SHA512:
6
- metadata.gz: ebb8e6a5f7dee26ffc7fa942b85b0b26c22e093714afbd6ccb620b3edfe74cbc31a2b9af3b5501b2e7e7f61f3509aa9fe17f57b3097db385350b45197c717d60
7
- data.tar.gz: fff3b6959de15fb2bd6275bea2b210367de413ebce81e694d12cae1888a1da9d3d908956be8c9ede17d137238a9051175afe7cbfa5fde15be335b80d556a0c8c
6
+ metadata.gz: 8910d52994d4e7cad4aa417db58a1f435c0d21e9a8fa6103794f5aec29de86ddec78711d0aa78462692eda6e9a4d8d0db741e8c97800f1b812789b66c447ffd5
7
+ data.tar.gz: 53ac7bd82a4bf902d5c1bcc7ccf973bc317d1c594d1bd51066093875ef08908182eb2164e308292870664a3aef7fbf9e0c6bbf2de27ef49ae72165be9d33e0cd
data/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ 0.5.3 - 2014-08-26
5
+ ------------------
6
+
7
+ ### Added
8
+ - Support for listing machines in CoreOS cluster
9
+
10
+ ### Fixed
11
+ - Will follow etcd redirects when communicating with non-master endpoints
12
+
13
+ 0.5.2 - 2014-08-20
14
+ ------------------
15
+
16
+ Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fleet-api (0.5.2)
4
+ fleet-api (0.5.3)
5
5
  faraday (= 0.8.9)
6
6
  faraday_middleware (= 0.9.0)
7
7
 
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  fleet-api
2
2
  =========
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/fleet-api.svg)](http://badge.fury.io/rb/fleet-api)
5
+ [![Build Status](https://api.shippable.com/projects/53f3a91a5491229d0207e4d9/badge/master)](https://www.shippable.com/projects/53f3a91a5491229d0207e4d9)
6
+
4
7
  Provides a Ruby wrapper around the CoreOS Fleet API.
5
8
 
6
9
  The client allows programmatic access to most of the *fleetctl* commands including the ability to load, start, stop, unload and destroy unit files.
@@ -0,0 +1,20 @@
1
+ module Fleet
2
+ class Client
3
+ module Machines
4
+
5
+ MACHINES_RESOURCE = 'machines'
6
+
7
+ def list_machines
8
+ opts = { consistent: true, recursive: true, sorted: true }
9
+ get(machines_path, opts)
10
+ end
11
+
12
+ private
13
+
14
+ def machines_path(*parts)
15
+ resource_path(MACHINES_RESOURCE, *parts)
16
+ end
17
+
18
+ end
19
+ end
20
+ end
data/lib/fleet/client.rb CHANGED
@@ -4,6 +4,7 @@ require 'fleet/error'
4
4
  require 'fleet/request'
5
5
  require 'fleet/service_definition'
6
6
  require 'fleet/client/job'
7
+ require 'fleet/client/machines'
7
8
  require 'fleet/client/state'
8
9
  require 'fleet/client/unit'
9
10
 
@@ -27,6 +28,7 @@ module Fleet
27
28
  include Fleet::Request
28
29
 
29
30
  include Fleet::Client::Job
31
+ include Fleet::Client::Machines
30
32
  include Fleet::Client::State
31
33
  include Fleet::Client::Unit
32
34
 
@@ -16,6 +16,7 @@ module Fleet
16
16
  faraday.request :url_encoded
17
17
  faraday.response :json
18
18
  faraday.response :raise_fleet_error
19
+ faraday.response :follow_redirects
19
20
  faraday.adapter adapter
20
21
  end
21
22
  end
data/lib/fleet/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fleet
2
- VERSION = '0.5.2'.freeze unless defined?(Fleet::VERSION)
2
+ VERSION = '0.5.3'.freeze unless defined?(Fleet::VERSION)
3
3
  end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fleet::Client::Machines do
4
+
5
+ subject { Fleet::Client.new }
6
+
7
+ let(:response) { double(:response) }
8
+
9
+ describe '#list_machines' do
10
+
11
+ before do
12
+ allow(subject).to receive(:get).and_return(response)
13
+ end
14
+
15
+ it 'GETs the Fleet machines key' do
16
+ opts = { consistent: true, recursive: true, sorted: true }
17
+ expect(subject).to receive(:get)
18
+ .with('v2/keys/_coreos.com/fleet/machines', opts)
19
+ .and_return(response)
20
+
21
+ subject.list_machines
22
+ end
23
+
24
+ it 'returns the job response' do
25
+ expect(subject.list_machines).to eql(response)
26
+ end
27
+ end
28
+ end
@@ -10,6 +10,7 @@ describe Fleet::Connection do
10
10
  Faraday::Request::UrlEncoded,
11
11
  FaradayMiddleware::ParseJson,
12
12
  Fleet::Middleware::Response::RaiseError,
13
+ FaradayMiddleware::FollowRedirects,
13
14
  Faraday::Adapter::NetHttp
14
15
  ]
15
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fleet-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - CenturyLink
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -103,6 +103,7 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
105
  - ".travis.yml"
106
+ - CHANGELOG.md
106
107
  - Gemfile
107
108
  - Gemfile.lock
108
109
  - LICENSE
@@ -112,6 +113,7 @@ files:
112
113
  - lib/fleet.rb
113
114
  - lib/fleet/client.rb
114
115
  - lib/fleet/client/job.rb
116
+ - lib/fleet/client/machines.rb
115
117
  - lib/fleet/client/state.rb
116
118
  - lib/fleet/client/unit.rb
117
119
  - lib/fleet/configuration.rb
@@ -122,6 +124,7 @@ files:
122
124
  - lib/fleet/service_definition.rb
123
125
  - lib/fleet/version.rb
124
126
  - spec/fleet/client/job_spec.rb
127
+ - spec/fleet/client/machines_spec.rb
125
128
  - spec/fleet/client/state_spec.rb
126
129
  - spec/fleet/client/unit_spec.rb
127
130
  - spec/fleet/client_spec.rb
@@ -159,6 +162,7 @@ specification_version: 4
159
162
  summary: A simple REST client for the CoreOS Fleet API
160
163
  test_files:
161
164
  - spec/fleet/client/job_spec.rb
165
+ - spec/fleet/client/machines_spec.rb
162
166
  - spec/fleet/client/state_spec.rb
163
167
  - spec/fleet/client/unit_spec.rb
164
168
  - spec/fleet/client_spec.rb