lioooo_utils 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lioooo_log.rb +16 -1
- data/lib/utils.rb +1 -0
- metadata +3 -3
data/lib/lioooo_log.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#encoding: utf-8
|
2
2
|
require 'colored'
|
3
3
|
require 'logging'
|
4
|
+
require 'benchmark'
|
4
5
|
LogRoot = File.expand_path("../../log", __FILE__)
|
5
6
|
class LiooooUtilsLogger
|
6
7
|
attr_accessor :logger, :log_dir
|
@@ -69,10 +70,24 @@ class LiooooUtilsLogger
|
|
69
70
|
system "source ~/.bash_profile && #{cmd}"
|
70
71
|
end
|
71
72
|
|
73
|
+
# print block exec time
|
74
|
+
def real_time &block
|
75
|
+
if block_given?
|
76
|
+
elapsed = Benchmark.realtime do
|
77
|
+
yield
|
78
|
+
end
|
79
|
+
warn "执行完毕: #{(elapsed).round(2)} 毫秒!"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
72
84
|
end
|
73
85
|
|
74
86
|
# need init when use it
|
75
|
-
#LiooooLogger = LiooooUtilsLogger.new :lioooo
|
87
|
+
#LiooooLogger = LiooooUtilsLogger.new :lioooo, "/tmp"
|
88
|
+
#LiooooLogger.ba do |ele|
|
89
|
+
# sleep 3
|
90
|
+
#end
|
76
91
|
|
77
92
|
|
78
93
|
|
data/lib/utils.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lioooo_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
12
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colored
|
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
segments:
|
174
174
|
- 0
|
175
|
-
hash:
|
175
|
+
hash: -1136961478188097229
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
177
|
none: false
|
178
178
|
requirements:
|