class Albacore::Asmver::Config

Attributes

namespace[RW]

the namespace to output into the version file

out[RW]

(optional) output stream

usings[RW]

the array-like thing of using namespaces

Public Class Methods

new(file_path = nil, namespace = nil, attributes = nil) click to toggle source

creates a new config with some pre-existing data

# File lib/albacore/task_types/asmver.rb, line 81
def initialize file_path = nil, namespace = nil, attributes = nil
  @file_path, @namespace, @attributes = file_path, namespace, attributes
  @usings = []
end

Public Instance Methods

attributes(attrs) click to toggle source

Give the hash of attributes to write to the assembly info file

# File lib/albacore/task_types/asmver.rb, line 92
def attributes attrs
  @attributes = attrs
end
change_attributes() { |attributes| ... } click to toggle source

Call with to get the opportunity to change the attributes hash

# File lib/albacore/task_types/asmver.rb, line 87
def change_attributes &block
  yield @attributes if block
end
opts() click to toggle source

@return Map object

# File lib/albacore/task_types/asmver.rb, line 102
def opts
  raise MissingOutputError, "#file_path or #out 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,
              usings: usings
  m[:out] = out if out
  m
end
to_s() click to toggle source
# File lib/albacore/task_types/asmver.rb, line 115
def to_s
  "AsmVer::Config[#{file_path}]"
end
using(ns) click to toggle source
# File lib/albacore/task_types/asmver.rb, line 96
def using ns
  debug { "adding namespace #{ns} [Asmver::Config using]" }
  usings << ns
end

Private Instance Methods

lang_for(path) click to toggle source
# File lib/albacore/task_types/asmver.rb, line 121
def lang_for path
  mk = lambda { |lang| "Albacore::Asmver::#{lang}".split('::').inject(Object) { |o, c| o.const_get c }.new }
  case File.extname path
    when ".fs" then mk.call "Fs"
    when ".cs" then mk.call "Cs"
    when ".vb" then mk.call "Vb"
    when ".cpp" then mk.call "Cpp"
  end
end