wavefront-cli 7.2.0 → 8.0.0

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
  SHA256:
3
- metadata.gz: 65a2455065fbd4b69b42718f7789e4c01cb5245a0015ea7d2977b96581ad0b83
4
- data.tar.gz: 2c01e8464589c804271a97dba24a19a62b3f4a1dba9af588216f1d0b911c9ec9
3
+ metadata.gz: 4935d9901fe186c38fdbe357b4ee52d3b98d3bc6a214f4c3648d52229f760e92
4
+ data.tar.gz: acbf0f389bbfc37c2bc61ab1aa772afdbc92984d4d7592bf8f8f93ba606d78be
5
5
  SHA512:
6
- metadata.gz: 392ea65a15b94665c5255da837abcaf3a8b69d38db9b675652c5c824627b3436b4b802174283bcdda6d2f95150cb3fce0a21de2dfcb449c64a0a73259d16357b
7
- data.tar.gz: f55ffa3998170ee1a3d98f55cdefa9cd27d2f84e39f3c2fcbe3ffb649bcb34eeb96e93e1a486f4edfa030244e4640e3777865eef6f6119380dec7ff273637041
6
+ metadata.gz: 8efc8b7a1363bc0e0b0b3800ce70b0fb1b4cb8b8dd61a03fdd56be5376fe4abf178975414926dfff03ae742f66f7469f5810c29bd0fafcc070423fd34175c5e3
7
+ data.tar.gz: 725f41a25db164bf4c3f5835df9ff490bfe54e1f4b3cc2beb461d1000bd1ef212584f995501e8706aa876c989ec258176239996d50bb943c963395d7a5a1367d
@@ -1,49 +1,18 @@
1
1
  ---
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.4
4
+ TargetRubyVersion: 2.5
5
+ NewCops: enable
5
6
 
6
7
  Metrics/ClassLength:
7
8
  Max: 400
8
9
 
9
10
  Style/IfUnlessModifier:
10
11
  Enabled: false # because it wants to make lines >80 chars
11
- Style/HashEachMethods:
12
- Enabled: true
13
- Style/HashTransformKeys:
14
- Enabled: true
15
- Style/HashTransformValues:
16
- Enabled: true
17
-
18
- # New compatabilities
19
- Layout/EmptyLinesAroundAttributeAccessor:
20
- Enabled: true
21
- Layout/SpaceAroundMethodCallOperator:
22
- Enabled: true
23
- Lint/RaiseException:
24
- Enabled: true
25
- Lint/StructNewOverride:
26
- Enabled: true
27
- Style/ExponentialNotation:
28
- Enabled: true
29
- Style/SlicingWithRange:
30
- Enabled: true
31
- Lint/DeprecatedOpenSSLConstant:
32
- Enabled: true
33
- Lint/MixedRegexpCaptureTypes:
34
- Enabled: true
35
- Style/RedundantRegexpCharacterClass:
36
- Enabled: true
37
- Style/RedundantRegexpEscape:
38
- Enabled: true
39
- Style/AccessorGrouping:
40
- Enabled: true
41
- Style/BisectedAttrAccessor:
42
- Enabled: true
43
- Style/RedundantAssignment:
44
- Enabled: true
45
- Style/RedundantFetchBlock:
46
- Enabled: true
12
+ Style/StringConcatenation:
13
+ Enabled: false
14
+ Style/OptionalBooleanParameter:
15
+ Enabled: false
47
16
 
48
17
  # Is nothing sacred?
49
18
  Layout/LineLength:
@@ -1,10 +1,9 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.4.9
5
- - 2.5.7
6
- - 2.6.5
7
- - 2.7.0
4
+ - 2.5.8
5
+ - 2.6.6
6
+ - 2.7.1
8
7
  before_install: gem install bundler --no-document
9
8
  deploy:
10
9
  provider: rubygems
@@ -14,7 +13,7 @@ deploy:
14
13
  on:
15
14
  tags: true
16
15
  repo: snltd/wavefront-cli
17
- ruby: 2.6.5
16
+ ruby: 2.6.6
18
17
  notifications:
