Class: Bookbinder::Commands::Collection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bookbinder/commands/collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(streams, version_control_system) ⇒ Collection

Returns a new instance of Collection.



34
35
36
37
# File 'lib/bookbinder/commands/collection.rb', line 34

def initialize(streams, version_control_system)
  @streams = streams
  @version_control_system = version_control_system
end

Instance Method Details

#bind(*args) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/bookbinder/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: 'bookbinder.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) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/bookbinder/commands/collection.rb', line 39

def generate(*args)
  Commands::Generate.new(
    local_filesystem_accessor,
    sheller,
    Dir.pwd,
    streams
  ).run(*args)
end

#imprint(*args) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
# File 'lib/bookbinder/commands/collection.rb', line 105

def imprint(*args)
  Bookbinder::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) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/bookbinder/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_reposObject



56
57
58
59
60
61
62
# File 'lib/bookbinder/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 = []) ⇒ Object



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/bookbinder/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: 'bookbinder.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