utils 0.31.1 → 0.33.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: 8d7f609e660eeda7da1508e1b1afddd1a3b01e7232153f59ba4ca4cc1b11b052
4
- data.tar.gz: ba8ef55413f9b3890f4cfd239864c67e10fb81ac5314197932c451b2f69bdd7d
3
+ metadata.gz: 12cef3e32a424a560f550a93f4fbd793ab4ead58999cd091ae62613f681e125f
4
+ data.tar.gz: 3eb0225e890989209666e6194db9c1bfcf8e1fadc8c27f8cce9d6a4850c88f31
5
5
  SHA512:
6
- metadata.gz: 8ab8ae0a58b32aa3c78b6002bf6a4bde18cbaa99070a4dabeb198aabf2d1bc1a4b33856adb77fe0ac812220335ace5d8d802df267576b6e629c3b23524e670df
7
- data.tar.gz: adcf4e93e2a3f6b507c4eea3ec2ab65c9d02054be2db6ed8ae9ca18803e39b33bb14e5578a2fb342124a5c300c8c7484740e63e4bea8a7b441a2b83fa03cea9f
6
+ metadata.gz: abd0e88886486b7351b772bc90f8f3c5e0bd69cbd903650025ff586456a0a497326d9be87331447d830b8700be5f6bde2da8a3cc37fec99ef53aaf01a2a0f795
7
+ data.tar.gz: 9009126fb1c63d1327b16f6fb2cc98c307f1a4ae911c2f23b20b9f4658024e31c88da552a9f3a9be719a62fd7dc6f110d166304758f0baa5b4739f21b0588bd3
data/bin/probe CHANGED
@@ -20,6 +20,7 @@ Options are
20
20
  -C FOO[=BAR] set/get env variable on probe server
21
21
  -l start probe as a server
22
22
  -u URI use this DRb URI communication
23
+ -f FORMATTER use FORMATTER to display rspec output
23
24
  -h display this help
24
25
 
25
26
  Version is #{File.basename($0)} #{Utils::VERSION}.
@@ -31,6 +32,7 @@ def cmd(*args)
31
32
  if ENV.key?('BUNDLE_GEMFILE')
32
33
  args.unshift 'bundle', 'exec'
33
34
  end
35
+ p args
34
36
  puts args * ' '
35
37
  system(*args) or exit $?.exitstatus
36
38
  end
@@ -76,7 +78,7 @@ def connect_server
76
78
  end
77
79
  end
78
80
  if $opts[?c]
