omf_common 6.1.3.pre.2 → 6.1.3

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
+ ZDUxYzc4NjE0ZTNlMzQwZDI2YWY3YWZlZmJmMDg0YjljMWY2ZmE2Mg==
5
+ data.tar.gz: !binary |-
6
+ NWU2MTQ0NmZkM2RhOTllOTJiYTAxODg3MTdlNTEzY2JmM2E1YTg3ZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDMzNDVlODI4OWRmYTA3YWFkMzc0MTgzYzdiMzQxZDI3ZTliMTEwODZhMWI4
10
+ YWNiNDMyMzAwOWEyYjY5NjczYmI5OWYzNjY2Mzg0MWNjYzcwYTg5OGFlODYx
11
+ MDNmNmFmYzllMTMxODk4YzcyZjZmNGIxNjdmNjg5ZDIyMjAwY2M=
12
+ data.tar.gz: !binary |-
13
+ ODQ5ZGEzOWY5ODBlYTczMDAxMzI4ZjRiODZiNTk3MzUzZjEyMmI2OWY3Njdl
14
+ ZTU4ZDMwZTliZTI3MTVjZmQ0YmY4NmFiNzA5MTc5YTE5MmRkZDc4ZWI4ZTVi
15
+ ZGY2M2VlZGZhOTFlNjgyNjQyMTBlZDg1YmJhNzhmMTMyNjRkYTU=
data/Gemfile CHANGED
@@ -6,7 +6,3 @@ gemspec
6
6
  group :test do
7
7
  gem 'rake'
8
8
  end
9
-
10
- group :xmpp do
11
- gem 'blather'
12
- end
data/lib/omf_common.rb CHANGED
@@ -17,8 +17,6 @@ require 'omf_common/auth'
17
17
  require 'omf_common/core_ext/string'
18
18
  require 'omf_common/eventloop'
19
19
 
20
- require 'oml4r/logging/oml4r_appender'
21
-
22
20
  include OmfCommon::DefaultLogging
23
21
 
24
22
  # Set the default encoding to UTF8
@@ -134,54 +132,15 @@ module OmfCommon
134
132
  }
135
133
  }
136
134
 
137
- # Initialise the OMF runtime.
138
- #
139
- # The options here can be customised via EC or RC's configuration files.
140
- #
141
- # Given the following example EC configuration file (YAML format):
142
- #
143
- # environment: development
144
- # communication:
145
- # url: amqp://localhost
146
- #
147
- # OMF runtime will be configured as:
148
- #
149
- # OmfCommon.init(:development, { communication: { url: "amqp://localhost" }})
150
- #
151
135
  #
152
- # @example Use AMQP for communication in :development mode
136
+ # Initialize the OMF runtime.
137
+ # Options are:
138
+ # :communication
139
+ # :type
140
+ # ... specific opts
141
+ # :eventloop
142
+ # :type {:em|:local...}
153
143
  #
154
- # OmfCommon.init(:development, { communication: { url: "amqp://localhost" }})
155
- #
156
- # @example Change Logging configuration
157
- #
158
- # options = {
159
- # communication: { url: "amqp://localhost" },
160
- # logging: {
161
- # level: { default: 'debug' },
162
- # appenders: {
163
- # stdout: {
164
- # level: :info,
165
- # date_pattern: '%H:%M:%S',
166
- # pattern: '%d %5l %c{2}: %m\n'
167
- # },
168
- # rolling_file: {
169
- # level: :debug,
170
- # log_dir: '/var/tmp',
171
- # size: 1024*1024*50, # max 50mb of each log file
172
- # keep: 5, # keep a 5 logs in total
173
- # date_pattern: '%F %T %z',
174
- # pattern: '[%d] %-5l %c: %m\n'
175
- # },
176
- # }
177
- # }
178
- # }
179
- #
180
- # OmfCommon.init(:development, options)
181
- #
182
- # @see _init_logging
183
- #
184
- # @param [Symbol] op_mode
185
144
  # @param [Hash] opts
186
145
  #
187
146
  def self.init(op_mode, opts = {}, &block)
@@ -286,52 +245,34 @@ module OmfCommon
286
245
  yh
287
246
  end
288
247
 
289
- # DO NOT CALL THIS METHOD DIRECTLY
290
- #
291
- # By providing logging section via init method, you could custom how logging messages could be written.
248
+ # DO NOT CALL DIRECTLY
292
249
  #
293
- # @example Change default logging level to :default, but :info under OmfEc namespace
294
- #
295
- # {
296
- # logging: {
297
- # level: { default: 'debug', 'OmfEc' => 'info' }
298
- # }
299
- # }
300
- #
301
- # @example Write logging message to STDOUT, OML, and ROLLING_FILE
302
- # {
303
- # logging: {
304
- # level: { default: 'debug' }, # root logger set to level :debug
305
- # appenders: {
306
- # stdout: {
307
- # level: :info,
308
- # date_pattern: '%H:%M:%S', # show hours, mintues, seconds
309
- # pattern: '%d %5l %c{2}: %m\n' # show date time, logging level, namespace/class
310
- # },
311
- # rolling_file: {
312
- # level: :debug,
313
- # log_dir: '/var/tmp', # files go to /var/tmp
314
- # log_file: 'bob', # name of file
315
- # size: 1024*1024*50, # max 50mb of each log file
316
- # keep: 5, # keep a 5 logs in total
317
- # date_pattern: '%F %T %z', # shows date, time, timezone
318
- # pattern: '[%d] %-5l %c: %m\n'
319
- # },
320
- # oml4r: {
321
- # appName: 'bob', # OML appName
322
- # domain: 'bob_2345', # OML domain (database name)
323
- # collect: 'tcp:localhost:3003' # OML server
324
- # }
325
- # }
326
- # }
327
- # }
328
- #
329
- # @note OmfCommon now ONLY provides support for STDOUT, OML, FILE, and ROLLING_FILE.
330
- #
331
- # @param [Hash] opts
332
250
  def self._init_logging(opts = {})
333
251
  logger = Logging.logger.root
252
+ if appenders = opts[:appenders]
253
+ logger.clear_appenders
254
+ appenders.each do |type, topts|
255
+ case type.to_sym
256
+ when :stdout
257
+ $stdout.sync = true
258
+ logger.add_appenders(
259
+ Logging.appenders.stdout('custom',
260
+ :layout => Logging.layouts.pattern(topts)
261
+ ))
334
262
 
263
+ when :file
264
+ dir_name = topts.delete(:log_dir) || DEF_LOG_DIR
265
+ file_name = topts.delete(:log_file) || "#{File.basename($0, File.extname($0))}.log"
266
+ path = File.join(dir_name, file_name)
267
+ logger.add_appenders(
268
+ Logging.appenders.file(path,
269
+ :layout => Logging.layouts.pattern(topts)
270
+ ))
271
+ else
272
+ raise "Unknown logging appender type '#{type}'"
273
+ end
274
+ end
275
+ end
335
276
  if level = opts[:level]
336
277
  if level.is_a? Hash
337
278
  # package level settings
@@ -346,39 +287,6 @@ module OmfCommon
346
287
  logger.level = level.to_sym
347
288
  end
348
289
  end
349
-
350
- if appenders = opts[:appenders]
351
- logger.clear_appenders
352
- appenders.each do |type, topts|
353
- pattern_opts = {
354
- pattern: topts.delete(:pattern),
355
- date_pattern: topts.delete(:date_pattern),
356
- color_scheme: topts.delete(:color_scheme),
357
- date_method: topts.delete(:date_method)
358
- }
359
-
360
- if pattern_opts[:pattern]
361
- appender_opts = topts.merge(layout: Logging.layouts.pattern(pattern_opts))
362
- else
363
- appender_opts = topts
364
- end
365
-
366
- case type.to_sym
367
- when :stdout
368
- $stdout.sync = true
369
- logger.add_appenders(Logging.appenders.stdout('custom_stdout', appender_opts))
370
- when :file, :rolling_file
371
- dir_name = topts.delete(:log_dir) || DEF_LOG_DIR
372
- file_name = topts.delete(:log_file) || "#{File.basename($0, File.extname($0))}.log"
373
- path = File.join(dir_name, file_name)
374
- logger.add_appenders(Logging.appenders.send(type, path, appender_opts))
375
- when :oml4r
376
- logger.add_appenders(Logging.appenders.oml4r('oml4r', appender_opts))
377
- else
378
- raise "Unknown logging appender type '#{type}'"
379
- end
380
- end
381
- end
382
290
  end
383
291
 
384
292
  def self._rec_merge(this_hash, other_hash)
@@ -3,21 +3,8 @@
3
3
  # You should find a copy of the License in LICENSE.TXT or at http://opensource.org/licenses/MIT.
4
4
  # By downloading or using this software you accept the terms and the liability disclaimer in the License.
5
5
 
6
- begin
7
- require 'blather'
8
- require 'blather/client/dsl'
9
- rescue LoadError => e
10
- error <<-ERR
11
- #{e.message}
12
-
13
- # Looks like you are trying to use XMPP as your communication protocol but you have not installed XMPP library 'blather'
14
- #
15
- # To correct this, install blather. E.g.
16
- #
17
- # gem install blather
18
- ERR
19
- exit(1)
20
- end
6
+ require 'blather'
7
+ require 'blather/client/dsl'
21
8
 
22
9
  require 'omf_common/comm/xmpp/xmpp_mp'
23
10
  require 'omf_common/comm/xmpp/topic'
data/omf_common.gemspec CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency "mocha"
29
29
 
30
30
  s.add_runtime_dependency "eventmachine"
31
+ s.add_runtime_dependency "blather"
31
32
  s.add_runtime_dependency "logging"
32
33
  s.add_runtime_dependency "hashie"
33
34
  s.add_runtime_dependency "oml4r", "~> 2.10.1"
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omf_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.3.pre.2
5
- prerelease: 6
4
+ version: 6.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - NICTA
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-08 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: minitest
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: evented-spec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: simplecov
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: pry
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: mocha
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: eventmachine
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,20 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: blather
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
106
107
  requirements:
107
108
  - - ! '>='
108
109
  - !ruby/object:Gem::Version
@@ -110,7 +111,6 @@ dependencies:
110
111
  - !ruby/object:Gem::Dependency
111
112
  name: logging
112
113
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
114
  requirements:
115
115
  - - ! '>='
116
116
  - !ruby/object:Gem::Version
@@ -118,7 +118,6 @@ dependencies:
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
121
  requirements:
123
122
  - - ! '>='
124
123
  - !ruby/object:Gem::Version
@@ -126,7 +125,6 @@ dependencies:
126
125
  - !ruby/object:Gem::Dependency
127
126
  name: hashie
128
127
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
128
  requirements:
131
129
  - - ! '>='
132
130
  - !ruby/object:Gem::Version
@@ -134,7 +132,6 @@ dependencies:
134
132
  type: :runtime
135
133
  prerelease: false
136
134
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
135
  requirements:
139
136
  - - ! '>='
140
137
  - !ruby/object:Gem::Version
@@ -142,7 +139,6 @@ dependencies:
142
139
  - !ruby/object:Gem::Dependency
143
140
  name: oml4r
144
141
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
142
  requirements:
147
143
  - - ~>
148
144
  - !ruby/object:Gem::Version
@@ -150,7 +146,6 @@ dependencies:
150
146
  type: :runtime
151
147
  prerelease: false
152
148
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
149
  requirements:
155
150
  - - ~>
156
151
  - !ruby/object:Gem::Version
@@ -158,7 +153,6 @@ dependencies:
158
153
  - !ruby/object:Gem::Dependency
159
154
  name: json
160
155
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
156
  requirements:
163
157
  - - ! '>='
164
158
  - !ruby/object:Gem::Version
@@ -166,7 +160,6 @@ dependencies:
166
160
  type: :runtime
167
161
  prerelease: false
168
162
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
163
  requirements:
