Skip to content

Commit

Permalink
Downlod of GitHub files should clean it's own directory - fixes #385
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Nov 23, 2014
1 parent 19432e3 commit 34e9d4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 0.16.0-alpha003 - 23.11.2014
* Downlod of GitHub files should clean it's own directory - https://github.com/fsprojects/Paket/issues/385

#### 0.16.0-alpha002 - 23.11.2014
* Integrate BindingRedirects into Paket install process - https://github.com/fsprojects/Paket/pull/383

Expand Down
7 changes: 3 additions & 4 deletions src/Paket.Core/RemoteDownload.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ open Newtonsoft.Json.Linq
open System.IO
open Ionic.Zip
open Paket.Logging
open Paket.ModuleResolver

[<Literal>]
let FullProjectSourceFileName = "FULLPROJECT"
Expand Down Expand Up @@ -67,7 +68,6 @@ let rec DirectoryCopy(sourceDirName, destDirName, copySubDirs) =
let dir = new DirectoryInfo(sourceDirName)
let dirs = dir.GetDirectories()


if not <| Directory.Exists(destDirName) then
Directory.CreateDirectory(destDirName) |> ignore

Expand All @@ -78,7 +78,6 @@ let rec DirectoryCopy(sourceDirName, destDirName, copySubDirs) =
if copySubDirs then
for subdir in dirs do
DirectoryCopy(subdir.FullName, Path.Combine(destDirName, subdir.Name), copySubDirs)
open ModuleResolver

/// Gets a single file from github.
let downloadRemoteFiles(remoteFile:ResolvedSourceFile,destination) = async {
Expand Down Expand Up @@ -118,7 +117,6 @@ let downloadRemoteFiles(remoteFile:ResolvedSourceFile,destination) = async {
DirectoryCopy(source,projectPath,true)

Directory.Delete(source,true)

| SingleSourceFileOrigin.GistLink, _ -> return! downloadFromUrl(None,rawGistFileUrl remoteFile.Owner remoteFile.Project remoteFile.Name) destination
| SingleSourceFileOrigin.GitHubLink, _ -> return! downloadFromUrl(None,rawFileUrl remoteFile.Owner remoteFile.Project remoteFile.Commit remoteFile.Name) destination
| SingleSourceFileOrigin.HttpLink(url), _ -> return! downloadFromUrl(None,sprintf "%s" url) destination
Expand All @@ -139,7 +137,8 @@ let DownloadSourceFile(rootPath, source:ModuleResolver.ResolvedSourceFile) =
else
tracefn "Downloading %s to %s" (source.ToString()) destination

Directory.CreateDirectory(destination |> Path.GetDirectoryName) |> ignore
CleanDir (destination |> Path.GetDirectoryName)

do! downloadRemoteFiles(source,destination)
File.WriteAllText(versionFile.FullName, source.Commit)
}

0 comments on commit 34e9d4e

Please sign in to comment.