Class: Bozo::Publishers::Nuget

Inherits:
Object
  • Object
show all
Defined in:
lib/bozo/publishers/nuget.rb

Overview

Publisher that pushes package to nuget

Instance Method Summary collapse

Constructor Details

#initializeNuget

Returns a new instance of Nuget.



8
9
10
11
# File 'lib/bozo/publishers/nuget.rb', line 8

def initialize
  @packages = []
  @api_key = ENV['NUGET_API_KEY']
end

Instance Method Details

#api_key(api_key) ⇒ Object



17
18
19
# File 'lib/bozo/publishers/nuget.rb', line 17

def api_key(api_key)
  @api_key = api_key
end

#executeObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/bozo/publishers/nuget.rb', line 25

def execute
  raise Bozo::ConfigurationError.new 'You must specify a nuget server address' if @server.empty?

  if @packages.empty?
    Dir[File.join('dist', 'nuget', '**', '*')].each do |source_file|
      push File.expand_path(source_file)
    end
  else
    build_version_full = env['BUILD_VERSION_FULL']

    @packages.each do |package|
      Dir[File.join('dist', 'nuget', "#{package}.#{build_version_full}.nupkg")].each do |source_file|
        push File.expand_path(source_file)
      end
    end
  end
end

#package(package) ⇒ Object



21
22
23
# File 'lib/bozo/publishers/nuget.rb', line 21

def package(package)
  @packages << package
end

#server(server) ⇒ Object



13
14
15
# File 'lib/bozo/publishers/nuget.rb', line 13

def server(server)
  @server = server
end