utils 0.31.0 → 0.32.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: 179415991e7136ab50780748a49823c11905022e23abf3b93ab1fff0f131895a
4
- data.tar.gz: efed6c516054a75c03bd6dabacc03ed5272ea652f394320d72d00e6afb70abfc
3
+ metadata.gz: 6d17880a737efe4faa70793a2494ff4eb36f9d937bc7980a53c50146f06d5b0c
4
+ data.tar.gz: 69f0c24ad275b489b6aa9bd20280261f8ed0de54f49517b192a73cf7f8d87e4f
5
5
  SHA512:
6
- metadata.gz: c331a48cb93f205e4ae4ad4223a667dd8c674085e05bb90258bdcc0ff4594ae9de2b9a875b3c0fbb9e8d0a69fab1a36e6da1623aae73ea099ed74c99526b0c94
7
- data.tar.gz: 51abb2ed1e3d8f1eff078f43acb55dc447964573800fbaa85306458338945b5dfbe6c9bed440db968835e1f473bd1774490eb90f375f984212d012b9922a7f90
6
+ metadata.gz: 18ce35eb3ad249b5d214e6573e76824c91037c3929702ef9363737248aef6f45b0674939bf00dadcfeb6ee0b747614decc617b049d92504e584c2d44293d4942
7
+ data.tar.gz: aaaa14b75fd266bc0b7296019549df949363094559968fcfe6a0416aa6e8c08cfb0db60685ae7fbcbb1141d24d7008a8aaf01aebbf26c0be12ef8160328758cf
data/bin/check-yaml CHANGED
@@ -12,7 +12,7 @@ format = -> s {
12
12
 
13
13
  if filename = ARGV.first
14
14
  begin
15
- yaml = YAML.load_file(filename).to_yaml
15
+ yaml = YAML.unsafe_load_file(filename).to_yaml
16
16
  ENV['DEBUG'].to_i == 1 and puts yaml
17
17
  puts 'ok'
18
18
  rescue => e
@@ -23,7 +23,7 @@ if filename = ARGV.first
23
23
  else
24
24
  string = STDIN.read
25
25
  begin
26
- yaml = YAML.load(string).to_yaml
26
+ yaml = YAML.unsafe_load(string).to_yaml
27
27
  ENV['DEBUG'].to_i == 1 and puts yaml
28
28
  puts 'ok'
29
29
  rescue => e
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
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.31.0'
3
+ VERSION = '0.32.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,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.31.0 ruby lib
2
+ # stub: utils 0.32.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils".freeze
6
- s.version = "0.31.0"
6
+ s.version = "0.32.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-07-15"
11
+ s.date = "2022-11-04"
12
12
  s.description = "This ruby gem provides some useful command line utilities".freeze
13
13
  s.email = "flori@ping.de".freeze
14
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]
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
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.22".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.0
4
+ version: 0.32.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-07-15 00:00:00.000000000 Z
11
+ date: 2022-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -252,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  - !ruby/object:Gem::Version
253
253
  version: '0'
254
254
  requirements: []
255
- rubygems_version: 3.2.33
255
+ rubygems_version: 3.3.22
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Some useful command line utilities