crossover_agent 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7264cabd8358d832a4ef4ad2b15d6fd1db241d2
4
- data.tar.gz: b781bf8c5304c92eb83ee989856b14e3588d3da8
3
+ metadata.gz: 5046815e785deb13873c6a454c44dc07a40ea33a
4
+ data.tar.gz: 4bd5570b785431f9de004b18ce8274fd1d3f5663
5
5
  SHA512:
6
- metadata.gz: dd6928a0f70f2b56f74fcc086d310b84e94b9eb63e7612fd557e43a2b6f37ca14e4733f0fc8b031f3d45c979fc53024e7d25337d698164dc2fbb7351543522bb
7
- data.tar.gz: 6d5dfcde22f796d3a07edd291d81edb6acf648fff0a486730faa7d164f40b8fc52d68daba3150fc6a9c796b0d3fc7e2e5ce6cc7b6450628f899a5201c8a63e5f
6
+ metadata.gz: 3f268066548ce8e6a554c6753ff2b736cd7e6666ed19de03fddea54772a6afe34399296a47feb90c82af9b3c68fd6f133dc30eb3997ff6907508dedc08e4a4df
7
+ data.tar.gz: 8d3e4ac0581bed62f6b4a6ce114f2b202be8e224aa962e1b9e5de17ce76b96e4bf438888c095d6cfaa0b5a80d97d19b0aa537d06ba778e200a49f36598134a27
@@ -11,17 +11,17 @@ require 'usagewatch_ext'
11
11
  module CrossoverAgent
12
12
  class Base
13
13
  include Sys
14
- attr_reader :server, :port, :auth_token, :ec2_instance_id
14
+ attr_reader :instance_id, :server, :port, :auth_token, :ec2_instance_id
15
15
  def initialize(&block)
16
- @config = OpenStruct.new(server: 'localhost', port: '3000', auth_token: '123456')
17
- yield @config
16
+ @config = OpenStruct.new(instance_id: 'localhost', server: 'localhost', port: '3000', auth_token: '123456')
17
+ yield @config if block_given?
18
18
  @server = @config['server']
19
19
  @port = @config['port']
20
20
  @auth_token = @config['auth_token']
21
21
  @limit = @config['limit'] || 10
22
22
  @delay = @config['delay'] || 1
23
23
  @ec2_instance_id = `wget -q -O - http://instance-data/latest/meta-data/instance-id`
24
- @ec2_instance_id = "localhost" if @ec2_instance_id.empty?
24
+ @ec2_instance_id = @config['instance_id'] if @ec2_instance_id.empty?
25
25
  if OS.linux?
26
26
  @cpu = CPU::Load.new
27
27
  end
@@ -34,7 +34,7 @@ module CrossoverAgent
34
34
  end
35
35
 
36
36
  def self.execute
37
- cli_options = %w(-s -p -t -l -d)
37
+ cli_options = %w(-i -s -p -t -l -d)
38
38
  args, options = CliParser.parse([], cli_options)
39
39
  agent = CrossoverAgent::Base.new do |cfg|
40
40
  cfg.server = options['-s'] if options['-s']
@@ -42,6 +42,7 @@ module CrossoverAgent
42
42
  cfg.auth_token = options['-t'] if options['-t']
43
43
  cfg.limit = options['-l'].to_i if options['-l']
44
44
  cfg.delay = options['-d'].to_i if options['-d']
45
+ cfg.instance_id = options['-i'] if options['-i']
45
46
  end
46
47
  agent.execute
47
48
  end
@@ -1,3 +1,3 @@
1
1
  module CrossoverAgent
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crossover_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Truong Hoang Dung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-30 00:00:00.000000000 Z
11
+ date: 2016-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler