git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Only try "bower.cmd" on Windows
commit8e6a45596b62075b53447325a85d16d1e61b9989 authorHarry Garrood <harry@garrood.me> dateMon 3 Aug 2015, 13:42 (11 years ago) parenta8556ff
2 files changed+11−6
src/Language/PureScript/Publish.hs+5−2 src/Language/PureScript/Publish/ErrorsWarnings.hs+6−4
src/Language/PureScript/Publish.hs+5−2
@@ -45,6 +45,7 @@ import System.Directory (doesFileExist, findExecutable)
4545import System.Process (readProcess)
4646import System.Exit (exitFailure)
4747import qualified System.FilePath.Glob as Glob
48+import qualified System.Info
4849
4950import Web.Bower.PackageMeta (PackageMeta(..), BowerError(..), PackageName,
5051 runPackageName, parsePackageName, Repository(..))
@@ -255,9 +256,11 @@ getResolvedDependencies declaredDeps = do
255256findBowerExecutable :: PrepareM String
256257findBowerExecutable = do
257258 mname <- liftIO . runMaybeT . msum . map (MaybeT . findExecutable) $ names
258− maybe (userError BowerExecutableNotFound) return mname
259+ maybe (userError (BowerExecutableNotFound names)) return mname
259260 where
260− names = ["bower", "bower.cmd"]
261+ names = case System.Info.os of
262+ "mingw32" -> ["bower", "bower.cmd"]
263+ _ -> ["bower"]
261264
262265-- | Extracts all dependencies and their versions from
263266-- `bower list --json --offline`
src/Language/PureScript/Publish/ErrorsWarnings.hs+6−4
@@ -21,7 +21,7 @@ import Data.Version
2121import Data.Maybe
2222import Data.Monoid
2323import Data.Foldable (foldMap)
24−import Data.List (intersperse)
24+import Data.List (intersperse, intercalate)
2525import Data.List.NonEmpty (NonEmpty(..))
2626import qualified Data.List.NonEmpty as NonEmpty
2727
@@ -53,7 +53,7 @@ data PackageWarning
5353-- | An error that should be fixed by the user.
5454data UserError
5555 = BowerJSONNotFound
56− | BowerExecutableNotFound
56+ | BowerExecutableNotFound [String] -- list of executable names tried
5757 | CouldntParseBowerJSON (ParseError BowerError)
5858 | BowerJSONNameMissing
5959 | TagMustBeCheckedOut
@@ -122,11 +122,13 @@ displayUserError e = case e of
122122 [ "The bower.json file was not found. Please create one, or run "
123123 , "`pulp init`."
124124 ])
125− BowerExecutableNotFound ->
125+ BowerExecutableNotFound names ->
126126 para (concat
127− [ "The \"bower\" executable was not found (nor \"bower.cmd\"). Please"
127+ [ "The Bower executable was not found (tried: ", format names, "). Please"
128128 , " ensure that bower is installed and on your PATH."
129129 ])
130+ where
131+ format = intercalate ", " . map show
130132 CouldntParseBowerJSON err ->
131133 vcat
132134 [ successivelyIndented