ForNeVeR / ForNeVeR/Fabricator
Sync command
- Dominant language
- F#
- Stars
- 18
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Generaptor should be able to sync target folder's contents with virtual source, similar to how Gradle's `Sync` task does this: it should update the different files and remove the redundant ones, effectively making the target identical to the (virtual, composed from multiple sources) source folder.
### Additional example from #81
>Having this:
>```
>let installShawl = [
> downloadFile(shawlUrl, shawlHash, shawlDownloadCache)
> unpackArchive(shawlDownloadCache, shawlHash, shawlExecutable.Parent.Value)
>]
>```
>
>When re-downloading a new version of the same archive to the same place, it fails with
>```
>Unpack archive "T:\Temp\fabricator\download-cache\shawl-v1.8.0-win64.zip" to "C:\Programs\shawl": applying… error:
>System.IO.IOException: The file 'C:\Programs\shawl\shawl.exe' already exists.
> at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
> at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
> at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
> at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
> at System.IO.FileStream..ctor(String path, FileStreamOptions options)
> at System.IO.Compression.ZipFileExtensions.ExtractToFile(ZipArchiveEntry source, String destinationFileName, Boolean overwrite)
> at System.IO.Compression.ZipFileExtensions.ExtractToDirectory(ZipArchive source, String destinationDirectoryName, Boolean overwriteFiles)
> at System.IO.Compression.ZipFile.ExtractToDirectory(String sourceArchiveFileName, String destinationDirectoryName, Encoding entryNameEncoding, Boolean overwriteFiles)
> at Fabricator.Resources.Archive.unpackArchive@35-6.Invoke(Sha256Hash hash)
> at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, b result1, FSharpFunc`2 userCode) in D:\a\_work\1\s\src\fsharp\src\FSharp.Core\async.fs:line 527
> at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in D:\a\_work\1\s\src\fsharp\src\FSharp.Core\async.fs:line 112
>```
>
>Let's introduce some way of handling this upgrade, some sort of strategy — either move the old folder aside or outright destroy it.
Contributor guide
Research direction
Start by locating the Sync command implementation and the unpackArchive operation referenced in the example. Trace how the virtual source is composed and how target contents are updated today. Done means the target matches the composed source, including updated files and removal or handling of redundant files during upgrades.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- devops, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100