Sha256: 338ba542d718f3116602bbeeb8577f02051c47e2b294cc2032743194f81b90ac

Contents?: true

Size: 1.27 KB

Versions: 19

Compression:

Stored size: 1.27 KB

Contents

require 'fileutils'

module Bozo::Publishers

  # Publisher that pushes package to nuget
  class Nuget

    def initialize
      @packages = []
    end

    def server(server)
      @server = server
    end

    def api_key(api_key)
      @api_key = api_key
    end

    def package(package)
      @packages << package
    end

    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

    private

    def push(source_file)
      args = []
      args << File.expand_path(File.join('build', 'tools', 'nuget', 'NuGet.exe'))
      args << "push"
      args << "\"#{source_file}\""
      args << "-s #{@server}"

      if !@api_key.nil?
        args << "\"#{@api_key}\""
      end
      execute_command :nuget, args
    end
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
bozo-scripts-0.18.2 lib/bozo/publishers/nuget.rb
bozo-scripts-0.18.1 lib/bozo/publishers/nuget.rb
bozo-scripts-0.18.0 lib/bozo/publishers/nuget.rb
bozo-scripts-0.17.0 lib/bozo/publishers/nuget.rb
bozo-scripts-0.16.3 lib/bozo/publishers/nuget.rb
bozo-scripts-0.16.2 lib/bozo/publishers/nuget.rb
bozo-scripts-0.16.1 lib/bozo/publishers/nuget.rb
bozo-scripts-0.16.0 lib/bozo/publishers/nuget.rb
bozo-scripts-0.15.0 lib/bozo/publishers/nuget.rb
bozo-scripts-0.14.0 lib/bozo/publishers/nuget.rb
bozo-scripts-0.13.0 lib/bozo/publishers/nuget.rb
bozo-scripts-0.12.0 lib/bozo/publishers/nuget.rb
bozo-scripts-0.11.0 lib/bozo/publishers/nuget.rb
bozo-scripts-0.10.6 lib/bozo/publishers/nuget.rb
bozo-scripts-0.10.5 lib/bozo/publishers/nuget.rb
bozo-scripts-0.10.4 lib/bozo/publishers/nuget.rb
bozo-scripts-0.10.3 lib/bozo/publishers/nuget.rb
bozo-scripts-0.10.2 lib/bozo/publishers/nuget.rb
bozo-scripts-0.10.1 lib/bozo/publishers/nuget.rb