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 |
# File 'lib/bozo/compilers/msbuild.rb', line 8 def initialize @config = { :version => 'v4.0.30319', :framework => 'Framework64', :properties => {:configuration => :release}, :max_cores => nil, :targets => [:build], :websites_as_zip => false } @exclude_projects = [] end |
Instance Method Details
#configuration ⇒ Object
66 67 68 |
# File 'lib/bozo/compilers/msbuild.rb', line 66 def configuration Marshal.load(Marshal.dump(@config.dup)) end |
#exclude_project(project_name) ⇒ Object
36 37 38 |
# File 'lib/bozo/compilers/msbuild.rb', line 36 def exclude_project(project_name) @exclude_projects << project_name end |
#execute ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/bozo/compilers/msbuild.rb', line 70 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
24 25 26 |
# File 'lib/bozo/compilers/msbuild.rb', line 24 def framework(framework) @config[:framework] = framework end |
#max_cores(cores) ⇒ Object
Assign how many cores should be used by msbuild
48 49 50 |
# File 'lib/bozo/compilers/msbuild.rb', line 48 def max_cores(cores) @config[:max_cores] = cores end |
#project_files(directory) ⇒ Object
84 85 86 87 |
# File 'lib/bozo/compilers/msbuild.rb', line 84 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
32 33 34 |
# File 'lib/bozo/compilers/msbuild.rb', line 32 def property(args) @config[:properties] = @config[:properties].merge(args) end |
#solution(path) ⇒ Object
28 29 30 |
# File 'lib/bozo/compilers/msbuild.rb', line 28 def solution(path) @config[:solution] = path end |
#target(target) ⇒ Object
54 55 56 |
# File 'lib/bozo/compilers/msbuild.rb', line 54 def target(target) @config[:targets] << target end |
#to_s ⇒ Object
58 59 60 |
# File 'lib/bozo/compilers/msbuild.rb', line 58 def to_s "Compile with msbuild #{@config[:version]} building #{@config[:solution]} with properties #{@config[:properties]} for targets #{@config[:targets]}" end |
#version(version) ⇒ Object
20 21 22 |
# File 'lib/bozo/compilers/msbuild.rb', line 20 def version(version) @config[:version] = version end |
#websites_as_zip ⇒ Object
40 41 42 |
# File 'lib/bozo/compilers/msbuild.rb', line 40 def websites_as_zip @config[:websites_as_zip] = true end |
#without_stylecop ⇒ Object
62 63 64 |
# File 'lib/bozo/compilers/msbuild.rb', line 62 def without_stylecop @config[:without_stylecop] = true end |