Class: Bookwatch::Ingest::LocalFilesystemCloner

Inherits:
Object
  • Object
show all
Defined in:
lib/bookwatch/ingest/local_filesystem_cloner.rb

Instance Method Summary collapse

Constructor Details

#initialize(streams, filesystem, user_repo_dir) ⇒ LocalFilesystemCloner

Returns a new instance of LocalFilesystemCloner.



8
9
10
11
12
# File 'lib/bookwatch/ingest/local_filesystem_cloner.rb', line 8

def initialize(streams, filesystem, user_repo_dir)
  @streams = streams
  @user_repo_dir = user_repo_dir
  @filesystem = filesystem
end

Instance Method Details

#call(source_repo_name: nil, source_ref: nil, destination_parent_dir: nil, destination_dir_name: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bookwatch/ingest/local_filesystem_cloner.rb', line 14

def call(source_repo_name: nil,
         source_ref: nil,
         destination_parent_dir: nil,
         destination_dir_name: nil)
  link!(
    source_repo_name,
    Pathname(user_repo_dir).join(source_repo_name.split('/').last),
    Pathname(destination_parent_dir).join(DestinationDirectory.new(source_repo_name, destination_dir_name)),
    source_ref,
    source_repo_name.split('/').first
  )
end