Class: Bricolage::CommonApplicationOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/bricolage/application.rb

Direct Known Subclasses

GlobalOptions, JobNetRunner::Options

Defined Under Namespace

Classes: OptionValue

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.


198
199
200
# File 'lib/bricolage/application.rb', line 198

def parser
  @parser
end

Instance Method Details

#common_optionsObject

Accessors


256
257
258
# File 'lib/bricolage/application.rb', line 256

def common_options
  @opts
end

#log_path_formatObject


260
261
262
263
264
265
266
267
268
# File 'lib/bricolage/application.rb', line 260

def log_path_format
  if opt = @opts['log-dir'] and opt.value
    LogFilePath.new("#{opt.value}/%{std}.log")
  elsif opt = @opts['log-path'] and opt.value
    LogFilePath.new(opt.value)
  else
    nil
  end
end

#log_s3_dsObject


270
271
272
# File 'lib/bricolage/application.rb', line 270

def log_s3_ds
  s3_log_spec.first
end

#log_s3_key_formatObject


274
275
276
# File 'lib/bricolage/application.rb', line 274

def log_s3_key_format
  s3_log_spec.last
end

#merge_saved_options(vars) ⇒ Object


236
237
238
239
240
241
242
243
244
245
# File 'lib/bricolage/application.rb', line 236

def merge_saved_options(vars)
  saved = {}
  @opts_default.keys.each do |key|
    if val = vars.get_force(key)
      saved[key] = OptionValue.new("bricolage.yml:#{key}", val)
    end
  end
  @opts_saved = saved
  build_common_options!
end

#s3_log_specObject


278
279
280
281
282
283
284
285
286
287
288
# File 'lib/bricolage/application.rb', line 278

def s3_log_spec
  @s3_log_spec ||=
    if opt = @opts['s3-log'] and spec = opt.value
      ds, k = spec.split(':', 2)
      k = k.to_s.strip
      key = k.empty? ? nil : k
      [ds, LogFilePath.new(key || '%{std}.log')]
    else
      [nil, nil]
    end
end