Sha256: aecb92f3c5cc6270112e8301522d534eed0a21daebba9bb72327f52582a4a4ec

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

def symlink_dir(from, to)
  run "test -L #{to} || ( #{sudo} find #{to} -mindepth 1 -print | xargs -i mv {} #{from} && #{sudo} rm -rf #{to} && #{sudo} ln -s #{from} #{to} )"
end

def delete_files_from_dir1_which_exist_in_dir2(delete_from_dir, exist_in_dir)
  run "find #{exist_in_dir} -type f  | xargs -n1 basename | xargs -I{} bash -c 'test -f #{delete_from_dir}/{} && rm -v #{delete_from_dir}/{} || echo no file #{delete_from_dir}/{} to delete'"
end

def symlink_files_in_dir(from_dir,to_dir)  
  delete_files_from_dir1_which_exist_in_dir2(to_dir, from_dir)
  
  run "(#{sudo} test -d #{from_dir} && ( find #{from_dir}/ -mindepth 1  -print | xargs --verbose #{sudo} ln -s -f -t #{to_dir} ) ) || echo 'nothing to link'"
end

def mkdir_unless_exists( dir )
  run "test -d #{dir} || #{sudo} mkdir -p #{dir}"
end

def symlink_dir(from, to)
  run "test -L #{to} || ( #{sudo} find #{to} -mindepth 1 -print | xargs -i mv {} #{from} && #{sudo} rm -rf #{to} && #{sudo} ln -s #{from} #{to} )"
end

def mkdir_unless_exists( dir )
  run "test -d #{dir} || #{sudo} mkdir -p #{dir}"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itrigga-cap_deploy-0.0.4 lib/itrigga/cap_deploy/filesystem_utils.rb
itrigga-cap_deploy-0.0.3 lib/itrigga/cap_deploy/filesystem_utils.rb
itrigga-cap_deploy-0.0.2 lib/itrigga/cap_deploy/filesystem_utils.rb