Skip to content

Commit

Permalink
Generate version automatically
Browse files Browse the repository at this point in the history
Generate the version used in require-stack-version example automatically from
the version info exported by Paths_stack.

Also added extra-dep example under packages
  • Loading branch information
harendra-kumar committed Feb 28, 2016
1 parent 6bde2e2 commit 6e58c52
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Stack/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ import Data.Monoid
import qualified Data.Text as T
import qualified Data.Yaml as Yaml
import qualified Distribution.PackageDescription as C
import qualified Distribution.Text as C
import qualified Distribution.Version as C
import Network.HTTP.Client.Conduit (HasHttpManager)
import Path
import Path.IO
import qualified Paths_stack as Meta
import Stack.BuildPlan
import Stack.Config (getSnapshots,
makeConcreteResolver)
Expand Down Expand Up @@ -266,6 +269,7 @@ renderStackYaml p ignoredPackages dupPackages =
, " git: https://github.com/commercialhaskell/stack.git"
, " commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a"
, "- location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a"
, " extra-dep: true"
, " subdirs:"
, " - auto-update"
, " - wai"
Expand All @@ -275,13 +279,17 @@ renderStackYaml p ignoredPackages dupPackages =
, "will not be run. This is useful for tweaking upstream packages."
]

footerHelp = commentHelp
footerHelp =
let major = toCabalVersion
$ toMajorVersion $ fromCabalVersion Meta.version
in commentHelp
[ "Control whether we use the GHC we find on the path"
, "system-ghc: true"
, ""
, "Require a specific version of stack, using version ranges"
, "require-stack-version: -any # Default"
, "require-stack-version: >= 1.0.0"
, "require-stack-version: \""
++ C.display (C.orLaterVersion major) ++ "\""
, ""
, "Override the architecture used by stack, especially useful on Windows"
, "arch: i386"
Expand Down

0 comments on commit 6e58c52

Please sign in to comment.