lumitrace 0.4.1 → 0.4.2

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: 6f9613f9bc59b3d2a7c6db68d99848cd710558e4ca439f4fb53203664cfeeb6f
4
- data.tar.gz: e0f9883071d78aa4f58464a00a41548d16acc7b54ad7370734b069e50ad3e1b8
3
+ metadata.gz: d58e330a4db4410a5ab30043d6f222d3a1281e06b1b9bf9b499b663d85e9e502
4
+ data.tar.gz: 7d12352c93ec9cba4dba03df61bc6dd618632902e7930867262cdb428393876c
5
5
  SHA512:
6
- metadata.gz: 43205f665f9ba2a569fb4557f8c404498c314fe9e8bf6af542903a2522e101d786b6088437337131d10b2a7185b26ca528da3bab051f7006ce295ef3accbf920
7
- data.tar.gz: '08241616a2b0c65463290e4f523ff0050d473eb8516d1c3aae5bd2a5602933d27e137786a99abe5c7b4405208127300daf61122d0dcdbc9547c65da4ec0b48dc'
6
+ metadata.gz: 336673fd02c877740c3970354dfde67b7c149ecd812cb897159c097dda9e90346f0f35f0dd1bbd149a8805d75043518f82d8e687929be1c63d85bd33cb614b4c
7
+ data.tar.gz: ac97e8d31ef4fbc053b306f1f4d95b0467e7e2ce58e95e443ad81a0aa4258ff4007851ff81aff42a56350b509a741ce4dba5d01697107907a38bb59127cd731f
data/docs/ai-help.md CHANGED
@@ -23,7 +23,7 @@
23
23
  - `lumitrace [options] script.rb [ruby_opt]`
24
24
  - Run a Ruby script with Lumitrace enabled.
25
25
  - `lumitrace [options] exec CMD [args...]`
26
- - Run an arbitrary command with Lumitrace env injected.
26
+ - Use this for command-style entrypoints (e.g. rails/rspec via binstubs or bundle exec).
27
27
  - `lumitrace help [--format text|json]`
28
28
  - Show AI/human help.
29
29
  - `lumitrace schema [--format text|json]`
@@ -46,5 +46,6 @@
46
46
  ## Examples
47
47
  - `lumitrace --collect-mode history --max-samples 5 -j app.rb`
48
48
  - `lumitrace --collect-mode types -h -j app.rb`
49
+ - `lumitrace --collect-mode last -j exec bin/rails test`
49
50
  - `lumitrace help --format json`
50
51
  - `lumitrace schema --format json`
data/lib/lumitrace/env.rb CHANGED
@@ -35,10 +35,12 @@ module Lumitrace
35
35
 
36
36
  json = json_env.nil? ? false : (json_env != false ? (json_env == true ? true : json_env) : false)
37
37
 
38
- if text_env.nil?
39
- text = !(html || json)
38
+ text = if text_env.nil?
39
+ !(html || json)
40
+ elsif text_env == false
41
+ false
40
42
  else
41
- text = (text_env != false)
43
+ text_env
42
44
  end
43
45
 
44
46
  verbose = parse_env_int(ENV["LUMITRACE_VERBOSE"])
@@ -32,7 +32,7 @@ module Lumitrace
32
32
  },
33
33
  {
34
34
  command: "lumitrace [options] exec CMD [args...]",
35
- description: "Run an arbitrary command with Lumitrace env injected."
35
+ description: "Use this for command-style entrypoints (e.g. rails/rspec via binstubs or bundle exec)."
36
36
  },
37
37
  {
38
38
  command: "lumitrace help [--format text|json]",
@@ -70,6 +70,7 @@ module Lumitrace
70
70
  examples: [
71
71
  "lumitrace --collect-mode history --max-samples 5 -j app.rb",
72
72
  "lumitrace --collect-mode types -h -j app.rb",
73
+ "lumitrace --collect-mode last -j exec bin/rails test",
73
74
  "lumitrace help --format json",
74
75
  "lumitrace schema --format json"
75
76
  ]
@@ -47,7 +47,7 @@ module RecordInstrument
47
47
  Prism::GlobalVariableReadNode
48
48
  ].freeze
49
49
 
50
- def self.instrument_source(src, ranges, file_label: nil, record_method: "Lumitrace::R")
50
+ def self.instrument_source(src, ranges, file_label: nil, record_method: "::Lumitrace::R")
51
51
  file_label ||= "(unknown)"
52
52
  ranges = normalize_ranges(ranges)
53
53
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lumitrace
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
data/lib/lumitrace.rb CHANGED
@@ -472,6 +472,7 @@ module Lumitrace
472
472
  json_path = File.expand_path(json_path, @atexit_output_root)
473
473
  RecordInstrument.dump_events_json(events, json_path)
474
474
  verbose_log("json: #{json_path}")
475
+ notify_output_path("json", json_path)
475
476
  end
476
477
  if @atexit_text
477
478
  tty = @atexit_text == true ? $stdout.tty? : false
@@ -488,6 +489,7 @@ module Lumitrace
488
489
  text_path = File.expand_path(@atexit_text, @atexit_output_root)
489
490
  File.write(text_path, text)
490
491
  verbose_log("text: #{text_path}")
492
+ notify_output_path("text", text_path)
491
493
  end
492
494
  end
493
495
  if @atexit_html
@@ -502,6 +504,7 @@ module Lumitrace
502
504
  out_path = File.expand_path(out_path, @atexit_output_root)
503
505
  File.write(out_path, html)
504
506
  verbose_log("html: #{out_path}")
507
+ notify_output_path("html", out_path)
505
508
  end
506
509
  if results_parent? && @results_dir && Dir.exist?(@results_dir)
507
510
  begin
@@ -523,6 +526,11 @@ module Lumitrace
523
526
  RecordRequire.disable
524
527
  end
525
528
 
529
+ def self.notify_output_path(kind, path)
530
+ return if @verbose_level.to_i > 0
531
+ warn "lumitrace #{kind}: #{path}"
532
+ end
533
+
526
534
  end
527
535
 
528
536
  enable_env = Lumitrace.parse_env_flag(ENV["LUMITRACE_ENABLE"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumitrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Sasada