Class: Bookwatch::Commands::Components::Bind::LayoutPreparer

Inherits:
Object
  • Object
show all
Defined in:
lib/bookwatch/commands/components/bind/layout_preparer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fs) ⇒ LayoutPreparer

Returns a new instance of LayoutPreparer.



6
7
8
# File 'lib/bookwatch/commands/components/bind/layout_preparer.rb', line 6

def initialize(fs)
  @fs = fs
end

Instance Attribute Details

#fsObject (readonly)

Returns the value of attribute fs.



10
11
12
# File 'lib/bookwatch/commands/components/bind/layout_preparer.rb', line 10

def fs
  @fs
end

Instance Method Details

#prepare(output_locations, cloner, ref_override, config) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bookwatch/commands/components/bind/layout_preparer.rb', line 12

def prepare(output_locations, cloner, ref_override, config)
  if config.has_option?('layout_repo')

    cloned_repo = cloner.call(source_repo_name: config.layout_repo,
                              source_ref: ref_override || config.layout_repo_ref,
                              destination_parent_dir: Dir.mktmpdir)

    fs.copy_contents(cloned_repo.path, output_locations.site_generator_home)
  end
  fs.copy_contents(File.absolute_path('master_middleman'), output_locations.site_generator_home)
end