class Bookwatch::Commands::Collection

Attributes

streams[R]
version_control_system[R]

Public Class Methods

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

Public Instance Methods

bind(*args) click to toggle source
# File lib/bookwatch/commands/collection.rb, line 64
def bind(*args)
  @bind ||= Commands::Bind.new(
    streams,
    middleman_runner: runner,
    output_locations: output_locations,
    config_fetcher: configuration_fetcher(Config::Configuration),
    config_decorator: Config::ConfigurationDecorator.new(loader: config_loader, config_filename: 'bookwatch.yml'),
    file_system_accessor: local_filesystem_accessor,
    link_checker: Postprocessing::LinkChecker.new(local_filesystem_accessor, final_app_directory, streams),
    preprocessor: Preprocessing::Preprocessor.new(
      Preprocessing::DitaHTMLPreprocessor.new(
        local_filesystem_accessor,
        subnav_generator_factory,
        DitaHtmlForMiddlemanFormatter.new(local_filesystem_accessor, html_document_manipulator),
        dita_command_creator,
        sheller
      ),
      Preprocessing::LinkToSiteGenDir.new(local_filesystem_accessor, subnav_generator_factory)
    ),
    cloner_factory: Ingest::ClonerFactory.new(streams, local_filesystem_accessor, version_control_system),
    section_repository: Ingest::SectionRepository.new,
    directory_preparer: directory_preparer
  ).run(*args)
end
generate(*args) click to toggle source
# File lib/bookwatch/commands/collection.rb, line 39
def generate(*args)
  Commands::Generate.new(
    local_filesystem_accessor,
    sheller,
    Dir.pwd,
    streams
  ).run(*args)
end
imprint(*args) click to toggle source
# File lib/bookwatch/commands/collection.rb, line 105
def imprint(*args)
  Bookwatch::Commands::Imprint.new(
    streams,
    output_locations: output_locations,
    config_fetcher: configuration_fetcher(Config::Imprint::Configuration),
    preprocessor: Preprocessing::Preprocessor.new(Preprocessing::DitaPDFPreprocessor.new(local_filesystem_accessor, dita_command_creator, sheller)),
    cloner_factory: Ingest::ClonerFactory.new(streams, local_filesystem_accessor, version_control_system),
    section_repository: Ingest::SectionRepository.new,
    directory_preparer: Commands::Components::Imprint::DirectoryPreparer.new(local_filesystem_accessor)
  ).run(*args)
end
punch(*args) click to toggle source
# File lib/bookwatch/commands/collection.rb, line 48
def punch(*args)
  Commands::Punch.new(
    streams,
    configuration_fetcher(Config::Configuration),
    version_control_system
  ).run(*args)
end
update_local_doc_repos() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 56
def update_local_doc_repos
  Commands::UpdateLocalDocRepos.new(
    streams,
    configuration_fetcher(Config::Configuration),
    version_control_system
  ).run
end
watch(repos=[]) click to toggle source
# File lib/bookwatch/commands/collection.rb, line 89
def watch(repos=[])
  @watch ||= Commands::Watch.new(
    streams,
    middleman_runner: runner,
    output_locations: output_locations,
    config_fetcher: configuration_fetcher(Config::Configuration),
    config_decorator: Config::ConfigurationDecorator.new(loader: config_loader, config_filename: 'bookwatch.yml'),
    file_system_accessor: local_filesystem_accessor,
    preprocessor: Preprocessing::Preprocessor.new(Preprocessing::LinkToSiteGenDir.new(local_filesystem_accessor, subnav_generator_factory)),
    cloner: local_file_system_cloner,
    section_repository: Ingest::SectionRepository.new,
    directory_preparer: directory_preparer,
    repo_restrictions: repos
  ).run
end

Private Instance Methods

config_loader() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 136
def config_loader
  @config_loader ||= Config::YAMLLoader.new
end
configuration_fetcher(config_class) click to toggle source
# File lib/bookwatch/commands/collection.rb, line 125
def configuration_fetcher(config_class)
  Bookwatch::Config::Fetcher.new(
    Bookwatch::Config::Validator.new(local_filesystem_accessor),
    config_loader,
    config_class
  ).tap do |fetcher|
    fetcher.set_config_file_path './config.yml'
    fetcher.set_config_dir_path './config/'
  end
end
directory_preparer() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 144
def directory_preparer
  Commands::Components::Bind::DirectoryPreparer.new(local_filesystem_accessor)
end
dita_command_creator() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 121
def dita_command_creator
  DitaCommandCreator.new(ENV['PATH_TO_DITA_OT_LIBRARY'])
end
final_app_directory() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 152
def final_app_directory
  @final_app_directory ||= File.absolute_path('final_app')
end
html_document_manipulator() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 156
def html_document_manipulator
  @html_document_manipulator ||= HtmlDocumentManipulator.new
end
local_file_system_cloner() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 176
def local_file_system_cloner
  Ingest::LocalFilesystemCloner.new(streams, local_filesystem_accessor, File.expand_path('..'))
end
local_filesystem_accessor() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 160
def local_filesystem_accessor
  @local_filesystem_accessor ||= LocalFilesystemAccessor.new
end
output_locations() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 148
def output_locations
  OutputLocations.new(final_app_dir: final_app_directory, context_dir: File.absolute_path('.'))
end
runner() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 172
def runner
  MiddlemanRunner.new(local_filesystem_accessor, sheller)
end
sheller() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 164
def sheller
  @sheller ||= Sheller.new
end
sitemap_port() click to toggle source
# File lib/bookwatch/commands/collection.rb, line 168
def sitemap_port
  41722
end
subnav_generator_factory() click to toggle source