class Emeril::Releaser
Tags a git commit with a version string and (optionally) pushes the cookbook to the Community Site.
@author Fletcher Nichol <fnichol@nichol.ca>
Constants
- DEFAULT_CATEGORY
Attributes
Public Class Methods
Creates a new instance.
@param [Hash] options configuration for a releaser @option options [Logger] an optional logger instance @option options [String] source_path
the path to a git repository @option options [Hash] metadata a hash of cookbook metadata @option options [String] category a Community Site category for the
cookbook
@option options [GitTagger] git_tagger
a git tagger @option options [Publisher] publisher a publisher @option options [Boolean] publish_to_community a boolean which
controls if the cookbook will published on the Community Site, now the Supermarket site (the default is to publish)
@option options [Boolean] publish_to_supermarket
a boolean which
controls if the cookbook will published on the Supermarket site (the default is to publish)
@raise [ArgumentError] if any required options are not set
# File lib/emeril/releaser.rb, line 34 def initialize(options = {}) @logger = options[:logger] @tag_prefix = options[:tag_prefix] @source_path = options.fetch(:source_path, Dir.pwd) @metadata = options.fetch(:metadata) { default_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
Public Instance Methods
Tags and releases a cookbook.
# File lib/emeril/releaser.rb, line 50 def run git_tagger.run publisher.run if publish_to_supermarket end
Private Instance Methods
# File lib/emeril/releaser.rb, line 91 def default_category Category.for_cookbook(metadata[:name]) || "Other" end
# File lib/emeril/releaser.rb, line 67 def default_git_tagger GitTagger.new( :logger => logger, :source_path => source_path, :version => metadata[:version], :tag_prefix => tag_prefix ) end
# File lib/emeril/releaser.rb, line 62 def default_metadata metadata_file = File.expand_path(File.join(source_path, "metadata.rb")) MetadataChopper.new(metadata_file) end
# File lib/emeril/releaser.rb, line 76 def default_publisher Publisher.new( :logger => logger, :source_path => source_path, :name => metadata[:name], :category => category ) end
# File lib/emeril/releaser.rb, line 85 def setup_publisher(publisher) return unless publish_to_supermarket @publisher = publisher || default_publisher end