Skip to content

Commit

Permalink
Add --redirects switch for "paket add".
Browse files Browse the repository at this point in the history
  • Loading branch information
cr7pt0gr4ph7 committed May 28, 2015
1 parent 0f30497 commit f465226
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Paket.Core/PublicAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,31 @@ type Dependencies(dependenciesFileName: string) =
member this.Add(package: string): unit = this.Add(package,"")

/// Adds the given package with the given version to the dependencies file.
member this.Add(package: string,version: string): unit = this.Add(package, version, false, false, false, true)
member this.Add(package: string,version: string): unit =
this.Add(package, version, force = false, hard = false, redirects = false, interactive = false, installAfter = true)

/// Adds the given package with the given version to the dependencies file.
member this.Add(package: string,version: string,force: bool,hard: bool,interactive: bool,installAfter: bool): unit =
this.Add(package, version, force, hard, false, interactive, installAfter)

/// Adds the given package with the given version to the dependencies file.
member this.Add(package: string,version: string,force: bool,hard: bool,redirects: bool,interactive: bool,installAfter: bool): unit =
Utils.RunInLockedAccessMode(
this.RootPath,
fun () -> AddProcess.Add(dependenciesFileName, PackageName(package.Trim()), version,
InstallerOptions.createLegacyOptions(force, hard, false),
InstallerOptions.createLegacyOptions(force, hard, redirects),
interactive, installAfter))

/// Adds the given package with the given version to the dependencies file.
member this.AddToProject(package: string,version: string,force: bool,hard: bool,projectName: string,installAfter: bool): unit =
this.AddToProject(package, version, force, hard, false, projectName, installAfter)

/// Adds the given package with the given version to the dependencies file.
member this.AddToProject(package: string,version: string,force: bool,hard: bool,redirects: bool,projectName: string,installAfter: bool): unit =
Utils.RunInLockedAccessMode(
this.RootPath,
fun () -> AddProcess.AddToProject(dependenciesFileName, PackageName package, version,
InstallerOptions.createLegacyOptions(force, hard, false),
InstallerOptions.createLegacyOptions(force, hard, redirects),
projectName, installAfter))

/// Adds credentials for a Nuget feed
Expand Down Expand Up @@ -355,4 +364,4 @@ type Dependencies(dependenciesFileName: string) =
if String.IsNullOrEmpty apiKey then
failwithf "Could not push package %s. Please specify a NuGet API key via environment variable \"nugetkey\"." packageFileName
let maxTrials = defaultArg maxTrials 5
RemoteUpload.Push maxTrials urlWithEndpoint apiKey packageFileName
RemoteUpload.Push maxTrials urlWithEndpoint apiKey packageFileName
2 changes: 2 additions & 0 deletions src/Paket/Commands.fs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type AddArgs =
| [<AltCommandLine("-f")>] Force
| [<AltCommandLine("-i")>] Interactive
| Hard
| Redirects
| No_Install
with
interface IArgParserTemplate with
Expand All @@ -75,6 +76,7 @@ with
| Force -> "Forces the download and reinstallation of all packages."
| Interactive -> "Asks the user for every project if he or she wants to add the package to the projects's paket.references file."
| Hard -> "Replaces package references within project files even if they are not yet adhering to the Paket's conventions (and hence considered manually managed)."
| Redirects -> "Creates binding redirects for the NuGet packages."
| No_Install -> "Skips paket install --hard process afterward generation of dependencies / references files."

type ConfigArgs =
Expand Down
1 change: 1 addition & 0 deletions src/Paket/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ let add (results : ArgParseResults<_>) =
let version = defaultArg (results.TryGetResult <@ AddArgs.Version @>) ""
let force = results.Contains <@ AddArgs.Force @>
let hard = results.Contains <@ AddArgs.Hard @>
let redirects = results.Contains <@ AddArgs.Redirects @>
let noInstall = results.Contains <@ AddArgs.No_Install @>
match results.TryGetResult <@ AddArgs.Project @> with
| Some projectName ->
Expand Down

0 comments on commit f465226

Please sign in to comment.