Created
September 21, 2009 20:39
-
-
Save mxriverlynn/190537 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#........... in my 'patches' folder | |
module HashParameterBuilder | |
def build_parameters | |
option_text = '' | |
self.each do |key, value| | |
option_text << "#{key}\=#{value};" | |
end | |
option_text.chop | |
end | |
end | |
module ArrayParameterBuilder | |
def build_parameters | |
option_text = '' | |
self.each do |value| | |
option_text << "#{value};" | |
end | |
option_text.chop | |
end | |
end | |
# ......... in my msbuild class | |
def targets=(targets={}) | |
@targets=targets | |
@targets.extend(ArrayParameterBuilder) | |
end | |
def properties=(properties={}) | |
@properties = properties | |
@properties.extend(HashParameterBuilder) | |
end | |
def build(path_to_solution) | |
cmd = "\"#{@path_to_exe}\" \"#{path_to_solution}\"" | |
cmd << " /property:#{@properties.build_parameters}" if @properties.length>0 | |
cmd << " /target:#{@targets.build_parameters}" if @targets.length>0 | |
system cmd | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment