tengine_support 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWY1YmU0OTk0MDY4ZWZkMWE1ZmQ1NWYzMDZiZDJjMTllOWY3ODRjNA==
5
+ data.tar.gz: !binary |-
6
+ MGU1ODRjYjkxNTcyZWY1Nzg5YzNjMGRmMjllMGQ0ZTFmZGU2MzZkMw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MGJiNDQ1ZWM5ZTNiZjhjNTBhMzU5ZjQyNDYxNThkZmIxZmFiNWM4NDMzY2Ix
10
+ NmZhZjZkMDdiZTQzZjQ0MzY5ZjZlYTY0YjFhNDg1OGZlOWQxZjhjNzNjZDNh
11
+ NDRmNDBhZTA2ODBhODZhOWRhNDFiMzI5OTU3YTY3YmY4YjQwNzc=
12
+ data.tar.gz: !binary |-
13
+ NDM3MjA1NTcwNDVhMTFjMzJmODc2YjcxNThlMjQzYTM2YjQ2ODgzMGE5NmFj
14
+ YzUzODY2NjU1NzE2MTVkZmE3NGYyZDUyYmI0MWJmOWZmYmJlMWYxZjZiYWE4
15
+ ZDQzMTNjMWIxYWU4MGIzZTY2NWYyZjNhOGI0MTIxNzlkMzI4YjY=
data/Gemfile CHANGED
@@ -4,5 +4,5 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem "eventmachine", "~> 0.12.0"
7
- gem "mongoid", "~> 3.0.0"
7
+ gem "mongoid", "~> 3.1.3"
8
8
  end
@@ -0,0 +1,2 @@
1
+ module Enumerable
2
+ end
@@ -1,5 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ require 'active_support'
4
+
3
5
  # activesupport-3.1.0以上では
4
6
  # active_support/core_ext/hash/deep_dupでHash#deep_dupを定義していますが、
5
7
  # 対象がHashだけなのでArrayをコピーできません。
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'tengine/support'
3
+
4
+ class Tengine::Support::NamedLogger < Logger
5
+ attr_reader :name
6
+ def initialize(name, *args, &block)
7
+ super(*args, &block)
8
+ @name = name
9
+ @mutex = Mutex.new
10
+ @thread_nums ||= {}
11
+ thread_num(Thread.main.object_id) # => 0 のはず
12
+ self.formatter = method(:format_with_color)
13
+ end
14
+
15
+ def thread_num(tid = Thread.current.object_id)
16
+ result = @thread_nums[tid]
17
+ return result if result
18
+ @mutex.synchronize do
19
+ num = @thread_nums[tid] = (@thread_nums.length)
20
+ return num
21
+ end
22
+ end
23
+
24
+ LOG_FORMAT = "\e[%dm[%s #%5d %s %3d] %5s %s\n\e[0m".freeze
25
+
26
+ WHITE = 37
27
+
28
+ def format_with_color(severity, datetime, progname, message)
29
+ tn = thread_num
30
+ # http://d.hatena.ne.jp/keyesberry/20101107/p1
31
+ color_no = (tn == 0) ? WHITE : WHITE - 1 - ((tn - 1) % 6) # メインスレッドを白、それ以外を色付きに
32
+ LOG_FORMAT % [color_no, datetime.iso8601(6), Process.pid, @name, tn, severity, message]
33
+ end
34
+ end
@@ -1,8 +1,9 @@
1
1
  require 'tengine_support'
2
2
 
3
3
  module Tengine::Support
4
- autoload :YamlWithErb, 'tengine/support/yaml_with_erb'
5
- autoload :NullLogger, 'tengine/support/null_logger'
6
- autoload :Config, 'tengine/support/config'
7
- autoload :Mongoid, 'tengine/support/mongoid'
4
+ autoload :YamlWithErb , 'tengine/support/yaml_with_erb'
5
+ autoload :NullLogger , 'tengine/support/null_logger'
6
+ autoload :Config , 'tengine/support/config'
7
+ autoload :Mongoid , 'tengine/support/mongoid'
8
+ autoload :NamedLogger , 'tengine/support/named_logger'
8
9
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tengine_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - shyouhei
@@ -11,12 +10,11 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2012-12-19 00:00:00.000000000 Z
13
+ date: 2013-04-30 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: activesupport
18
17
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
19
  - - ! '>='
22
20
  - !ruby/object:Gem::Version
@@ -24,7 +22,6 @@ dependencies:
24
22
  type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
25
  requirements:
29
26
  - - ! '>='
30
27
  - !ruby/object:Gem::Version
@@ -32,7 +29,6 @@ dependencies:
32
29
  - !ruby/object:Gem::Dependency
33
30
  name: bundler
34
31
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
32
  requirements:
37
33
  - - ! '>='
38
34
  - !ruby/object:Gem::Version
@@ -40,7 +36,6 @@ dependencies:
40
36
  type: :development
41
37
  prerelease: false
42
38
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
39
  requirements:
45
40
  - - ! '>='
46
41
  - !ruby/object:Gem::Version
@@ -48,23 +43,20 @@ dependencies:
48
43
  - !ruby/object:Gem::Dependency
49
44
  name: rake
50
45
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
46
  requirements:
53
- - - ~>
47
+ - - ! '>='
54
48
  - !ruby/object:Gem::Version
55
- version: 0.9.2.2
49
+ version: '0'
56
50
  type: :development
57
51
  prerelease: false
58
52
  version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
53
  requirements:
61
- - - ~>
54
+ - - ! '>='
62
55
  - !ruby/object:Gem::Version
63
- version: 0.9.2.2
56
+ version: '0'
64
57
  - !ruby/object:Gem::Dependency
65
58
  name: rspec
66
59
  requirement: !ruby/object:Gem::Requirement