79
- opts = $opts.subhash('n', 't').each_with_object([]) { |(k, v), a|
81
+ opts = $opts.subhash(*%w[n t f]).each_with_object([]) { |(k, v), a|
80
82
  v.full? and a.concat [ "-#{k}", v ]
81
83
  }
82
84
  probe_server.enqueue opts + $args
@@ -93,7 +95,7 @@ if i = ARGV.index('--')
93
95
  else
94
96
  $args = ARGV.dup
95
97
  end
96
- $opts = go 'lct:n:u:C:h', $args
98
+ $opts = go 'lct:n:u:C:f:h', $args
97
99
  $opts[?h] and usage
98
100
 
99
101
  $uri = $opts[?u] || 'drbunix:probe.socket'
@@ -117,7 +119,10 @@ when :rspec
117
119
  else
118
120
  rspec = [ find_cmd('rspec', 'spec') ]
119
121
  end
120
- rspec << '-rutils' << '-f' << 'Utils::LineFormatter'
122
+ rspec << '-rutils'
123
+ unless $args.any? { |a| a.start_with?('-f') }
124
+ rspec << '-f' << ($opts[?f] || 'Utils::LineFormatter')
125
+ end
121
126
  $args = $args.map do |a|
122
127
  if Utils::Editor::FILE_LINENUMBER_REGEXP =~ a
123
128
  $~.captures.compact * ':'
data/lib/utils/irb.rb CHANGED
@@ -273,6 +273,7 @@ module Utils
273
273
  def irb_time_watch(duration = 1)
274
274
  start = Time.now
275
275
  pre = nil
276
+ avg = Hash.new
276
277
  loop do
277
278
  cur = [ yield ].flatten
278
279
  unless pre
@@ -282,7 +283,20 @@ module Utils
282
283
  expired = Time.now - start
283
284
  diffs = cur.zip(pre).map { |c, p| c - p }
284
285
  rates = diffs.map { |d| d / duration }
285
- warn "#{expired} #{cur.zip(diffs, rates).map(&:inspect) * ' '} 𝝙 / per sec."
286
+ durs = cur.zip(rates).each_with_index.map { |(c, r), i|
287
+ if r < 0
288
+ x = c.to_f / -r
289
+ a = avg[i].to_f
290
+ a -= a / 2
291
+ a += x / 2
292
+ d = Tins::Duration.new(a)
293
+ ds = d.to_s
294
+ ds.singleton_class { define_method(:to_f) { d.to_f } }
295
+ avg[i] = ds
296
+ end
297
+ avg[i]
298
+ }
299
+ warn "#{expired} #{cur.zip(diffs, rates, durs).map(&:inspect) * ' '} 𝝙 / per sec."
286
300
  pre = cur.map(&:to_f)
287
301
  sleep duration
288
302
  end
@@ -227,7 +227,7 @@ module Utils
227
227
  call << bundle << 'exec'
228
228
  end
229
229
  call.push($0, *job)
230
- #output_message "Executing #{call.inspect} now.", type: :info
230
+ output_message "Executing #{call.inspect} now.", type: :info
231
231
  call
232
232
  end
233
233
  end
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.31.1'
3
+ VERSION = '0.33.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/utils.gemspec CHANGED
@@ -1,23 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.31.1 ruby lib
2
+ # stub: utils 0.33.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils".freeze
6
- s.version = "0.31.1"
6
+ s.version = "0.33.0"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2022-08-04"
11
+ s.date = "2022-12-05"
12
12
  s.description = "This ruby gem provides some useful command line utilities".freeze
13
13
  s.email = "flori@ping.de".freeze
14
- s.executables = ["ascii7".freeze, "blameline".freeze, "check-yaml".freeze, "classify".freeze, "create_cstags".freeze, "create_tags".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "fix-brew".freeze, "git-empty".freeze, "git-versions".freeze, "irb_connect".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "number_files".freeze, "on_change".freeze, "path".freeze, "probe".freeze, "rd2md".freeze, "search".freeze, "sedit".freeze, "serve".freeze, "ssh-tunnel".freeze, "ssl_cert_info".freeze, "strip_spaces".freeze, "untest".freeze, "utils-utilsrc".freeze, "vcf2alias".freeze]
14
+ s.executables = ["ascii7".freeze, "blameline".freeze, "check-yaml".freeze, "classify".freeze, "create_cstags".freeze, "create_tags".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "fix-brew".freeze, "git-empty".freeze, "git-versions".freeze, "irb_connect".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "number_files".freeze, "on_change".freeze, "path".freeze, "probe".freeze, "rd2md".freeze, "search".freeze, "sedit".freeze, "serve".freeze, "ssh-tunnel".freeze, "strip_spaces".freeze, "untest".freeze, "utils-utilsrc".freeze, "vcf2alias".freeze]
15
15
  s.extra_rdoc_files = ["README.md".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
16
- s.files = [".github/workflows/codeql-analysis.yml".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/check-yaml".freeze, "bin/classify".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/fix-brew".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_connect".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/probe".freeze, "bin/rd2md".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/ssl_cert_info".freeze, "bin/strip_spaces".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "utils.gemspec".freeze]
16
+ s.files = [".github/workflows/codeql-analysis.yml".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/check-yaml".freeze, "bin/classify".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/fix-brew".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_connect".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/probe".freeze, "bin/rd2md".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "utils.gemspec".freeze]
17
17
  s.homepage = "http://github.com/flori/utils".freeze
18
18
  s.licenses = ["GPL-2.0".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "Utils - Some useful command line utilities".freeze, "--main".freeze, "README.md".freeze]
20
- s.rubygems_version = "3.2.33".freeze
20
+ s.rubygems_version = "3.3.26".freeze
21
21
  s.summary = "Some useful command line utilities".freeze
22
22
 
23
23
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.1
4
+ version: 0.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-04 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -151,7 +151,6 @@ executables:
151
151
  - sedit
152
152
  - serve
153
153
  - ssh-tunnel
154
- - ssl_cert_info
155
154
  - strip_spaces
156
155
  - untest
157
156
  - utils-utilsrc
@@ -207,7 +206,6 @@ files:
207
206
  - bin/sedit
208
207
  - bin/serve
209
208
  - bin/ssh-tunnel
210
- - bin/ssl_cert_info
211
209
  - bin/strip_spaces
212
210
  - bin/untest
213
211
  - bin/utils-utilsrc
@@ -252,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
250
  - !ruby/object:Gem::Version
253
251
  version: '0'
254
252
  requirements: []
255
- rubygems_version: 3.2.33
253
+ rubygems_version: 3.3.26
256
254
  signing_key:
257
255
  specification_version: 4
258
256
  summary: Some useful command line utilities
data/bin/ssl_cert_info DELETED
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- def cert_info(crt)
4
- check_cmd = 'openssl x509 -inform pem -subject -fingerprint -issuer -sha256 -dates'
5
- IO.popen(check_cmd, 'w+') do |process|
6
- process.write crt
7
- process.close_write
8
- return process.read
9
- end
10
- end
11
-
12
- def split_certs(input)
13
- inside_cert = false
14
- certs = []
15
- input.each do |line|
16
- case line
17
- when /^-+BEGIN\s+CERTIFICATE-+$/
18
- certs << line
19
- inside_cert = true
20
- next
21
- when /^-+END\s+CERTIFICATE-+$/
22
- certs.last << line
23
- inside_cert = false
24
- next
25
- end
26
- if inside_cert
27
- certs.last << line
28
- end
29
- end
30
- certs
31
- end
32
-
33
- split_certs(ARGF).each do |c|
34
- puts "", cert_info(c)
35
- end