Class: Omnibus::Publisher

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/omnibus/publisher.rb

Direct Known Subclasses

ArtifactoryPublisher, NullPublisher, S3Publisher

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

included

Constructor Details

#initialize(pattern, options = {}) ⇒ Publisher

Create a new publisher from the given pattern.


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/omnibus/publisher.rb', line 41

def initialize(pattern, options = {})
  @pattern = pattern
  @options = options.dup

  if @options[:platform]
    log.warn(log_key) do
      "Publishing platform has been overriden to '#{@options[:platform]}'"
    end
  end

  if @options[:platform_version]
    log.warn(log_key) do
      "Publishing platform version has been overriden to '#{@options[:platform_version]}'"
    end
  end
end

Class Method Details

.publish(pattern, options = {}, &block) ⇒ Object

Shortcut class method for creating a new instance of this class and executing the publishing sequence.


26
27
28
# File 'lib/omnibus/publisher.rb', line 26

def publish(pattern, options = {}, &block)
  new(pattern, options).publish(&block)
end

Instance Method Details

#packagesArray<String>

The list of packages that match the pattern in the initializer.


63
64
65
# File 'lib/omnibus/publisher.rb', line 63

def packages
  @packages ||= FileSyncer.glob(@pattern).map { |path| Package.new(path) }
end

#publish(&_block) ⇒ Array<String>

This method is abstract.

Returns the list of uploaded packages

Raises:

  • (NotImplementedError)

76
77
78
# File 'lib/omnibus/publisher.rb', line 76

def publish(&_block)
  raise NotImplementedError
end