Class: Bundler::Timing::Tracker
- Inherits:
-
Object
- Object
- Bundler::Timing::Tracker
- Defined in:
- lib/bundler/timing/tracker.rb
Instance Method Summary collapse
- #finish_fetch(spec) ⇒ Object
- #finish_git_fetch(source) ⇒ Object
- #finish_install(spec_install) ⇒ Object
-
#initialize(ui: nil) ⇒ Tracker
constructor
A new instance of Tracker.
- #start_fetch(spec) ⇒ Object
- #start_git_fetch(source) ⇒ Object
- #start_install(spec_install) ⇒ Object
Constructor Details
#initialize(ui: nil) ⇒ Tracker
Returns a new instance of Tracker.
8 9 10 11 12 |
# File 'lib/bundler/timing/tracker.rb', line 8 def initialize(ui: nil) @ui = ui @mutex = Mutex.new @starts = {} end |
Instance Method Details
#finish_fetch(spec) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/bundler/timing/tracker.rb', line 18 def finish_fetch(spec) elapsed = pop(fetch_key(spec)) return unless elapsed ui.confirm(format("Downloaded %s in: %.3fs", spec.name, elapsed)) @mutex.synchronize { @starts[install_key(spec)] = now } end |
#finish_git_fetch(source) ⇒ Object
39 40 41 42 43 |
# File 'lib/bundler/timing/tracker.rb', line 39 def finish_git_fetch(source) elapsed = pop(git_key(source)) return unless elapsed ui.confirm(format("Fetched %s in: %.3fs", git_label(source), elapsed)) end |
#finish_install(spec_install) ⇒ Object
29 30 31 32 33 |
# File 'lib/bundler/timing/tracker.rb', line 29 def finish_install(spec_install) elapsed = pop(install_key(spec_install)) return unless elapsed ui.confirm(format("Installed %s in: %.3fs", spec_install.name, elapsed)) end |
#start_fetch(spec) ⇒ Object
14 15 16 |
# File 'lib/bundler/timing/tracker.rb', line 14 def start_fetch(spec) record(fetch_key(spec)) end |
#start_git_fetch(source) ⇒ Object
35 36 37 |
# File 'lib/bundler/timing/tracker.rb', line 35 def start_git_fetch(source) record(git_key(source)) end |
#start_install(spec_install) ⇒ Object
25 26 27 |
# File 'lib/bundler/timing/tracker.rb', line 25 def start_install(spec_install) @mutex.synchronize { @starts[install_key(spec_install)] ||= now } end |