19
18
  email: false
20
19
  slack:
data/HISTORY.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 8.0.0 (2020-09-20
4
+ * Drop Ruby 2.4.0 support. (Breaking change.)
5
+
3
6
  ## 7.2.0 (2020-08-12)
4
7
  * Add `cloudintegration awsid generate` command.
5
8
  * Add `cloudintegration awsid delete <external_id>` command.
data/README.md CHANGED
@@ -15,7 +15,7 @@ $ gem install wavefront-cli
15
15
 
16
16
  It is built on [our Wavefront Ruby
17
17
  SDK](https://github.com/snltd/wavefront-sdk) and requires Ruby >=
18
- 2.4. It has no "native extension" dependencies.
18
+ 2.5. It has no "native extension" dependencies.
19
19
 
20
20
  For a far more comprehensive overview/tutorial, please read [this
21
21
  article](https://sysdef.xyz/article/wavefront-cli).
@@ -102,12 +102,10 @@ module WavefrontCli
102
102
 
103
103
  def validate_tags(key = :'<tag>')
104
104
  Array(options[key]).each do |t|
105
- begin
106
- send(:wf_tag?, t)
107
- rescue Wavefront::Exception::InvalidTag
108
- raise(WavefrontCli::Exception::InvalidInput,
109
- "'#{t}' is not a valid tag.")
110
- end
105
+ send(:wf_tag?, t)
106
+ rescue Wavefront::Exception::InvalidTag
107
+ raise(WavefrontCli::Exception::InvalidInput,
108
+ "'#{t}' is not a valid tag.")
111
109
  end
112
110
  end
113
111
 
@@ -371,9 +369,10 @@ module WavefrontCli
371
369
  def do_dump
372
370
  cannot_noop!
373
371
 
374
- if options[:format] == 'yaml'
372
+ case options[:format]
373
+ when 'yaml'
375
374
  ok_exit dump_yaml
376
- elsif options[:format] == 'json'
375
+ when 'json'
377
376
  ok_exit dump_json
378
377
  else
379
378
  abort format("Dump format must be 'json' or 'yaml'. " \
@@ -539,7 +538,8 @@ module WavefrontCli
539
538
  #
540
539
  # rubocop:disable Metrics/MethodLength
541
540
  def extract_values(obj, key, aggr = [])
542
- if obj.is_a?(Hash)
541
+ case obj.class
542
+ when Hash
543
543
  obj.each_pair do |k, v|
544
544
  if k == key && !v.to_s.empty?
545
545
  aggr.<< v
@@ -547,7 +547,7 @@ module WavefrontCli
547
547
  extract_values(v, key, aggr)
548
548
  end
549
549
  end
550
- elsif obj.is_a?(Array)
550
+ when Array
551
551
  obj.each { |e| extract_values(e, key, aggr) }
552
552
  end
553
553
 
@@ -1,47 +1,19 @@
1
1
  ---
2
+ AllCops:
3
+ NewCops: enable
2
4
 
3
5
  # There are long things in here, but they're fine
4
6
  #
5
7
  Metrics/MethodLength:
6
8
  Max: 25
7
9
 
8
- Style/HashEachMethods:
9
- Enabled: true
10
- Style/HashTransformKeys:
11
- Enabled: true
12
- Style/HashTransformValues:
13
- Enabled: true
14
-
15
- # new compatabilities
16
- Layout/EmptyLinesAroundAttributeAccessor:
17
- Enabled: true
18
- Layout/SpaceAroundMethodCallOperator:
19
- Enabled: true
20
- Lint/RaiseException:
21
- Enabled: true
22
- Lint/StructNewOverride:
23
- Enabled: true
24
- Style/ExponentialNotation:
25
- Enabled: true
26
- Style/SlicingWithRange:
27
- Enabled: true
28
- Lint/DeprecatedOpenSSLConstant:
29
- Enabled: true
30
- Lint/MixedRegexpCaptureTypes:
31
- Enabled: true
32
- Style/RedundantRegexpCharacterClass:
33
- Enabled: true
34
- Style/RedundantRegexpEscape:
35
- Enabled: true
36
- Style/AccessorGrouping:
37
- Enabled: true
38
- Style/BisectedAttrAccessor:
39
- Enabled: true
40
- Style/RedundantAssignment:
41
- Enabled: true
42
- Style/RedundantFetchBlock:
43
- Enabled: true
44
-
45
10
  # Is nothing sacred?
46
11
  Layout/LineLength:
47
12
  Max: 80
13
+
14
+ Style/IfUnlessModifier:
15
+ Enabled: false # because it wants to make lines >80 chars
16
+ Style/StringConcatenation:
17
+ Enabled: false
18
+ Style/OptionalBooleanParameter:
19
+ Enabled: false
@@ -36,11 +36,13 @@ module WavefrontCli
36
36
 
37
37
  RX = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/.freeze
38
38
 
39
+ # rubocop:disable Lint/MissingSuper
39
40
  def initialize(options)
40
41
  @options = options
41
42
  @config_file = _config_file
42
43
  @profile = options[:'<profile>'] || 'default'
43
44
  end
45
+ # rubocop:enable Lint/MissingSuper
44
46
 
45
47
  def do_location
46
48
  puts config_file
@@ -144,7 +146,7 @@ module WavefrontCli
144
146
  # catch a ctrl-d
145
147
  #
146
148
  def read_input
147
- STDIN.gets.strip
149
+ $stdin.gets.strip
148
150
  rescue NoMethodError
149
151
  abort "\nInput aborted at user request."
150
152
  end
@@ -177,8 +177,6 @@ class WavefrontCliController
177
177
  # return [Hash] h with modified keys
178
178
  #
179
179
  def sanitize_keys(options)
180
- options.each_with_object({}) do |(k, v), r|
181
- r[k.to_s.delete('-').to_sym] = v
182
- end
180
+ options.transform_keys { |k| k.to_s.delete('-').to_sym }
183
181
  end
184
182
  end
@@ -75,6 +75,7 @@ module WavefrontDisplayPrinter
75
75
  #
76
76
  # Make an array of hashes: { key, value, depth }
77
77
  #
78
+ # rubocop:disable Style/CaseLikeIf
78
79
  def make_list(data, aggr = [], depth = 0, last_key = nil)
79
80
  if data.is_a?(Hash)
80
81
  append_hash(data, aggr, depth)
@@ -84,6 +85,7 @@ module WavefrontDisplayPrinter
84
85
  aggr.<< ['', preened_value(data), depth]
85
86
  end
86
87
  end
88
+ # rubocop:enable Style/CaseLikeIf
87
89
 
88
90
  def smart_value(val)
89
91
  val.to_s.empty? && opts[:none] ? '<none>' : preened_value(val)
@@ -150,6 +152,7 @@ module WavefrontDisplayPrinter
150
152
  # @param depth [Integer]
151
153
  # @return [Array[Array]]
152
154
  #
155
+ # rubocop:disable Style/CaseLikeIf
153
156
  def append_hash(data, aggr, depth)
154
157
  data.each_pair do |k, v|
155
158
  if v.is_a?(Hash)
@@ -163,6 +166,7 @@ module WavefrontDisplayPrinter
163
166
 
164
167
  aggr
165
168
  end
169
+ # rubocop:enable Style/CaseLikeIf
166
170
 
167
171
  # Part of the #make_list recursion. Deals with arrays.
168
172
  #
@@ -97,6 +97,7 @@ module WavefrontCli
97
97
  # return [Hash] body for #create() method
98
98
  #
99
99
  # rubocop:disable Metrics/MethodLength
100
+ # rubocop:disable Metrics/AbcSize
100
101
  def create_body(opts, t_start)
101
102
  { name: opts[:'<event>'],
102
103
  startTime: t_start,
@@ -111,6 +112,7 @@ module WavefrontCli
111
112
  end
112
113
  end
113
114
  end
115
+ # rubocop:enable Metrics/AbcSize
114
116
  # rubocop:enable Metrics/MethodLength
115
117
 
116
118
  def annotations(opts)
@@ -8,7 +8,6 @@ module WavefrontCli
8
8
  # rubocop:disable Metrics/MethodLength
9
9
  # rubocop:disable Metrics/AbcSize
10
10
  # rubocop:disable Metrics/CyclomaticComplexity
11
- # rubocop:disable Metrics/PerceivedComplexity
12
11
  def exception_handler(exception)
13
12
  case exception
14
13
  when WavefrontCli::Exception::UnhandledCommand
@@ -83,7 +82,6 @@ module WavefrontCli
83
82
  end
84
83
  # rubocop:enable Metrics/MethodLength
85
84
  # rubocop:enable Metrics/AbcSize
86
- # rubocop:enable Metrics/PerceivedComplexity
87
85
  # rubocop:enable Metrics/CyclomaticComplexity
88
86
  end
89
87
  end
@@ -38,12 +38,10 @@ module WavefrontCli
38
38
 
39
39
  def point_filter_regexes
40
40
  ret = options[:pointregex].each_with_object({}) do |r, a|
41
- begin
42
- k, v = r.split('=', 2)
43
- a[k.to_sym] = v
44
- rescue StandardError
45
- puts "cannot parse point regex '#{r}'. Skipping."
46
- end
41
+ k, v = r.split('=', 2)
42
+ a[k.to_sym] = v
43
+ rescue StandardError
44
+ puts "cannot parse point regex '#{r}'. Skipping."
47
45
  end
48
46
 
49
47
  ret.empty? ? nil : ret
@@ -57,7 +57,7 @@ module WavefrontCli
57
57
  # does not parse
58
58
  #
59
59
  def load_from_stdin
60
- raw = STDIN.read
60
+ raw = $stdin.read
61
61
 
62
62
  if raw.start_with?('---')
63
63
  read_yaml(raw)
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'pathname'
4
4
  require 'wavefront-sdk/credentials'
5
- require_relative 'constants.rb'
5
+ require_relative 'constants'
6
6
 
7
7
  module WavefrontCli
8
8
  #
@@ -69,7 +69,7 @@ module WavefrontCli
69
69
  #
70
70
  def load_profile(cred_opts)
71
71
  creds = Wavefront::Credentials.new(cred_opts).config
72
- Hash[creds.map { |k, v| [k.to_sym, v] }]
72
+ creds.transform_keys(&:to_sym)
73
73
  end
74
74
  end
75
75
  end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- WF_CLI_VERSION = '7.2.0'
3
+ WF_CLI_VERSION = '8.0.0'
@@ -167,12 +167,10 @@ module WavefrontCli
167
167
  #
168
168
  def process_input_file(data)
169
169
  data.each_with_object([]) do |l, a|
170
- begin
171
- a.<< process_line(l)
172
- rescue WavefrontCli::Exception::UnparseableInput => e
173
- puts "Bad input. #{e.message}."
174
- next
175
- end
170
+ a.<< process_line(l)
171
+ rescue WavefrontCli::Exception::UnparseableInput => e
172
+ puts "Bad input. #{e.message}."
173
+ next
176
174
  end
177
175
  end
178
176
 
@@ -193,7 +191,7 @@ module WavefrontCli
193
191
  #
194
192
  def read_stdin
195
193
  open_connection
196
- STDIN.each_line { |l| call_write(process_line(l.strip), false) }
194
+ $stdin.each_line { |l| call_write(process_line(l.strip), false) }
197
195
  close_connection
198
196
  rescue SystemExit, Interrupt
199
197
  puts 'ctrl-c. Exiting.'
@@ -1,4 +1,7 @@
1
1
  ---
2
+ AllCops:
3
+ NewCops: enable
4
+
2
5
  Metrics/MethodLength:
3
6
  Max: 30
4
7
 
@@ -8,43 +11,13 @@ Metrics/AbcSize:
8
11
  Metrics/ClassLength:
9
12
  Max: 300
10
13
 
11
- Style/HashEachMethods:
12
- Enabled: true
13
- Style/HashTransformKeys:
14
- Enabled: true
15
- Style/HashTransformValues:
16
- Enabled: true
17
-
18
- # new compatabilities
19
- Layout/EmptyLinesAroundAttributeAccessor:
20
- Enabled: true
21
- Layout/SpaceAroundMethodCallOperator:
22
- Enabled: true
23
- Lint/RaiseException:
24
- Enabled: true
25
- Lint/StructNewOverride:
26
- Enabled: true
27
- Style/ExponentialNotation:
28
- Enabled: true
29
- Style/SlicingWithRange:
30
- Enabled: true
31
- Lint/DeprecatedOpenSSLConstant:
32
- Enabled: true
33
- Lint/MixedRegexpCaptureTypes:
34
- Enabled: true
35
- Style/RedundantRegexpCharacterClass:
36
- Enabled: true
37
- Style/RedundantRegexpEscape:
38
- Enabled: true
39
- Style/AccessorGrouping:
40
- Enabled: true
41
- Style/BisectedAttrAccessor:
42
- Enabled: true
43
- Style/RedundantAssignment:
44
- Enabled: true
45
- Style/RedundantFetchBlock:
46
- Enabled: true
47
-
48
14
  # Is nothing sacred?
49
15
  Layout/LineLength:
50
16
  Max: 80
17
+
18
+ Style/IfUnlessModifier:
19
+ Enabled: false # because it wants to make lines >80 chars
20
+ Style/StringConcatenation:
21
+ Enabled: false
22
+ Style/OptionalBooleanParameter:
23
+ Enabled: false
@@ -105,11 +105,9 @@ module Minitest
105
105
  "performed as no-ops.\n", err)
106
106
  end
107
107
 
108
- def assert_repeated_output(msg)
108
+ def assert_repeated_output(msg, &block)
109
109
  begin
110
- out, err = capture_io do
111
- yield
112
- end
110
+ out, err = capture_io(&block)
113
111
  rescue SystemExit => e
114
112
  puts e.backtrace
115
113
  p e
@@ -48,7 +48,7 @@ class WavefrontCliConfigTest < MiniTest::Test
48
48
 
49
49
  def test_read_input
50
50
  ["value \n", " value\n", " value \t\n", "value\n"].each do |v|
51
- STDIN.stub(:gets, v) { assert_equal('value', wf.read_input) }
51
+ $stdin.stub(:gets, v) { assert_equal('value', wf.read_input) }
52
52
  end
53
53
  end
54
54
 
@@ -79,9 +79,11 @@ end
79
79
  # so we can get at the methods without triggering one of the things
80
80
  # tested above.
81
81
  #
82
+ # rubocop:disable Lint/MissingSuper
82
83
  class Giblets < WavefrontCliController
83
84
  def initialize; end
84
85
  end
86
+ # rubocop:enable Lint/MissingSuper
85
87
 
86
88
  # Here's the subclass
87
89
  #
@@ -30,10 +30,10 @@ Gem::Specification.new do |gem|
30
30
 
31
31
  gem.add_development_dependency 'minitest', '~> 5.11', '>= 5.11.0'
32
32
  gem.add_development_dependency 'rake', '~> 13.0'
33
- gem.add_development_dependency 'rubocop', '0.87.1'
33
+ gem.add_development_dependency 'rubocop', '0.91.0'
34
34
  gem.add_development_dependency 'spy', '~> 1.0.0'
35
35
  gem.add_development_dependency 'webmock', '~> 3.7'
36
36
  gem.add_development_dependency 'yard', '~> 0.9.5'
37
37
 
38
- gem.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
38
+ gem.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.0
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-12 00:00:00.000000000 Z
11
+ date: 2020-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 0.87.1
95
+ version: 0.91.0
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 0.87.1
102
+ version: 0.91.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: spy
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -402,7 +402,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
402
402
  requirements:
403
403
  - - ">="
404
404
  - !ruby/object:Gem::Version
405
- version: 2.4.0
405
+ version: 2.5.0
406
406
  required_rubygems_version: !ruby/object:Gem::Requirement
407
407
  requirements:
408
408
  - - ">="