Sha256: 0f15cf201671b5b636dac6758553dd912153bd7e6a49c5c4f62cdead8c4f8e94

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 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.1.3 lib/itrigga/cap_deploy/filesystem_utils.rb
itrigga-cap_deploy-0.1.1 lib/itrigga/cap_deploy/filesystem_utils.rb
itrigga-cap_deploy-0.1.0 lib/itrigga/cap_deploy/filesystem_utils.rb