Class: XBuild

Inherits:
Object
  • Object
show all
Includes:
Albacore::RunCommand, Albacore::Task
Defined in:
lib/albacore/xbuild.rb

Constant Summary collapse

TaskName =
[:xbuild, :mono]

Instance Attribute Summary collapse

Attributes included from Albacore::RunCommand

#command, #working_directory

Attributes included from Logging

#current_log_device, #logger

Instance Method Summary collapse

Methods included from Albacore::RunCommand

#get_command, #run_command

Methods included from AttrMethods

#attr_array, #attr_hash

Methods included from Albacore::Task

clean_dirname, create_rake_task, include_config, included

Methods included from UpdateAttributes

#<<, #update_attributes

Methods included from YAMLConfig

#configure, #load_config_by_task_name

Methods included from Logging

#create_logger, #log_device=, #log_level, #log_level=

Methods included from Failure

#fail_with_message

Constructor Details

#initializeXBuild

Returns a new instance of XBuild.



12
13
14
15
16
# File 'lib/albacore/xbuild.rb', line 12

def initialize
  @command = 'xbuild'
  super()
  update_attributes Albacore.configuration.xbuild.to_hash
end

Instance Attribute Details

#solutionObject

Returns the value of attribute solution.



8
9
10
# File 'lib/albacore/xbuild.rb', line 8

def solution
  @solution
end

#verbosityObject

Returns the value of attribute verbosity.



8
9
10
# File 'lib/albacore/xbuild.rb', line 8

def verbosity
  @verbosity
end

Instance Method Details

#build_propertiesObject



47
48
49
50
51
52
53
# File 'lib/albacore/xbuild.rb', line 47

def build_properties
  option_text = []
  @properties.each do |key, value|
    option_text << "/p:#{key}\=\"#{value}\""
  end
  option_text.join(" ")
end

#build_solution(solution) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/albacore/xbuild.rb', line 22

def build_solution(solution)
  check_solution solution
  
  command_parameters = []
  command_parameters << "\"#{solution}\""
  command_parameters << "\"/verbosity:#{@verbosity}\"" if @verbosity != nil
  command_parameters << build_properties if @properties != nil
  command_parameters << "\"/target:#{build_targets}\"" if @targets != nil
  
  result = run_command "xBuild", command_parameters.join(" ")
  
  failure_message = 'xBuild Failed. See Build Log For Detail'
  fail_with_message failure_message if !result
end

#build_targetsObject



43
44
45
# File 'lib/albacore/xbuild.rb', line 43

def build_targets
  @targets.join ";"
end

#check_solution(file) ⇒ Object



37
38
39
40
41
# File 'lib/albacore/xbuild.rb', line 37

def check_solution(file)
  return if file
  msg = 'solution cannot be nil'
  fail_with_message msg
end

#executeObject



18
19
20
# File 'lib/albacore/xbuild.rb', line 18

def execute
  build_solution(@solution)
end