mulder 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +1 -1
- data/lib/mulder/formats/json.rb +18 -0
- data/lib/mulder/formatter.rb +4 -2
- data/lib/mulder/version.rb +1 -1
- data/spec/lib/mulder/formats/json_spec.rb +34 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c74bd78ed1a5b5cf346c11d3c2e40c96b3415139
|
4
|
+
data.tar.gz: 86b32162edd9de13059ffbc0f52d67bf59f65447
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70ee6aaaebc866db3d6f7a148b8a9b3d515e5749c5ea18974573255687f3097cacd65dfe997b73c5da799362074fcc331eb5daf2e14913b0e88c213db8df2df7
|
7
|
+
data.tar.gz: af7678ac094b8256d5be5e57dc3e47aeeb19b0ab7c084450578f790f292f1b13e03a89bfdfcf332b33fcbeba4e7c564d149c868b33eabc62d689e51a579e2f1c
|
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A deploy-time helper for your AWS AutoScaling groups, and servers. Discover the IP addresses of your instances by AutoScalingGroup.
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.org/shopkeep/mulder.png?branch=master)](https://travis-ci.org/shopkeep/mulder)
|
5
|
+
[![Build Status](https://travis-ci.org/shopkeep/mulder.png?branch=master)](https://travis-ci.org/shopkeep/mulder) [![Code Climate](https://codeclimate.com/github/shopkeep/mulder/badges/gpa.svg)](https://codeclimate.com/github/shopkeep/mulder)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
data/lib/mulder/formatter.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require_relative 'formats/base'
|
2
2
|
require_relative 'formats/human'
|
3
|
+
require_relative 'formats/json'
|
3
4
|
|
4
5
|
module Mulder
|
5
6
|
class Formatter
|
6
7
|
|
7
8
|
VALID_FORMATS = {
|
8
|
-
'human' => Formats::Human
|
9
|
+
'human' => Formats::Human,
|
10
|
+
'json' => Formats::JSON
|
9
11
|
}
|
10
12
|
|
11
13
|
def initialize(instances, format)
|
@@ -22,4 +24,4 @@ module Mulder
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
end
|
27
|
+
end
|
data/lib/mulder/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Mulder::Formats::JSON do
|
4
|
+
|
5
|
+
describe '#stream' do
|
6
|
+
it 'defaults to STDOUT' do
|
7
|
+
formatter = described_class.new(anything)
|
8
|
+
expect(formatter.stream).to eq(STDOUT)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'returns the given stream' do
|
12
|
+
io = mock()
|
13
|
+
formatter = described_class.new(anything)
|
14
|
+
formatter.stream = io
|
15
|
+
|
16
|
+
expect(formatter.stream).to eq(io)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#output' do
|
21
|
+
it 'prints json encoded output to the stream' do
|
22
|
+
instances = [{ foo: :bar }]
|
23
|
+
mocked_instances = mock(collect: instances)
|
24
|
+
|
25
|
+
io = StringIO.new()
|
26
|
+
formatter = described_class.new(mocked_instances)
|
27
|
+
formatter.stream = io
|
28
|
+
|
29
|
+
formatter.output
|
30
|
+
expect(io.string).to eq('[{"foo":"bar"}]')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mulder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Duncan Grazier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- lib/mulder/connection.rb
|
180
180
|
- lib/mulder/formats/base.rb
|
181
181
|
- lib/mulder/formats/human.rb
|
182
|
+
- lib/mulder/formats/json.rb
|
182
183
|
- lib/mulder/formatter.rb
|
183
184
|
- lib/mulder/instance.rb
|
184
185
|
- lib/mulder/version.rb
|
@@ -188,6 +189,7 @@ files:
|
|
188
189
|
- spec/lib/mulder/connection_spec.rb
|
189
190
|
- spec/lib/mulder/formats/base_spec.rb
|
190
191
|
- spec/lib/mulder/formats/human_spec.rb
|
192
|
+
- spec/lib/mulder/formats/json_spec.rb
|
191
193
|
- spec/lib/mulder/formatter_spec.rb
|
192
194
|
- spec/lib/mulder/instance_spec.rb
|
193
195
|
- spec/lib/mulder_spec.rb
|
@@ -222,6 +224,7 @@ test_files:
|
|
222
224
|
- spec/lib/mulder/connection_spec.rb
|
223
225
|
- spec/lib/mulder/formats/base_spec.rb
|
224
226
|
- spec/lib/mulder/formats/human_spec.rb
|
227
|
+
- spec/lib/mulder/formats/json_spec.rb
|
225
228
|
- spec/lib/mulder/formatter_spec.rb
|
226
229
|
- spec/lib/mulder/instance_spec.rb
|
227
230
|
- spec/lib/mulder_spec.rb
|