67
- none: false
68
60
  requirements:
69
61
  - - ~>
70
62
  - !ruby/object:Gem::Version
@@ -72,7 +64,6 @@ dependencies:
72
64
  type: :development
73
65
  prerelease: false
74
66
  version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
67
  requirements:
77
68
  - - ~>
78
69
  - !ruby/object:Gem::Version
@@ -80,39 +71,34 @@ dependencies:
80
71
  - !ruby/object:Gem::Dependency
81
72
  name: yard
82
73
  requirement: !ruby/object:Gem::Requirement
83
- none: false
84
74
  requirements:
85
- - - ~>
75
+ - - ! '>='
86
76
  - !ruby/object:Gem::Version
87
- version: 0.8.1
77
+ version: '0'
88
78
  type: :development
89
79
  prerelease: false
90
80
  version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
81
  requirements:
93
- - - ~>
82
+ - - ! '>='
94
83
  - !ruby/object:Gem::Version
95
- version: 0.8.1
84
+ version: '0'
96
85
  - !ruby/object:Gem::Dependency
97
86
  name: simplecov
98
87
  requirement: !ruby/object:Gem::Requirement
99
- none: false
100
88
  requirements:
101
- - - ~>
89
+ - - ! '>='
102
90
  - !ruby/object:Gem::Version
103
- version: 0.6.4
91
+ version: '0'
104
92
  type: :development
105
93
  prerelease: false
106
94
  version_requirements: !ruby/object:Gem::Requirement
107
- none: false
108
95
  requirements:
109
- - - ~>
96
+ - - ! '>='
110
97
  - !ruby/object:Gem::Version
111
- version: 0.6.4
98
+ version: '0'
112
99
  - !ruby/object:Gem::Dependency
113
100
  name: autotest
114
101
  requirement: !ruby/object:Gem::Requirement
115
- none: false
116
102
  requirements:
117
103
  - - ! '>='
118
104
  - !ruby/object:Gem::Version
@@ -120,15 +106,13 @@ dependencies:
120
106
  type: :development
121
107
  prerelease: false
122
108
  version_requirements: !ruby/object:Gem::Requirement
123
- none: false
124
109
  requirements:
125
110
  - - ! '>='
126
111
  - !ruby/object:Gem::Version
127
112
  version: '0'
128
113
  - !ruby/object:Gem::Dependency
129
- name: rdiscount
114
+ name: pry
130
115
  requirement: !ruby/object:Gem::Requirement
131
- none: false
132
116
  requirements:
133
117
  - - ! '>='
134
118
  - !ruby/object:Gem::Version
@@ -136,11 +120,52 @@ dependencies:
136
120
  type: :development
137
121
  prerelease: false
138
122
  version_requirements: !ruby/object:Gem::Requirement
139
- none: false
140
123
  requirements:
141
124
  - - ! '>='
142
125
  - !ruby/object:Gem::Version
143
126
  version: '0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: pry-doc
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ - !ruby/object:Gem::Dependency
142
+ name: pry-debugger
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ - !ruby/object:Gem::Dependency
156
+ name: ZenTest
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ~>
160
+ - !ruby/object:Gem::Version
161
+ version: 4.9.0
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ~>
167
+ - !ruby/object:Gem::Version
168
+ version: 4.9.0
144
169
  description: tengine_support provides utility classes/modules which is not included
145
170
  in active_support. It doesn't depend on other tengine gems.
146
171
  email: tengine-info@groovenauts.jp
@@ -166,6 +191,7 @@ files:
166
191
  - lib/tengine/support/core_ext/enumerable/deep_freeze.rb
167
192
  - lib/tengine/support/core_ext/enumerable/each_next_tick.rb
168
193
  - lib/tengine/support/core_ext/enumerable/map_to_hash.rb
194
+ - lib/tengine/support/core_ext/enumerable/map_to_hash.rb~
169
195
  - lib/tengine/support/core_ext/enumerable.rb
170
196
  - lib/tengine/support/core_ext/hash/compact.rb
171
197
  - lib/tengine/support/core_ext/hash/deep_dup.rb
@@ -175,6 +201,7 @@ files:
175
201
  - lib/tengine/support/core_ext/module.rb
176
202
  - lib/tengine/support/core_ext.rb
177
203
  - lib/tengine/support/mongoid.rb
204
+ - lib/tengine/support/named_logger.rb
178
205
  - lib/tengine/support/null_logger.rb
179
206
  - lib/tengine/support/yaml_with_erb.rb
180
207
  - lib/tengine/support.rb
@@ -182,30 +209,26 @@ files:
182
209
  homepage: https://github.com/tengine/tengine/tree/develop/tengine_support
183
210
  licenses:
184
211
  - MPL/LGPL
212
+ metadata: {}
185
213
  post_install_message:
186
214
  rdoc_options: []
187
215
  require_paths:
188
216
  - lib
189
217
  required_ruby_version: !ruby/object:Gem::Requirement
190
- none: false
191
218
  requirements:
192
219
  - - ! '>='
193
220
  - !ruby/object:Gem::Version
194
221
  version: '0'
195
- segments:
196
- - 0
197
- hash: 3178106423311432390
198
222
  required_rubygems_version: !ruby/object:Gem::Requirement
199
- none: false
200
223
  requirements:
201
224
  - - ! '>='
202
225
  - !ruby/object:Gem::Version
203
226
  version: '0'
204
227
  requirements: []
205
228
  rubyforge_project:
206
- rubygems_version: 1.8.23
229
+ rubygems_version: 2.0.3
207
230
  signing_key:
208
- specification_version: 3
231
+ specification_version: 4
209
232
  summary: tengine_support provides utility classes/modules which isn't included in
210
233
  active_support.
211
234
  test_files: []