Class: Albacore::Tasks::Release

Inherits:
Object
  • Object
show all
Includes:
DSL, Rake::DSL
Defined in:
lib/albacore/tasks/release.rb

Overview

Constant Summary

Constants included from CrossPlatformCmd

CrossPlatformCmd::KILL_TIMEOUT

Instance Attribute Summary

Attributes included from CrossPlatformCmd

#pid

Instance Method Summary collapse

Methods included from CrossPlatformCmd

#chdir, #make_command, #normalise_slashes, #sh, #shie, #stop, #system, #which

Methods included from Logging

#debug, #err, #error, #fatal, #info, #puts, #trace, #warn

Constructor Details

#initialize(name = :release, opts = {}, &block) ⇒ Release

Returns a new instance of Release.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/albacore/tasks/release.rb', line 38

def initialize name = :release, opts = {}, &block
  @name = name
  @opts = Map.new(opts).apply \
    pkg_dir:      'build/pkg',
    nuget_exe:    'tools/NuGet.exe',
    nuget_source: 'https://www.nuget.org/api/v2/package',
    clr_command:  true,
    depend_on:    :versioning,
    semver:       nil
  semver = @opts.get :semver
  @block = block if block_given?

  unless semver
    ::Albacore.subscribe :build_version do |data|
      @semver = data.semver
    end
  else
    @semver = semver
  end

  install
end

Instance Method Details

#installObject

Installs the rake tasks under the ‘release’ namespace with a named task (given as the first parameter to the c’tor) that calls all subtasks.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/albacore/tasks/release.rb', line 64

def install
  namespace :"#{@name}" do
    task :info => @opts.get(:depend_on) do
      debug do
        "Releasing to #{@opts.get :nuget_source} with task #{@name}"
      end
    end

    task :guard_clean => @opts.get(:depend_on) do
      guard_clean
    end

    task :guard_pkg => @opts.get(:depend_on) do
      guard_pkg
    end

    task :scm_write => @opts.get(:depend_on) do
      tag_version { git_push } unless already_tagged?
    end

    task :nuget_push => @opts.get(:depend_on) do
      packages.each do |package|
        nuget_push package
      end
    end
  end

  desc 'release current package(s)'
  task @name => %W|info guard_clean guard_pkg scm_write nuget_push|.map { |n| :"#{@name}:#{n}" }
end