Sha256: 98bc7a21ae22c61f4da7a20f04dd02fa613fc2887539a015e05098804051abcc
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 KB
Contents
require 'set' require 'albacore/logging' require 'albacore/cross_platform_cmd' require 'albacore/cmd_config' require 'albacore/errors/unfilled_property_error' require 'albacore/task_types/asmver/cs' require 'albacore/task_types/asmver/vb' require 'albacore/task_types/asmver/cpp' require 'albacore/task_types/asmver/fs' require 'albacore/task_types/asmver/file_generator' module Albacore module Asmver class Config include CmdConfig self.extend ConfigDSL # the file name to write the assembly info to attr_path_accessor :file_path attr_writer :namespace # (optional) output stream attr_writer :out def initialize end # the hash of attributes to write to the assembly info file def attributes attrs @attributes = attrs end def opts raise Error, "#file_path is not set" unless (file_path or out) lang = lang_for file_path m = Map.new attributes: @attributes, namespace: @namespace, file_path: @file_path, language: lang m[:out] = @out if @out m end private 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 end class Task def initialize opts @opts = opts end def execute lang = @opts.get :language ns = @opts.get :namespace attrs = @opts.get :attributes out = @opts.get(:out) { File.open(@opts.get(:file_path), 'w') } ::Albacore::Asmver::FileGenerator.new(lang, ns, @opts).generate(attrs) ensure out.close if out end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
albacore-2.0.0.rc.2 | lib/albacore/task_types/asmver.rb |
albacore-2.0.0.rc.1 | lib/albacore/task_types/asmver.rb |