Class: Bozo::Compilers::Msbuild
- Inherits:
- 
      Object
      
        - Object
- Bozo::Compilers::Msbuild
 
- Defined in:
- lib/bozo/compilers/msbuild.rb
Instance Method Summary collapse
- #config_with_defaults ⇒ Object
- #configuration ⇒ Object
- #exclude_project(project_name) ⇒ Object
- #execute ⇒ Object
- #framework(framework) ⇒ Object
- 
  
    
      #initialize  ⇒ Msbuild 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Msbuild. 
- 
  
    
      #max_cores(cores)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Assign how many cores should be used by msbuild. 
- #project_files(directory) ⇒ Object
- #property(args) ⇒ Object (also: #properties)
- #required_tools ⇒ Object
- #solution(path) ⇒ Object
- #target(target) ⇒ Object
- #to_s ⇒ Object
- #version(version) ⇒ Object
- #websites_as_zip? ⇒ Boolean
- #without_stylecop ⇒ Object
Constructor Details
#initialize ⇒ Msbuild
| 24 25 26 27 | # File 'lib/bozo/compilers/msbuild.rb', line 24 def initialize @config = {} @exclude_projects = [] end | 
Instance Method Details
#config_with_defaults ⇒ Object
| 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # File 'lib/bozo/compilers/msbuild.rb', line 8 def config_with_defaults defaults = { :version => 'v4.0.30319', :framework => 'Framework64', :properties => {:configuration => :release}, :max_cores => nil } default_targets = [:build] config = defaults.merge @config config[:targets] = (@targets or default_targets).clone config[:websites_as_zip] = false config end | 
#configuration ⇒ Object
| 78 79 80 | # File 'lib/bozo/compilers/msbuild.rb', line 78 def configuration config_with_defaults end | 
#exclude_project(project_name) ⇒ Object
| 46 47 48 | # File 'lib/bozo/compilers/msbuild.rb', line 46 def exclude_project(project_name) @exclude_projects << project_name end | 
#execute ⇒ Object
| 82 83 84 85 86 87 88 89 90 91 92 93 94 | # File 'lib/bozo/compilers/msbuild.rb', line 82 def execute projects = (project_files('test') | project_files('src')).map { |file| create_project file } # Clean all the projects first. projects.each do |project| project.clean configuration end # Build all the projects so they can utilize each others artifacts. projects.each do |project| project.build configuration end end | 
#framework(framework) ⇒ Object
| 33 34 35 | # File 'lib/bozo/compilers/msbuild.rb', line 33 def framework(framework) @config[:framework] = framework end | 
#max_cores(cores) ⇒ Object
Assign how many cores should be used by msbuild
| 58 59 60 | # File 'lib/bozo/compilers/msbuild.rb', line 58 def max_cores(cores) @config[:max_cores] = cores end | 
#project_files(directory) ⇒ Object
| 96 97 98 99 | # File 'lib/bozo/compilers/msbuild.rb', line 96 def project_files(directory) project_file_matcher = File.(File.join(directory, 'csharp', '**', '*.csproj')) Dir[project_file_matcher].select { |p| not @exclude_projects.include?(File.basename p, '.csproj') } end | 
#property(args) ⇒ Object Also known as: properties
| 41 42 43 44 | # File 'lib/bozo/compilers/msbuild.rb', line 41 def property(args) @config[:properties] ||= {} @config[:properties] = @config[:properties].merge(args) end | 
#required_tools ⇒ Object
| 101 102 103 | # File 'lib/bozo/compilers/msbuild.rb', line 101 def required_tools :stylecop unless @config[:without_stylecop] end | 
#solution(path) ⇒ Object
| 37 38 39 | # File 'lib/bozo/compilers/msbuild.rb', line 37 def solution(path) @config[:solution] = path end | 
#target(target) ⇒ Object
| 64 65 66 67 | # File 'lib/bozo/compilers/msbuild.rb', line 64 def target(target) @targets ||= [] @targets << target end | 
#to_s ⇒ Object
| 69 70 71 72 | # File 'lib/bozo/compilers/msbuild.rb', line 69 def to_s config = configuration "Compile with msbuild #{config[:version]} building #{config[:solution]} with properties #{config[:properties]} for targets #{config[:targets]}" end | 
#version(version) ⇒ Object
| 29 30 31 | # File 'lib/bozo/compilers/msbuild.rb', line 29 def version(version) @config[:version] = version end | 
#websites_as_zip? ⇒ Boolean
| 50 51 52 | # File 'lib/bozo/compilers/msbuild.rb', line 50 def websites_as_zip? @config[:websites_as_zip] = true end | 
#without_stylecop ⇒ Object
| 74 75 76 | # File 'lib/bozo/compilers/msbuild.rb', line 74 def without_stylecop @config[:without_stylecop] = true end |