171
164
  - - ! '>='
172
165
  - !ruby/object:Gem::Version
@@ -174,7 +167,6 @@ dependencies:
174
167
  - !ruby/object:Gem::Dependency
175
168
  name: json-jwt
176
169
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
170
  requirements:
179
171
  - - ! '>='
180
172
  - !ruby/object:Gem::Version
@@ -182,7 +174,6 @@ dependencies:
182
174
  type: :runtime
183
175
  prerelease: false
184
176
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
177
  requirements:
187
178
  - - ! '>='
188
179
  - !ruby/object:Gem::Version
@@ -190,7 +181,6 @@ dependencies:
190
181
  - !ruby/object:Gem::Dependency
191
182
  name: amqp
192
183
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
184
  requirements:
195
185
  - - ! '>='
196
186
  - !ruby/object:Gem::Version
@@ -198,7 +188,6 @@ dependencies:
198
188
  type: :runtime
199
189
  prerelease: false
200
190
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
191
  requirements:
203
192
  - - ! '>='
204
193
  - !ruby/object:Gem::Version
@@ -206,7 +195,6 @@ dependencies:
206
195
  - !ruby/object:Gem::Dependency
207
196
  name: uuidtools
208
197
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
198
  requirements:
211
199
  - - ! '>='
212
200
  - !ruby/object:Gem::Version
@@ -214,7 +202,6 @@ dependencies:
214
202
  type: :runtime
215
203
  prerelease: false
216
204
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
205
  requirements:
219
206
  - - ! '>='
220
207
  - !ruby/object:Gem::Version
@@ -317,26 +304,49 @@ files:
317
304
  homepage: http://omf.mytestbed.net
318
305
  licenses:
319
306
  - MIT
307
+ metadata: {}
320
308
  post_install_message:
321
309
  rdoc_options: []
322
310
  require_paths:
323
311
  - lib
324
312
  required_ruby_version: !ruby/object:Gem::Requirement
325
- none: false
326
313
  requirements:
327
314
  - - ! '>='
328
315
  - !ruby/object:Gem::Version
329
316
  version: 1.9.3
330
317
  required_rubygems_version: !ruby/object:Gem::Requirement
331
- none: false
332
318
  requirements:
333
- - - ! '>'
319
+ - - ! '>='
334
320
  - !ruby/object:Gem::Version
335
- version: 1.3.1
321
+ version: '0'
336
322
  requirements: []
337
323
  rubyforge_project: omf_common
338
- rubygems_version: 1.8.23
324
+ rubygems_version: 2.1.10
339
325
  signing_key:
340
- specification_version: 3
326
+ specification_version: 4
341
327
  summary: Common library of OMF
342
- test_files: []
328
+ test_files:
329
+ - test/fixture/1st_level.pem
330
+ - test/fixture/2nd_level.pem
331
+ - test/fixture/alice-cert.pem
332
+ - test/fixture/alice-key.pem
333
+ - test/fixture/omf_test.cert.pem
334
+ - test/fixture/omf_test.pem
335
+ - test/fixture/omf_test.pub
336
+ - test/fixture/omf_test.pub.pem
337
+ - test/fixture/pubsub.rb
338
+ - test/fixture/rc.pem
339
+ - test/fixture/root.pem
340
+ - test/omf_common/auth/certificate_spec.rb
341
+ - test/omf_common/auth/certificate_store_spec.rb
342
+ - test/omf_common/auth/ssh_pub_key_convert_spec.rb
343
+ - test/omf_common/comm/amqp/communicator_spec.rb
344
+ - test/omf_common/comm/topic_spec.rb
345
+ - test/omf_common/comm/xmpp/communicator_spec.rb
346
+ - test/omf_common/comm/xmpp/topic_spec.rb
347
+ - test/omf_common/comm_spec.rb
348
+ - test/omf_common/command_spec.rb
349
+ - test/omf_common/core_ext/string_spec.rb
350
+ - test/omf_common/message/xml/message_spec.rb
351
+ - test/omf_common/message_spec.rb
352
+ - test/test_helper.rb