rorvswild 1.12.0 → 1.12.1

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
  SHA256:
3
- metadata.gz: aad78fe6a4f76f5ab203bfdac53ee50784937c831ecd6962ad989b1405da73d6
4
- data.tar.gz: 934a28615a02c898be0900bbc653046e3ee42bc32a9131bc77941d638f1ef468
3
+ metadata.gz: e8690eed7abf4c861e30d1432e834bea38535a091286d43ade2c791419f06f49
4
+ data.tar.gz: fa905a02caeaefdcad3fb18dc9a9a9d76a7a0567a67cf0211673a3ae39787589
5
5
  SHA512:
6
- metadata.gz: 46a96c5adcf10ed9880ab1f4443ee7dedd63f980d6ca99f783194508c2de1c51b6d4ff6f548a257b92a512548f540a6a891e81d6c8ecfc2c138333ba0869492c
7
- data.tar.gz: 9057e7e13be4db2f4a164347336436b332180cc1d588292069e69d7c907f084503df4d7bb29e35e725ae62ab1c69bf3c67d5ac18d28725c32fef572a9f3ae85d
6
+ metadata.gz: 7e5f95230b8d63789c107671a2cdd02d88146c82d64e48478dca1ec3733a1e14380de11a544a091db47a72e96dead24c8d1afa71ef129d5a8aea456cb0be5257
7
+ data.tar.gz: 7e234ae982a55df8688038167468a1ce480ba3c434e65006adc3d2a84bd47b290914a695d425ea0701ff3c9808f2996cb7e5f159fe1c799734472b4f64f6f4d0
@@ -74,13 +74,12 @@ module RorVsWild
74
74
  method_file, method_line = method.source_location
75
75
  method_file = locator.relative_path(File.expand_path(method_file))
76
76
  method.owner.define_method(method.name) do |*args|
77
- section = Section.start
78
- section.file = method_file
79
- section.line = method_line
80
- section.commands << method_full_name
81
- result = send(method_alias, *args)
82
- Section.stop
83
- result
77
+ Section.measure do |section|
78
+ section.file = method_file
79
+ section.line = method_line
80
+ section.commands << method_full_name
81
+ send(method_alias, *args)
82
+ end
84
83
  end
85
84
  end
86
85
 
@@ -13,7 +13,7 @@ module RorVsWild
13
13
  end
14
14
 
15
15
  def self.user
16
- Etc.getlogin
16
+ Etc.getlogin || Etc.getpwuid.name rescue ENV["USER"]
17
17
  end
18
18
 
19
19
  def self.ruby
@@ -19,14 +19,14 @@ module RorVsWild
19
19
  # Wrapped contains the real class name of the ActiveJob wrapper
20
20
  name = item["wrapped".freeze] || item["class".freeze]
21
21
  RorVsWild.agent.measure_job(name, parameters: item["args".freeze]) do
22
- section = RorVsWild::Section.start
23
- section.commands << "#{name}#perform"
24
- if perform_method = worker.method(:perform)
25
- section.file, section.line = worker.method(:perform).source_location
26
- section.file = RorVsWild.agent.locator.relative_path(section.file)
22
+ RorVsWild::Section.measure do |section|
23
+ section.commands << "#{name}#perform"
24
+ if perform_method = worker.method(:perform)
25
+ section.file, section.line = worker.method(:perform).source_location
26
+ section.file = RorVsWild.agent.locator.relative_path(section.file)
27
+ end
28
+ block.call
27
29
  end
28
- block.call
29
- RorVsWild::Section.stop
30
30
  end
31
31
  end
32
32
  end
@@ -12,6 +12,15 @@ module RorVsWild
12
12
  section
13
13
  end
14
14
 
15
+ def self.measure(&block)
16
+ section = start
17
+ begin
18
+ block.call(section)
19
+ ensure
20
+ stop
21
+ end
22
+ end
23
+
15
24
  def self.stop(&block)
16
25
  return if !(sections = stack) || !(section = sections.pop)
17
26
  block.call(section) if block_given?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RorVsWild
4
- VERSION = "1.12.0"
4
+ VERSION = "1.12.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rorvswild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard