Class: Bozo::Compilers::Msbuild
- Inherits:
-
Object
- Object
- Bozo::Compilers::Msbuild
- Defined in:
- lib/bozo/compilers/msbuild.rb
Instance Method Summary collapse
- #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)
- #solution(path) ⇒ Object
- #target(target) ⇒ Object
- #to_s ⇒ Object
- #version(version) ⇒ Object
- #websites_as_zip ⇒ Object
- #without_stylecop ⇒ Object
Constructor Details
#initialize ⇒ Msbuild
Returns a new instance of Msbuild.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bozo/compilers/msbuild.rb', line 8 def initialize @config = { :version => 'v4.0.30319', :framework => 'Framework64', :properties => { :configuration => :release, :debugtype => :pdbonly, :debugsymbols => :true, :optimize => :true }, :max_cores => nil, :targets => [:build], :websites_as_zip => false } @exclude_projects = [] end |
Instance Method Details
#configuration ⇒ Object
71 72 73 |
# File 'lib/bozo/compilers/msbuild.rb', line 71 def configuration Marshal.load(Marshal.dump(@config.dup)) end |
#exclude_project(project_name) ⇒ Object
41 42 43 |
# File 'lib/bozo/compilers/msbuild.rb', line 41 def exclude_project(project_name) @exclude_projects << project_name end |
#execute ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/bozo/compilers/msbuild.rb', line 75 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
29 30 31 |
# File 'lib/bozo/compilers/msbuild.rb', line 29 def framework(framework) @config[:framework] = framework end |
#max_cores(cores) ⇒ Object
Assign how many cores should be used by msbuild
53 54 55 |
# File 'lib/bozo/compilers/msbuild.rb', line 53 def max_cores(cores) @config[:max_cores] = cores end |
#project_files(directory) ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/bozo/compilers/msbuild.rb', line 89 def project_files(directory) cs = File.(File.join(directory, 'csharp', '**', '*.csproj')) fs = File.(File.join(directory, 'fsharp', '**', '*.fsproj')) Dir[cs].concat(Dir[fs]).select do |p| not @exclude_projects.include?(File.basename p, '.csproj') || @exclude_projects.include?(File.basename p, '.fsproj') end end |
#property(args) ⇒ Object Also known as: properties
37 38 39 |
# File 'lib/bozo/compilers/msbuild.rb', line 37 def property(args) @config[:properties] = @config[:properties].merge(args) end |
#solution(path) ⇒ Object
33 34 35 |
# File 'lib/bozo/compilers/msbuild.rb', line 33 def solution(path) @config[:solution] = path end |
#target(target) ⇒ Object
59 60 61 |
# File 'lib/bozo/compilers/msbuild.rb', line 59 def target(target) @config[:targets] << target end |
#to_s ⇒ Object
63 64 65 |
# File 'lib/bozo/compilers/msbuild.rb', line 63 def to_s "Compile with msbuild #{@config[:version]} building #{@config[:solution]} with properties #{@config[:properties]} for targets #{@config[:targets]}" end |
#version(version) ⇒ Object
25 26 27 |
# File 'lib/bozo/compilers/msbuild.rb', line 25 def version(version) @config[:version] = version end |
#websites_as_zip ⇒ Object
45 46 47 |
# File 'lib/bozo/compilers/msbuild.rb', line 45 def websites_as_zip @config[:websites_as_zip] = true end |
#without_stylecop ⇒ Object
67 68 69 |
# File 'lib/bozo/compilers/msbuild.rb', line 67 def without_stylecop @config[:without_stylecop] = true end |