Class: MSBuild
- Inherits:
-
Object
- Object
- MSBuild
- Includes:
- Albacore::RunCommand, Albacore::Task, Configuration::MSBuild
- Defined in:
- lib/albacore/msbuild.rb
Instance Attribute Summary collapse
-
#loggermodule ⇒ Object
Returns the value of attribute loggermodule.
-
#max_cpu_count ⇒ Object
Returns the value of attribute max_cpu_count.
-
#solution ⇒ Object
Returns the value of attribute solution.
-
#verbosity ⇒ Object
Returns the value of attribute verbosity.
Attributes included from Logging
Attributes included from Albacore::RunCommand
Instance Method Summary collapse
- #build_properties ⇒ Object
- #build_solution(solution) ⇒ Object
- #build_switches ⇒ Object
- #build_targets ⇒ Object
- #check_solution(file) ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ MSBuild
constructor
A new instance of MSBuild.
- #nologo ⇒ Object
- #print_switch(key, value) ⇒ Object
- #pure_switch?(value) ⇒ Boolean
Methods included from Configuration::MSBuild
included, #msbuild, msbuildconfig, #use
Methods included from Configuration::NetVersion
Methods included from Failure
Methods included from Logging
#create_logger, #log_device=, #log_level, #log_level=
Methods included from Albacore::Configuration
Methods included from Albacore::RunCommand
Methods included from AttrMethods
Methods included from Albacore::Task
clean_dirname, create_rake_task, include_config, included
Methods included from UpdateAttributes
Methods included from YAMLConfig
#configure, #load_config_by_task_name
Constructor Details
#initialize ⇒ MSBuild
Returns a new instance of MSBuild.
13 14 15 16 |
# File 'lib/albacore/msbuild.rb', line 13 def initialize super() update_attributes msbuild.to_hash end |
Instance Attribute Details
#loggermodule ⇒ Object
Returns the value of attribute loggermodule.
9 10 11 |
# File 'lib/albacore/msbuild.rb', line 9 def loggermodule @loggermodule end |
#max_cpu_count ⇒ Object
Returns the value of attribute max_cpu_count.
9 10 11 |
# File 'lib/albacore/msbuild.rb', line 9 def max_cpu_count @max_cpu_count end |
#solution ⇒ Object
Returns the value of attribute solution.
9 10 11 |
# File 'lib/albacore/msbuild.rb', line 9 def solution @solution end |
#verbosity ⇒ Object
Returns the value of attribute verbosity.
9 10 11 |
# File 'lib/albacore/msbuild.rb', line 9 def verbosity @verbosity end |
Instance Method Details
#build_properties ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/albacore/msbuild.rb', line 55 def build_properties option_text = [] @properties.each do |key, value| option_text << "/p:#{key}\=\"#{value}\"" end option_text.join(" ") end |
#build_solution(solution) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/albacore/msbuild.rb', line 26 def build_solution(solution) check_solution solution command_parameters = [] command_parameters << "\"#{solution}\"" command_parameters << "\"/verbosity:#{@verbosity}\"" if @verbosity != nil command_parameters << "\"/logger:#{@loggermodule}\"" if @loggermodule != nil command_parameters << "\"/maxcpucount:#{@max_cpu_count}\"" if @max_cpu_count != nil command_parameters << "\"/nologo\"" if @nologo command_parameters << build_properties if @properties != nil command_parameters << build_switches if @other_switches != nil command_parameters << "\"/target:#{build_targets}\"" if @targets != nil result = run_command "MSBuild", command_parameters.join(" ") = 'MSBuild Failed. See Build Log For Detail' if !result end |
#build_switches ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/albacore/msbuild.rb', line 63 def build_switches switch_text = [] @other_switches.each do |key, value| switch_text << print_switch(key, value) end switch_text.join(" ") end |
#build_targets ⇒ Object
51 52 53 |
# File 'lib/albacore/msbuild.rb', line 51 def build_targets @targets.join ";" end |
#check_solution(file) ⇒ Object
45 46 47 48 49 |
# File 'lib/albacore/msbuild.rb', line 45 def check_solution(file) return if file msg = 'solution cannot be nil' msg end |
#execute ⇒ Object
18 19 20 |
# File 'lib/albacore/msbuild.rb', line 18 def execute build_solution(@solution) end |
#nologo ⇒ Object
22 23 24 |
# File 'lib/albacore/msbuild.rb', line 22 def nologo @nologo = true end |
#print_switch(key, value) ⇒ Object
71 72 73 |
# File 'lib/albacore/msbuild.rb', line 71 def print_switch(key, value) pure_switch?(value) ? "/#{key}" : "/#{key}:\"#{value}\"" end |
#pure_switch?(value) ⇒ Boolean
75 76 77 |
# File 'lib/albacore/msbuild.rb', line 75 def pure_switch?(value) value.is_a?(TrueClass) || value == :true end |