scout-essentials 1.6.3 → 1.6.4

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: 8ff597b1b0d5a5a8582e92677aa951559d3ddf2f56cec76bbbfd5f0c90ea180e
4
- data.tar.gz: 298441b06d0c2d048732fa7fb525a51c4ff93a31e39b1882211048f06978c1b9
3
+ metadata.gz: 733fb62cfc8f1119cc35567f30bec3f569856a2c10e7fa4ab8dcb54fb39cf737
4
+ data.tar.gz: abc7a2a0ffa9c524da167c1f2132efb557a6ebd7debe267e014bba1269a31661
5
5
  SHA512:
6
- metadata.gz: 91c63f92b747ea2c39b291430b8a63a7db63bf28465eb66b5d7cceda88f07ceaefef1c7718a589bd5f8f040ff082f9a90232edfa16d4c28a5ba75877ac5a34b9
7
- data.tar.gz: 10d3e562974232b7fe87954a6970cc9008799e341d2bb01e454406d3ceec5386bb27542dcc8b6622a27fd5382d29320561766b1abfd0467eee939d7c82af0a84
6
+ metadata.gz: cdd5c50d28fa8ffac0c5f1660ab5ff8b0e63c3df7d27966cb98c78928161c78270b3bab72732c5eeb5c37a1824fc101fdb2b569567b3af977404f540fb5912de
7
+ data.tar.gz: c4f4e5f5f7b276d20ea65ef22d8447c0499606a3b9c590768517808f6f226c137361b38f1dc56c5e90f2a7652d8519f9cfc591438f939ed2345de2c999f05139
data/.vimproject CHANGED
@@ -34,6 +34,11 @@ scout-essentials=/$PWD filter="*.rb *.txt *.md *.conf *.yaml" {
34
34
  color_class.rb
35
35
  fingerprint.rb
36
36
  progress.rb
37
+ progress=progress{
38
+ report.rb
39
+ util.rb
40
+ }
41
+
37
42
  trap.rb
38
43
  }
39
44
  tmpfile.rb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.3
1
+ 1.6.4
@@ -34,7 +34,11 @@ module Annotation
34
34
  end
35
35
  obj = block if obj.nil?
36
36
  return nil if obj.nil?
37
- obj.extend self unless self === obj
37
+ begin
38
+ obj.extend self unless self === obj
39
+ rescue TypeError
40
+ return obj
41
+ end
38
42
  attrs = self.instance_variable_get("@annotations")
39
43
 
40
44
  return obj if attrs.nil? || attrs.empty?
@@ -34,7 +34,7 @@ module AnnotatedArray
34
34
 
35
35
  def each_with_index(&block)
36
36
  super do |item,i|
37
- block.call annotate_item(item, i)
37
+ block.call annotate_item(item, i), i
38
38
  end
39
39
  end
40
40
 
@@ -70,6 +70,14 @@ module AnnotatedArray
70
70
  end
71
71
  end
72
72
 
73
+ def subset(list)
74
+ self.annotate(self & list)
75
+ end
76
+
77
+ def remove(list)
78
+ self.annotate(self - list)
79
+ end
80
+
73
81
  %w(compact uniq flatten reverse sort_by).each do |method|
74
82
 
75
83
  self.define_method(method) do |*args,&block|
@@ -92,5 +92,12 @@ module IndiferentHash
92
92
  end
93
93
  IndiferentHash.setup(super(*ext_list))
94
94
  end
95
+
96
+ def keys_to_sym!
97
+ string_keys = keys.select{|k| String === k}
98
+ string_keys.each do |key|
99
+ self[key.to_sym] = self.delete(key)
100
+ end
101
+ end
95
102
  end
96
103
 
data/lib/scout/log.rb CHANGED
@@ -252,14 +252,18 @@ module Log
252
252
  end
253
253
 
254
254
  def self.exception(e)
255
- stack = caller
255
+ return if e.message.include?("NOLOG")
256
+ last_caller = last_caller caller
257
+ message = e.message
258
+ message = Log.fingerprint(message) if String === message && message.length > 1000
256
259
  backtrace = e.backtrace || []
260
+ backtrace = [] if message.include?("NOSTACK")
257
261
  if ENV["SCOUT_ORIGINAL_STACK"] == 'true'
258
- error([e.class.to_s, e.message].compact * ": " )
259
- error("BACKTRACE [#{Process.pid}]: " << Log.last_caller(stack) << "\n" + color_stack(backtrace)*"\n")
262
+ error([e.class.to_s, message].compact * ": " )
263
+ error("BACKTRACE [#{Process.pid}]: " << last_caller << "\n" + color_stack(backtrace)*"\n")
260
264
  else
261
- error("BACKTRACE [#{Process.pid}]: " << Log.last_caller(stack) << "\n" + color_stack(backtrace.reverse)*"\n")
262
- error([e.class.to_s, e.message].compact * ": " )
265
+ error("BACKTRACE [#{Process.pid}]: " << last_caller << "\n" + color_stack(backtrace.reverse)*"\n")
266
+ error([e.class.to_s, message].compact * ": " )
263
267
  end
264
268
  end
265
269
 
@@ -355,6 +359,7 @@ def ppp(message)
355
359
  stack = caller
356
360
  puts "#{Log.color :cyan, "PRINT:"} " << stack.first
357
361
  puts ""
362
+ message = message.prety_print if message.respond_to?(:prety_print)
358
363
  if message.length > 200 or message.include? "\n"
359
364
  puts Log.color(:cyan, "=>|") << "\n" << message.to_s
360
365
  else
@@ -72,7 +72,7 @@ module Misc
72
72
  end*""
73
73
  end
74
74
 
75
- def self.format_definition_list_item(dt, dd, indent = nil, size = nil, color = :yellow)
75
+ def self.format_definition_list_item(dt, dd, indent = nil, size = nil, color: :yellow)
76
76
  if size.nil?
77
77
  base_size = MAX_TTY_LINE_WIDTH
78
78
  base_indent = indent || (base_size / 3)
@@ -98,12 +98,12 @@ module Misc
98
98
  text
99
99
  end
100
100
 
101
- def self.format_definition_list(defs, indent = nil, size = nil, color = :yellow, sep = "\n\n")
101
+ def self.format_definition_list(defs, indent = nil, size = nil, color: :yellow, sep: "\n\n")
102
102
  indent ||= 30
103
103
  size ||= (Log.tty_size || MAX_TTY_LINE_WIDTH) - indent
104
104
  entries = []
105
105
  defs.each do |dt,dd|
106
- text = format_definition_list_item(dt,dd,indent, size,color)
106
+ text = format_definition_list_item(dt,dd,indent, size, color: color)
107
107
  entries << text
108
108
  end
109
109
  entries * sep
@@ -158,4 +158,8 @@ module NamedArray
158
158
  return super(name, *args)
159
159
  end
160
160
  end
161
+
162
+ def prety_print
163
+ Misc.format_definition_list(self.to_hash, sep: "\n")
164
+ end
161
165
  end
data/lib/scout/open.rb CHANGED
@@ -68,11 +68,11 @@ module Open
68
68
 
69
69
  options = IndiferentHash.add_defaults options, :noz => false, :mode => 'r'
70
70
 
71
- mode = IndiferentHash.process_options options, :mode
71
+ mode, grep, invert_grep, fixed_grep = IndiferentHash.process_options options, :mode, :grep, :invert_grep, :fixed_grep
72
72
 
73
73
  options[:noz] = true if mode.include? "w"
74
74
 
75
- io = file_open(file, options[:grep], mode, options[:invert_grep], options[:fixed_grep], options)
75
+ io = file_open(file, grep, mode, invert_grep, fixed_grep, options)
76
76
 
77
77
  io = unzip(io) if ((String === file and zip?(file)) and not options[:noz]) or options[:zip]
78
78
  io = gunzip(io) if ((String === file and gzip?(file)) and not options[:noz]) or options[:gzip]
@@ -34,6 +34,7 @@ module Resource
34
34
  rake_dir = rake_dir.find(:user) if rake_dir.respond_to? :find
35
35
 
36
36
  begin
37
+ Thread.current["resource"] = self
37
38
  if Proc === rakefile
38
39
  ScoutRake.run(nil, rake_dir, task, &rakefile)
39
40
  else
data/lib/scout/tmpfile.rb CHANGED
@@ -31,6 +31,7 @@ module TmpFile
31
31
  # Creates a random filename in the temporary directory
32
32
  def self.tmp_file(prefix = 'tmp-', max = 1_000_000_000, dir = nil)
33
33
  dir ||= TmpFile.tmpdir
34
+ dir = dir.find if Path === dir
34
35
  File.expand_path(File.join(dir, random_name(prefix, max)))
35
36
  end
36
37
 
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: scout-essentials 1.6.3 ruby lib
5
+ # stub: scout-essentials 1.6.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "scout-essentials".freeze
9
- s.version = "1.6.3".freeze
9
+ s.version = "1.6.4".freeze
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Miguel Vazquez".freeze]
14
- s.date = "2024-10-04"
14
+ s.date = "2024-12-10"
15
15
  s.description = "Things a scout can use anywhere".freeze
16
16
  s.email = "mikisvaz@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -138,7 +138,7 @@ Gem::Specification.new do |s|
138
138
  ]
139
139
  s.homepage = "http://github.com/mikisvaz/scout-essentials".freeze
140
140
  s.licenses = ["MIT".freeze]
141
- s.rubygems_version = "3.5.10".freeze
141
+ s.rubygems_version = "3.5.23".freeze
142
142
  s.summary = "Scout essential tools".freeze
143
143
 
144
144
  s.specification_version = 4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-essentials
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-04 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []
254
- rubygems_version: 3.5.10
254
+ rubygems_version: 3.5.23
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: Scout essential tools