class Bookwatch::Commands::Punch

Attributes

configuration_fetcher[R]
streams[R]
version_control_system[R]

Public Class Methods

new(streams, configuration_fetcher, version_control_system) click to toggle source
# File lib/bookwatch/commands/punch.rb, line 4
def initialize(streams, configuration_fetcher, version_control_system)
  @streams = streams
  @configuration_fetcher = configuration_fetcher
  @version_control_system = version_control_system
end

Public Instance Methods

run((tag, *)) click to toggle source
# File lib/bookwatch/commands/punch.rb, line 10
def run((tag, *))
  urls(config).each do |url|
    version_control_system.remote_tag(url, tag, 'HEAD')
  end

  streams[:success].puts 'Success!'
  streams[:out].puts "#{config.book_repo} and its sections were tagged with #{tag}"
  0
end

Private Instance Methods

config() click to toggle source
# File lib/bookwatch/commands/punch.rb, line 28
def config
  @config ||= configuration_fetcher.fetch_config
end
urls(config) click to toggle source
# File lib/bookwatch/commands/punch.rb, line 24
def urls(config)
  [config.book_repo_url, config.layout_repo_url] + config.sections.map(&:repo_url).uniq
end