stackage-setup 0.0.0 → 0.0.0.1
raw patch · 3 files changed
+19/−14 lines, 3 files
Files
- ChangeLog.md +4/−0
- main/StackageSetup.hs +14/−13
- stackage-setup.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.0.0.1++* `stackage-setup nightly` now works as expected+ ## 0.0.0 Initial release
main/StackageSetup.hs view
@@ -205,10 +205,10 @@ arch :: String arch = "linux64" -ltsSnapshotsReq :: (MonadThrow m, GetConfig m) => m Request-ltsSnapshotsReq = do+snapshotsReq :: (MonadThrow m, GetConfig m) => m Request+snapshotsReq = do stackageHost <- getStackageHost- parseUrl $ stackageHost <> "/download/lts-snapshots.json"+ parseUrl $ stackageHost <> "/download/snapshots.json" ghcMajorVersionReq :: (MonadThrow m, GetConfig m) => Snapshot -> m Request ghcMajorVersionReq snapshot = do@@ -224,22 +224,22 @@ setupTargetParser = strArgument mods where mods = metavar "TARGET" <> value "lts" -refreshLtsSnapshots ::+refreshSnapshots :: ( HasHttpManager env , MonadReader env m , GetConfig m , MonadThrow m , MonadIO m ) => m (HashMap String String)-refreshLtsSnapshots = do+refreshSnapshots = do stackageRoot <- getStackageRoot- let path = Path.encodeString $ stackageRoot </> ltsSnapshotsPath+ let path = Path.encodeString $ stackageRoot </> snapshotsPath - response <- httpLbs =<< ltsSnapshotsReq+ response <- httpLbs =<< snapshotsReq let lbs = responseBody response liftIO $ LByteString.writeFile path lbs - either (throwM . ParseLtsSnapshotsError) return $ Aeson.eitherDecode lbs+ either (throwM . ParseSnapshotsError) return $ Aeson.eitherDecode lbs getLinks ::@@ -283,7 +283,7 @@ data SetupExceptions = SeriesNotFound Series- | ParseLtsSnapshotsError String+ | ParseSnapshotsError String | ParseLinksError Yaml.ParseException | StackageRootNotFound deriving (Show, Typeable)@@ -291,6 +291,7 @@ readSeries :: String -> Maybe Series readSeries s@"lts" = Just s+readSeries s@"nightly" = Just s readSeries s@(stripPrefix "lts-" -> Just sver) | all Char.isNumber sver = Just s readSeries (stripPrefix "lts/" -> Just sver)@@ -328,8 +329,8 @@ , MonadIO m ) => Series -> m Snapshot lookupSnapshot series = do- ltsSnapshots <- refreshLtsSnapshots- case HashMap.lookup series ltsSnapshots of+ snapshots <- refreshSnapshots+ case HashMap.lookup series snapshots of Just snapshot -> return snapshot Nothing -> throwM $ SeriesNotFound series @@ -600,8 +601,8 @@ downloadPath name version = Path.fromText (name <> "-" <> version) -ltsSnapshotsPath :: Path.FilePath-ltsSnapshotsPath = Path.fromText "lts-snapshots.json"+snapshotsPath :: Path.FilePath+snapshotsPath = Path.fromText "snapshots.json" linksPath :: GhcMajorVersion -> Path.FilePath linksPath ghcMajorVersion = Path.fromText $ "ghc-" <> pack ghcMajorVersion <> "-links.yaml"
stackage-setup.cabal view
@@ -1,5 +1,5 @@ name: stackage-setup-version: 0.0.0+version: 0.0.0.1 synopsis: An executable for downloading a Haskell setup description: