Class: Albacore::Asmver::Config

Inherits:
Object
  • Object
show all
Extended by:
ConfigDSL
Includes:
CmdConfig
Defined in:
lib/albacore/task_types/asmver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConfigDSL

attr_path, attr_path_accessor

Methods included from CmdConfig

#add_parameter, #parameters

Methods included from Logging

#debug, #err, #error, #fatal, #info, #puts, #trace, #warn

Constructor Details

#initialize(file_path = nil, namespace = nil, attributes = nil) ⇒ Config

creates a new config with some pre-existing data



64
65
66
# File 'lib/albacore/task_types/asmver.rb', line 64

def initialize file_path = nil, namespace = nil, attributes = nil
  @file_path, @namespace, @attributes = file_path, namespace, attributes
end

Instance Attribute Details

#namespace=(value) ⇒ Object (writeonly)

the namespace to output into the version file



58
59
60
# File 'lib/albacore/task_types/asmver.rb', line 58

def namespace=(value)
  @namespace = value
end

#out=(value) ⇒ Object (writeonly)

(optional) output stream



61
62
63
# File 'lib/albacore/task_types/asmver.rb', line 61

def out=(value)
  @out = value
end

Instance Method Details

#attributes(attrs) ⇒ Object

the hash of attributes to write to the assembly info file



69
70
71
# File 'lib/albacore/task_types/asmver.rb', line 69

def attributes attrs
  @attributes = attrs
end

#optsObject

Raises:

  • (Error)


73
74
75
76
77
78
79
80
81
82
83
# File 'lib/albacore/task_types/asmver.rb', line 73

def opts
  raise Error, "#file_path is not set" unless (file_path or out)
  ns   = @namespace || '' # defaults to empty namespace if not set.
  lang = lang_for file_path
  m = Map.new attributes: @attributes,
    namespace: ns,
    file_path: @file_path,
    language:  lang
  m[:out] = @out if @out
  m
end

#to_sObject



85
86
87
# File 'lib/albacore/task_types/asmver.rb', line 85

def to_s
  "AsmVer::Config[#{file_path}]"
end