log_require 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/log_require.rb +9 -3
- data/lib/log_require/flat.rb +4 -2
- data/log_require.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e13b00bb0405782eb8792068c9cc5cda57133477
|
4
|
+
data.tar.gz: 2517b3fcf790a86a599fe62067f2016f35c314b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71330135eae405dd1b40315323530a70d0e54d5657b2364e332493c2fe2a8af57ee93b8c81118fd95a5cbe1061eac54fe17a4b1bad54f7c94440e7485940b6ed
|
7
|
+
data.tar.gz: f50e5aaa0e3f1a8c8dfe28246ec72c94a270e15d6d9104baf35e263e532173c948ff1e41bbb02462256a2227e7e33bcdae881be981cf99ba29c9217895fb8d92
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/log_require.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
|
2
|
-
require "log_require/flat"
|
3
|
-
require "log_require/graph"
|
4
2
|
require "log_require/node"
|
5
3
|
|
6
4
|
module LogRequire
|
@@ -13,6 +11,14 @@ module LogRequire
|
|
13
11
|
!ENV["LOG_REQUIRE"].nil?
|
14
12
|
end
|
15
13
|
|
14
|
+
if graph?
|
15
|
+
require "log_require/graph"
|
16
|
+
else
|
17
|
+
require "log_require/flat"
|
18
|
+
end
|
19
|
+
|
20
|
+
EPOCH = Time.new.to_f
|
21
|
+
|
16
22
|
def self.setup
|
17
23
|
io = if file? then
|
18
24
|
File.open(ENV["LOG_REQUIRE"], 'w')
|
@@ -33,7 +39,7 @@ module LogRequire
|
|
33
39
|
else
|
34
40
|
$log_require = io
|
35
41
|
if file? then
|
36
|
-
io.puts "require name,caller,line number"
|
42
|
+
io.puts "elapsed time,require name,caller,line number"
|
37
43
|
end
|
38
44
|
Kernel.include(LogRequire::Flat)
|
39
45
|
end
|
data/lib/log_require/flat.rb
CHANGED
@@ -7,14 +7,16 @@ module LogRequire
|
|
7
7
|
# cleanup the caller name (only interested in path relative to gem or lib)
|
8
8
|
c, l = LogRequire.clean_caller(caller.first)
|
9
9
|
|
10
|
+
elapsed = sprintf("%7.4f", Time.new.to_f - LogRequire::EPOCH)
|
11
|
+
|
10
12
|
if LogRequire.file? then
|
11
|
-
$log_require.puts "#{name},#{c},#{l}"
|
13
|
+
$log_require.puts "#{elapsed},#{name},#{c},#{l}"
|
12
14
|
|
13
15
|
else
|
14
16
|
pad = 110-name.length
|
15
17
|
pad = pad > 0 ? pad : 1
|
16
18
|
pad = (" " * pad)
|
17
|
-
STDERR.puts "require: #{name}#{pad}>> #{c}:#{l}"
|
19
|
+
STDERR.puts "#{elapsed} require: #{name}#{pad}>> #{c}:#{l}"
|
18
20
|
end
|
19
21
|
|
20
22
|
return require_without_log(name)
|
data/log_require.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: log_require 0.1.
|
5
|
+
# stub: log_require 0.1.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "log_require"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Chetan Sarva"]
|
14
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-11-22"
|
15
15
|
s.description = "Small utility to help track down that stray library"
|
16
16
|
s.email = "chetan@pixelcop.net"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_require
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chetan Sarva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|