-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
208 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
module ARCtrl.Contract.Git | ||
|
||
open ARCtrl.Contract | ||
|
||
let [<Literal>] git = @"git" | ||
let [<Literal>] defaultBranch = @"main" | ||
let [<Literal>] gitignoreFileName = @".gitignore" | ||
|
||
let gitWithArgs(arguments : string []) = CLITool.create(git,arguments) | ||
|
||
let createGitContractAt path arguments = Contract.createExecute(gitWithArgs(arguments),path) | ||
|
||
let createGitContract(arguments) = Contract.createExecute(gitWithArgs(arguments)) | ||
|
||
let gitignoreContract = Contract.createCreate(gitignoreFileName,DTOType.PlainText,DTO.Text ARCtrl.FileSystem.DefaultGitignore.dgi) | ||
|
||
type Init = | ||
|
||
static member init = "init" | ||
static member branchFlag = "-b" | ||
|
||
static member remote = @"remote" | ||
static member add = @"add" | ||
static member origin = @"origin" | ||
|
||
static member createInitContract(?branch : string) = | ||
let branch = Option.defaultValue defaultBranch branch | ||
createGitContract([|Init.init;Init.branchFlag;branch|]) | ||
|
||
static member createAddRemoteContract(remoteUrl : string) = | ||
createGitContract([|Init.remote;Init.add;Init.origin;remoteUrl|]) | ||
|
||
and Clone = | ||
|
||
static member clone = "clone" | ||
|
||
static member branchFlag = "-b" | ||
|
||
static member noLFSConfig = "-c \"filter.lfs.smudge = git-lfs smudge --skip -- %f\" -c \"filter.lfs.process = git-lfs filter-process --skip\"" | ||
|
||
static member formatRepoString username pass (url : string) = | ||
let comb = username + ":" + pass + "@" | ||
url.Replace("https://","https://" + comb) | ||
|
||
static member createCloneContract(remoteUrl : string,?merge : bool ,?branch : string,?token : string*string,?nolfs : bool) = | ||
let nolfs = Option.defaultValue false nolfs | ||
let merge = Option.defaultValue false merge | ||
let remoteUrl = | ||
match token with | ||
| Some (username,pass) -> Clone.formatRepoString username pass remoteUrl | ||
| None -> remoteUrl | ||
createGitContract([| | ||
Clone.clone | ||
if nolfs then Clone.noLFSConfig | ||
if branch.IsSome then Clone.branchFlag | ||
if branch.IsSome then branch.Value | ||
remoteUrl | ||
if merge then "." | ||
|]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
module ARCtrl.FileSystem.DefaultGitignore | ||
|
||
let dgi = """# ----- macos rules ----- | ||
# taken from https://github.com/github/gitignore/blob/main/Global/macOS.gitignore | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
# Icon must end with two \r | ||
Icon | ||
# Thumbnails | ||
._* | ||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
# ----- windows rules ----- | ||
# taken from https://github.com/github/gitignore/blob/main/Global/Windows.gitignore | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
# Dump file | ||
*.stackdump | ||
# Folder config file | ||
[Dd]esktop.ini | ||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
# Windows shortcuts | ||
*.lnk | ||
# ----- linux rules ----- | ||
# taken from https://github.com/github/gitignore/blob/main/Global/Linux.gitignore | ||
*~ | ||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
# KDE directory preferences | ||
.directory | ||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters