Skip to content

Instantly share code, notes, and snippets.

@dagda1
Created February 22, 2011 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagda1/838459 to your computer and use it in GitHub Desktop.
Save dagda1/838459 to your computer and use it in GitHub Desktop.
class AsmInfoBuilder
attr_reader :buildnumber
def initialize(baseVersion, properties)
@properties = properties;
@buildnumber = baseVersion + (ENV["CCNetLabel"].nil? ? '0' : ENV["CCNetLabel"].to_s)
@properties['Version'] = @properties['InformationalVersion'] = buildnumber;
end
def write(file)
template = %q{
using System;
using System.Reflection;
using System.Runtime.InteropServices;
<% @properties.each {|k, v| %>
[assembly: Assembly<%=k%>Attribute("<%=v%>")]
<% } %>
}.gsub(/^ /, '')
erb = ERB.new(template, 0, "%<>")
File.open(file, 'w') do |file|
file.puts erb.result(binding)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment