/tools/Rake/assemblyinfo.rb
http://github.com/agross/netopenspace · Ruby · 30 lines · 23 code · 7 blank · 0 comment · 0 complexity · 7ef50587acd19316152ff72ba9443ddc MD5 · raw file
- require 'rake'
- require 'erb'
-
- class AssemblyInfoBuilder
- attr_reader :attributes
-
- def initialize(attributes)
- @attributes = attributes;
- end
-
- def write(file)
- template = %q{
- using System;
- using System.Reflection;
- using System.Runtime.InteropServices;
-
- <% @attributes.each do |key, value| %>
- [assembly: <%= key %>("<%= value %>")]
- <% end %>
- }.gsub(/^\s+/, '')
-
- erb = ERB.new(template, 0, "%<>")
-
- File.open(file, 'w') do |f|
- f.puts erb.result(binding)
- end
-
- puts "Created file #{file}"
- end
- end