Module: WhoLoadedMe
- Defined in:
- lib/who_loaded_me.rb
Class Method Summary collapse
-
.track!(gem_name, track_file: nil) ⇒ Object
Keeps track of the apps who loaded the specific gem with timestamp, and pwd #params gem_name: name of gem that wants to be tracked track_file: name of file where tracks are kept.
Class Method Details
.track!(gem_name, track_file: nil) ⇒ Object
Keeps track of the apps who loaded the specific gem with timestamp, and pwd #params
gem_name: name of gem that wants to be tracked
track_file: name of file where tracks are kept
11 12 13 14 15 16 17 |
# File 'lib/who_loaded_me.rb', line 11 def track!(gem_name, track_file: nil) track_file ||= '/tmp/who_loaded_me.txt' File.open(track_file, 'a') do |f| f.puts("[%s]: [%s], App: [%s]: PWD: [%s]]" % [Time.now, gem_name, $0, ENV['PWD']]) File.chmod(0777, track_file) rescue nil end end |