Why is this Albacore task defined in the class not working?

I put this class together, but it does not work to actually start the assembly. I inserted some other entries and no errors occur. I declare myself a noob in Ruby, so I hope that some fine Ruby Expert can detect any idiotic mistake I have!

require 'rubygems'
require 'albacore'
require 'albacore/support/albacore_helper'
require 'rake'
require 'rake/tasklib'

class Build_Assembly
  def build(build_properties)
    puts 'doing an assembly build'

    msbuild :compile do |msb|
      puts 'running build'

      msb.properties :configuration => :Debug
      msb.targets :Clean, :Build
      msb.solution = build_properties.solution_file_location
      msb.execute
    end
  end
end

I also tried using: build, not compilation.

I saw how albacore works and understands the power of this, I just need my skills to be sharpened a bit, I hope

+3
source share
1 answer

msbuild, , , Albacore - rake, msbuild - , rake, , .

msb.execute do |msb| ... end , rake.

, . № 1 Albacore. Albacore, , . № 2 № 3 , API Albacore . , , .

1. script

# rakefile.rb
require 'albacore'

task :default => [:compile]

msbuild :compile do |msb|
  puts 'running build'
  msb.properties :configuration => :Debug
  msb.targets :Clean, :Build
  msb.solution = build_properties.solution_file_location
end

, rake , rakefile.rb

2. Task[:compile].execute .

msbuild rake, , , , . , -.

require 'rubygems'
require 'albacore'
require 'albacore/support/albacore_helper'
require 'rake'
require 'rake/tasklib'

class Build_Assembly

  def build(build_properties)
    puts 'doing an assembly build'

    msbuild :compile do |msb|
      puts 'running build'
      msb.properties :configuration => :Debug
      msb.targets :Clean, :Build
      msb.solution = build_properties.solution_file_location
    end

    Task[:compile].execute
  end
end

3. msbuild , msbuild rake

msbuild , msbuild MSBuild. , ... , ,

require 'rubygems'
require 'albacore'
require 'albacore/support/albacore_helper'
require 'rake'
require 'rake/tasklib'

class Build_Assembly

  def build(build_properties)
    puts 'doing an assembly build'

    msb = MSBuild.new
    puts 'running build'
    msb.properties :configuration => :Debug
    msb.targets :Clean, :Build
    msb.solution = build_properties.solution_file_location
    msb.execute
  end
end

, .execute, .

+4

Source: https://habr.com/ru/post/1776809/


All Articles