hotdog 0.1.9 → 0.1.10

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: a977853c554635cda43f1247c7c2a10264c343ce
4
- data.tar.gz: f9dbf44744c041c8574e9b1bc384dd080a66848e
3
+ metadata.gz: 004bbaba7b65fb0cc3fba2c01eb465ce997a61a2
4
+ data.tar.gz: 09dac6927faae3cc9c74b90ee8a078fec52f79cc
5
5
  SHA512:
6
- metadata.gz: c6826283bbbf10a5dba85bc85769b4247bc3a0793dd62794a243ca36f8d167f678b4e08216d82556f19cc5ab0669e8360aefcf52f08b440250d686f20ed83e7f
7
- data.tar.gz: 6860eff5f70b693c4288fcd09ea43e6e26d9316d1f40364b00c6e1e5a378c493e339d2d09a290ddb0b050961495f39ca6b9b4c6246708ad12647216846b5dcb5
6
+ metadata.gz: b1bc205cff0d6b97ea4acc5e488ca15df3814cc005366f19ff8fff3ed03b23ad369a077cbed09f02f9f2361d421493163af12622d78d94b180999d3d95c95fcf
7
+ data.tar.gz: 1a22434d7e7c906c826327f705935ff354b950c1c46f4f8515e12d16267adf004668c1df6ac549db57bfbc20543b68ed41e3c48279d08fb859433ee158084a02
@@ -6,19 +6,15 @@ module Hotdog
6
6
  module Commands
7
7
  class Down < BaseCommand
8
8
  def run(args=[])
9
- if args.index("--start").nil?
10
- start = Time.new
11
- else
12
- start = Time.parse(args[args.index("--start") + 1])
13
- args.slice!(args.index("--start"), 2)
9
+ downtime = 86400
10
+ start = Time.new
11
+ optparse.on("--downtime DURATION") do |v|
12
+ downtime = v.to_i
14
13
  end
15
- if args.index("--downtime").nil?
16
- downtime = 86400
17
- else
18
- downtime = args[args.index("--downtime") + 1].to_i
19
- args.slice!(args.index("--downtime"), 2)
14
+ optparse.on("--start TIME") do |v|
15
+ start = Time.parse(v)
20
16
  end
21
-
17
+ args = optparse.parse(args)
22
18
  args.each do |arg|
23
19
  if arg.index(":").nil?
24
20
  scope = "host:#{arg}"
@@ -5,8 +5,8 @@ module Hotdog
5
5
  class Tags < BaseCommand
6
6
  def run(args=[])
7
7
  args = optparse.parse(args)
8
- if 0 < tags.length
9
- fields = tags.map { |tag|
8
+ if 0 < args.length
9
+ fields = args.map { |tag|
10
10
  tag_name, tag_value = tag.split(":", 2)
11
11
  tag_name
12
12
  }
@@ -25,7 +25,7 @@ module Hotdog
25
25
  EOS
26
26
  end
27
27
  }
28
- result = (0..result1.reduce(0) { |max, values| [max, values.length].max }).map { |field_index|
28
+ result = (0...result1.reduce(0) { |max, values| [max, values.length].max }).map { |field_index|
29
29
  result1.map { |values| values[field_index] }
30
30
  }
31
31
  else
@@ -6,6 +6,7 @@ module Hotdog
6
6
  module Commands
7
7
  class Up < BaseCommand
8
8
  def run(args=[])
9
+ args = optparse.parse(args)
9
10
  scopes = args.map { |arg|
10
11
  if arg.index(":").nil?
11
12
  "host:#{arg}"
@@ -27,7 +27,8 @@ module Hotdog
27
27
  },
28
28
  ] + result.map { |row|
29
29
  row.zip(field_length).map { |field, length|
30
- field.to_s + (" " * (length - field.length))
30
+ padding = length - ((field.nil?) ? 0 : field.length)
31
+ field.to_s + (" " * padding)
31
32
  }
32
33
  }
33
34
  end
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "hotdog/formatters/plain"
4
+
5
+ module Hotdog
6
+ module Formatters
7
+ class Text < Plain
8
+ end
9
+ end
10
+ end
11
+
12
+ # vim:set ft=ruby :
@@ -1,3 +1,3 @@
1
1
  module Hotdog
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotdog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamashita Yuu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-09 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,6 +125,7 @@ files:
125
125
  - lib/hotdog/formatters/json.rb
126
126
  - lib/hotdog/formatters/ltsv.rb
127
127
  - lib/hotdog/formatters/plain.rb
128
+ - lib/hotdog/formatters/text.rb
128
129
  - lib/hotdog/formatters/tsv.rb
129
130
  - lib/hotdog/formatters/yaml.rb
130
131
  - lib/hotdog/version.rb
@@ -148,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
149
  version: '0'
149
150
  requirements: []
150
151
  rubyforge_project:
151
- rubygems_version: 2.2.2
152
+ rubygems_version: 2.2.3
152
153
  signing_key:
153
154
  specification_version: 4
154
155
  summary: Yet another command-line tool for Datadog