Module: DTR::SyncCodebase::SyncService

Includes:
DTR::Service::File, Package
Included in:
WorkingEnvExt
Defined in:
lib/dtr/shared/sync_codebase/sync_service.rb

Instance Method Summary collapse

Methods included from DTR::Service::File

#lookup_file, #provide_file

Methods included from DTR::Service::Rinda

#lookup, #lookup_ring, #start_service, #stop_service

Methods included from Package

#do_work, #package_cmd, #package_copy_file, #package_dir, #package_dir_path, #package_file, #package_name, #unpackage_cmd

Instance Method Details

#sync_codebaseObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dtr/shared/sync_codebase/sync_service.rb', line 20

def sync_codebase
  DTR.info("Start sync codebase, clean #{File.join(Dir.pwd, package_name)}")
  FileUtils.rm_rf(File.join(Dir.pwd, package_name))

  DTR.info("Lookup codebase package file")
  package = lookup_file
  DTR.info("Receiving package file and writing to #{package_copy_file}")
  File.open(package_copy_file, 'w') do |f|
    package.copy_into(f)
  end
  do_work(unpackage_cmd)
  DTR.info("sync codebase finished, clean #{package_copy_file}")
  FileUtils.rm_f(package_copy_file)
end