Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http links #428

Merged
merged 2 commits into from
Dec 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions src/Paket.Core/ModuleResolver.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,28 @@ type ResolvedSourceFile =
let di = DirectoryInfo(Path.Combine(Constants.PaketFilesFolderName, this.Owner, this.Project, path))
di.FullName

override this.ToString() = sprintf "%s/%s:%s %s" this.Owner this.Project this.Commit this.Name
override this.ToString() = sprintf "%s/%s:%s %s" this.Owner this.Project this.Commit this.Name

let resolve getDependencies getSha1 (file : UnresolvedSourceFile) : ResolvedSourceFile =
let sha =
defaultArg file.Commit "master"
|> getSha1 file.Origin file.Owner file.Project

let resolved =
{ Commit = sha
Owner = file.Owner
Origin = file.Origin
Project = file.Project
Dependencies = Set.empty
Name = file.Name }

let dependencies =
getDependencies resolved
|> List.map (fun (package:PackageRequirement) -> package.Name, package.VersionRequirement)
|> Set.ofList

{ resolved with Dependencies = dependencies }

// TODO: github has a rate limit - try to convince them to whitelist Paket
let Resolve(getPackages, getSha1, remoteFiles : UnresolvedSourceFile list) : ResolvedSourceFile list =
remoteFiles |> List.map (fun file ->
let sha =
file.Commit
|> defaultArg <| "master"
|> getSha1 file.Origin file.Owner file.Project

let naked =
{ Commit = sha
Owner = file.Owner
Origin = file.Origin
Project = file.Project
Dependencies = Set.empty
Name = file.Name }
let packages:PackageRequirement list = getPackages naked

{naked with Dependencies = packages |> Seq.fold (fun set package -> Set.add (package.Name,package.VersionRequirement) set) Set.empty })
let Resolve(getDependencies, getSha1, remoteFiles : UnresolvedSourceFile list) : ResolvedSourceFile list =
remoteFiles |> List.map (resolve getDependencies getSha1)
2 changes: 1 addition & 1 deletion src/Paket.Core/RemoteDownload.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let downloadDependenciesFile(rootPath,remoteFile:ModuleResolver.ResolvedSourceFi
rawFileUrl remoteFile.Owner remoteFile.Project remoteFile.Commit dependenciesFileName
| ModuleResolver.GistLink ->
rawGistFileUrl remoteFile.Owner remoteFile.Project dependenciesFileName
| ModuleResolver.HttpLink url -> sprintf "%s" url
| ModuleResolver.HttpLink url -> url.Replace(remoteFile.Name,Constants.DependenciesFileName)
let! result = safeGetFromUrl(None,url)

match result with
Expand Down
4 changes: 2 additions & 2 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
<WarningLevel>3</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<StartArguments>update</StartArguments>
<StartArguments>update -f</StartArguments>
<StartAction>Project</StartAction>
<StartProgram>paket.exe</StartProgram>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\Paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\PaketTest</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down