PageRenderTime 54ms CodeModel.GetById 49ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/Rake/assemblyinfo.rb

http://github.com/agross/netopenspace
Ruby | 30 lines | 23 code | 7 blank | 0 comment | 0 complexity | 7ef50587acd19316152ff72ba9443ddc MD5 | raw file
 1require 'rake'
 2require 'erb'
 3
 4class AssemblyInfoBuilder
 5	attr_reader :attributes
 6
 7	def initialize(attributes)
 8		@attributes = attributes;
 9	end
10
11	def write(file)
12		template = %q{
13			using System;
14			using System.Reflection;
15			using System.Runtime.InteropServices;
16
17			<% @attributes.each do |key, value| %>
18				[assembly: <%= key %>("<%= value %>")]
19			<% end %>
20		}.gsub(/^\s+/, '')
21
22		erb = ERB.new(template, 0, "%<>")
23
24		File.open(file, 'w') do |f|
25			f.puts erb.result(binding)
26		end
27		
28		puts "Created file #{file}"
29	end
30end