oml4r 2.9.0.1 → 2.9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/oml4r.rb +17 -2
  2. metadata +2 -2
data/lib/oml4r.rb CHANGED
@@ -40,7 +40,7 @@ require 'optparse'
40
40
  #
41
41
  module OML4R
42
42
 
43
- VERSION = "2.9.0.1"
43
+ VERSION = "2.9.0.2"
44
44
  VERSION_STRING = "OML4R Client V#{VERSION}"
45
45
  COPYRIGHT = "Copyright 2009-2012, NICTA"
46
46
  DEF_SERVER_PORT = 3003
@@ -246,7 +246,7 @@ module OML4R
246
246
  end
247
247
  omlCollectUri = ENV['OML_COLLECT'] || ENV['OML_SERVER'] || opts[:collect] || opts[:omlServer]
248
248
  noop = opts[:noop] || false
249
-
249
+ omlConfigFile = nil
250
250
 
251
251
  # Create a new Parser for the command line
252
252
  op = OptionParser.new
@@ -258,6 +258,7 @@ module OML4R
258
258
  op.on("--oml-collect uri", "URI of server to send measurements to") { |u| omlCollectUri = u }
259
259
  op.on("--oml-log-level l", "Log level used (info: 0 .. debug: 1)") { |l| OML4R.loglevel = l.to_i }
260
260
  op.on("--oml-noop", "Do not collect measurements") { noop = true }
261
+ op.on("--oml-config file", "File holding OML configuration parameters") { |f| omlConfigFile = f }
261
262
  op.on("--oml-exp-id domain", "Obsolescent equivalent to --oml-domain domain") { |name|
262
263
  domain = name
263
264
  $stderr.puts "WARN Option --oml-exp-id is getting deprecated; please use '--oml-domain #{domain}' instead"
@@ -282,6 +283,20 @@ module OML4R
282
283
  rest = op.parse(argv)
283
284
  return if noop
284
285
 
286
+ # Parameters in OML config file takes precedence
287
+ unless omlConfigFile.nil?
288
+ f = File.open(omlConfigFile, 'r')
289
+ f.each_line do |l|
290
+ d = l[/.*experiment='([^']*)/,1]
291
+ domain = d if d
292
+ i = l[/.*id='([^']*)/,1]
293
+ nodeID = i if i
294
+ u = l[/.*url='([^']*)/,1]
295
+ omlCollectUri = u if u
296
+ end
297
+ f.close
298
+ end
299
+
285
300
  unless domain && nodeID && appName
286
301
  raise 'OML4R: Missing values for parameters :domain (--oml-domain), :nodeID (--oml-id), or :appName (in code)!'
287
302
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oml4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0.1
4
+ version: 2.9.0.2
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: 2012-12-13 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! '["Simple OML client library for Ruby"]'
15
15
  email: