Class: Bookbinder::Ingest::SectionRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/bookbinder/ingest/section_repository.rb

Instance Method Summary collapse

Instance Method Details

#fetch(configured_sections: [], destination_dir: nil, ref_override: nil, cloner: nil, streams: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bookbinder/ingest/section_repository.rb', line 8

def fetch(configured_sections: [],
          destination_dir: nil,
          ref_override: nil,
          cloner: nil,
          streams: nil)
  configured_sections.map do |section_config|
    streams[:success].puts("Gathering #{section_config.repo_name}")
    working_copy = cloner.call(source_repo_name: section_config.repo_name,
                               source_ref: ref_override || section_config.repo_ref,
                               destination_parent_dir: destination_dir,
                               destination_dir_name: section_config.desired_directory_name)
    Section.new(
      working_copy.path,
      working_copy.full_name,
      section_config.desired_directory_name,
      section_config.subnav_template,
      section_config.preprocessor_config
    )
  end
end