Class: Emeril::Releaser

Inherits:
Object
  • Object
show all
Defined in:
lib/emeril/releaser.rb

Overview

Tags a git commit with a version string and (optionally) pushes the cookbook to the Community Site.

Author:

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Releaser

Creates a new instance.

Parameters:

  • options (Hash) (defaults to: {})

    configuration for a releaser

Options Hash (options):

  • an (Logger)

    optional logger instance

  • source_path (String)

    the path to a git repository

  • metadata (Hash)

    a hash of cookbook metadata

  • category (String)

    a Community Site category for the cookbook

  • git_tagger (GitTagger)

    a git tagger

  • publisher (Publisher)

    a publisher

  • publish_to_community (Boolean)

    a boolean which controls if the cookbook will published on the Community Site, now the Supermarket site (the default is to publish)

  • publish_to_supermarket (Boolean)

    a boolean which controls if the cookbook will published on the Supermarket site (the default is to publish)

Raises:

  • (ArgumentError)

    if any required options are not set



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/emeril/releaser.rb', line 35

def initialize(options = {})
  @logger = options[:logger]
  @tag_prefix = options[:tag_prefix]
  @source_path = options.fetch(:source_path, Dir.pwd)
  @metadata = options.fetch(:metadata) {  }
  @category = options.fetch(:category) { default_category }
  @git_tagger = options.fetch(:git_tagger) { default_git_tagger }
  @publish_to_supermarket = options.fetch(
    :publish_to_supermarket,
    options.fetch(:publish_to_community, true)
  )
  setup_publisher(options.fetch(:publisher, nil))
end

Instance Method Details

#runObject

Tags and releases a cookbook.



51
52
53
54
# File 'lib/emeril/releaser.rb', line 51

def run
  git_tagger.run
  publisher.run if publish_to_supermarket
end