erforscher 1.0.0.pre1 → 1.0.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/erforscher.rb +1 -0
- data/lib/erforscher/cli.rb +7 -1
- data/lib/erforscher/formatter.rb +1 -1
- data/lib/erforscher/version.rb +1 -1
- data/spec/acceptance/cli_spec.rb +19 -3
- data/spec/erforscher/formatter_spec.rb +1 -1
- data/spec/support/fake_ec2.rb +1 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cce5c98468b9a337ecb4b9eff30866bb0f24ad2a
|
4
|
+
data.tar.gz: 797747affc4a602020e7d5fbcb61cd7358c09c23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb4008443850b614d681db4a8746221afd39462810b099445fd80eafd046cfc94fc1c8e0a3617b542e093422c21dda150bb9548f35da3cf4b3d10632db49acb5
|
7
|
+
data.tar.gz: ce000ac689f404e9129035f3b2f81be9de7e9c651384a54cf74483d85cd135133d31a435b65ba662f6812b4abcf37036df74ebbf4b25414dcf09caa588296e26
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Erforscher
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/mthssdrbrg/erforscher.svg?branch=master)](https://travis-ci.org/mthssdrbrg/erforscher)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/erforscher.svg)](http://badge.fury.io/rb/erforscher)
|
4
5
|
|
5
6
|
Erforscher, German for "explorer", is a poor man's service discovery tool that
|
6
7
|
utilizes the AWS EC2 APIs to filter instances from a configured set of `tags`
|
@@ -31,7 +32,8 @@ the near future.
|
|
31
32
|
## Usage
|
32
33
|
|
33
34
|
```bash
|
34
|
-
erforscher
|
35
|
+
erforscher -h|--help
|
36
|
+
erforscher -v|--version
|
35
37
|
erforscher -T|--tags <K1=V1,K2=V2>
|
36
38
|
erforscher -N|--name <TAG>
|
37
39
|
erforscher -c|--config <PATH>
|
data/lib/erforscher.rb
CHANGED
data/lib/erforscher/cli.rb
CHANGED
@@ -11,10 +11,12 @@ module Erforscher
|
|
11
11
|
if config['print_usage']
|
12
12
|
io.puts(@parser)
|
13
13
|
2
|
14
|
+
elsif config['print_version']
|
15
|
+
io.puts(%(erforscher v#{Erforscher::VERSION}))
|
14
16
|
else
|
15
17
|
Runner.run(config)
|
16
|
-
0
|
17
18
|
end
|
19
|
+
0
|
18
20
|
rescue => e
|
19
21
|
io.puts(%(#{e.message} (#{e.class.name})))
|
20
22
|
io.puts(@parser)
|
@@ -37,6 +39,10 @@ module Erforscher
|
|
37
39
|
cli['name_tag'] = name_tag
|
38
40
|
end
|
39
41
|
|
42
|
+
parser.on('-v', '--version', 'Display current version') do
|
43
|
+
cli['print_version'] = true
|
44
|
+
end
|
45
|
+
|
40
46
|
parser.on('-h', '--help', 'You\'re looking at it') do
|
41
47
|
cli['print_usage'] = true
|
42
48
|
end
|
data/lib/erforscher/formatter.rb
CHANGED
data/lib/erforscher/version.rb
CHANGED
data/spec/acceptance/cli_spec.rb
CHANGED
@@ -49,20 +49,22 @@ describe 'bin/erforscher' do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
after do
|
52
|
+
hostsfile.close
|
52
53
|
hostsfile.delete
|
54
|
+
config_file.close
|
53
55
|
config_file.delete
|
54
56
|
end
|
55
57
|
|
56
58
|
context 'when given --help or -h' do
|
57
|
-
it 'returns
|
59
|
+
it 'returns 0 and prints usage' do
|
58
60
|
code = Erforscher::Cli.run(%w[-h], io)
|
59
|
-
expect(code).to eq(
|
61
|
+
expect(code).to eq(0)
|
60
62
|
expect(io.string).to include 'Usage:'
|
61
63
|
|
62
64
|
io.rewind
|
63
65
|
|
64
66
|
code = Erforscher::Cli.run(%w[--help], io)
|
65
|
-
expect(code).to eq(
|
67
|
+
expect(code).to eq(0)
|
66
68
|
expect(io.string).to include 'Usage:'
|
67
69
|
end
|
68
70
|
end
|
@@ -138,4 +140,18 @@ describe 'bin/erforscher' do
|
|
138
140
|
expect(new_hostsfile).to include("instance-004\t10.0.0.4")
|
139
141
|
end
|
140
142
|
end
|
143
|
+
|
144
|
+
context 'when given -v or --version' do
|
145
|
+
it 'returns 0 and prints current version' do
|
146
|
+
code = Erforscher::Cli.run(%w[-v], io)
|
147
|
+
expect(code).to eq(0)
|
148
|
+
expect(io.string).to match(/^erforscher v\d+\.\d+\.\d+/)
|
149
|
+
|
150
|
+
io.rewind
|
151
|
+
|
152
|
+
code = Erforscher::Cli.run(%w[--version], io)
|
153
|
+
expect(code).to eq(0)
|
154
|
+
expect(io.string).to match(/^erforscher v\d+\.\d+\.\d+/)
|
155
|
+
end
|
156
|
+
end
|
141
157
|
end
|
@@ -15,7 +15,7 @@ module Erforscher
|
|
15
15
|
let :instance do
|
16
16
|
OpenStruct.new({
|
17
17
|
tags: [
|
18
|
-
|
18
|
+
{key: 'Name', value: 'hello-world-001.domain.com'}
|
19
19
|
],
|
20
20
|
private_ip_address: '10.0.0.1',
|
21
21
|
private_dns_name: 'private-dns-name',
|
data/spec/support/fake_ec2.rb
CHANGED
@@ -2,12 +2,7 @@
|
|
2
2
|
|
3
3
|
class FakeEc2
|
4
4
|
def initialize(instances)
|
5
|
-
@instances = instances.map
|
6
|
-
tags = instance.delete(:tags)
|
7
|
-
tags = tags.map { |tag| OpenStruct.new(tag) }
|
8
|
-
instance[:tags] = tags
|
9
|
-
OpenStruct.new(instance)
|
10
|
-
end
|
5
|
+
@instances = instances.map { |instance| OpenStruct.new(instance) }
|
11
6
|
end
|
12
7
|
|
13
8
|
def describe_instances(opts={})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erforscher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Söderberg
|
@@ -61,9 +61,9 @@ require_paths:
|
|
61
61
|
- lib
|
62
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
66
|
+
version: 1.9.3
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - ">"
|