on master help sign in
Updates for new git library and megaparsec
commitfc85aeb06dcd166757fac89aaddc35a7cf035f05 authorAli Abrar <aliabrar@gmail.com> dateMon 26 Aug 2019, 17:09 (7 years ago) parent358e397
5 files changed+8−6
lib/backend/src/Obelisk/Backend.hs+2−2 lib/command/obelisk-command.cabal+1−1 lib/command/src/Obelisk/App.hs+2 lib/command/src/Obelisk/Command/Thunk.hs+2−2 lib/command/src/Obelisk/Command/Utils.hs+1−1
lib/backend/src/Obelisk/Backend.hs+2−2
@@ -66,7 +66,7 @@ data GhcjsApp route = GhcjsApp
6666-- | Serve a frontend, which must be the same frontend that Obelisk has built and placed in the default location
6767--TODO: The frontend should be provided together with the asset paths so that this isn't so easily breakable; that will probably make this function obsolete
6868serveDefaultObeliskApp
69− :: (MonadSnap m, HasCookies m)
69+ :: (MonadSnap m, HasCookies m, MonadFail m)
7070 => (R appRoute
7171 -> Text)
7272 -> ([Text]
@@ -127,7 +127,7 @@ getRouteWith e = do
127127 return $ tryDecode e pageName
128128
129129serveObeliskApp
130− :: (MonadSnap m, HasCookies m)
130+ :: (MonadSnap m, HasCookies m, MonadFail m)
131131 => (R appRoute -> Text)
132132 -> ([Text] -> m ())
133133 -> GhcjsApp (R appRoute)
lib/command/obelisk-command.cabal+1−1
@@ -23,7 +23,7 @@ library
2323 , filepath
2424 , github
2525 , here
26− , hit
26+ , git
2727 , hnix
2828 , hpack
2929 , io-streams
lib/command/src/Obelisk/App.hs+2
@@ -12,6 +12,7 @@ module Obelisk.App where
1212
1313import Control.Lens
1414import Control.Monad.Catch (MonadCatch, MonadMask, MonadThrow)
15+import Control.Monad.Fail (MonadFail)
1516import Control.Monad.Reader (MonadIO, ReaderT (..), ask, runReaderT)
1617import Control.Monad.Writer (WriterT)
1718import Control.Monad.State (StateT)
@@ -104,6 +105,7 @@ type MonadInfallibleObelisk m =
104105type MonadObelisk m =
105106 ( MonadInfallibleObelisk m
106107 , CliThrow ObeliskError m
108+ , MonadFail m
107109 )
108110
109111getObeliskUserStateDir :: IO FilePath
lib/command/src/Obelisk/Command/Thunk.hs+2−2
@@ -94,7 +94,7 @@ type NixSha256 = Text --TODO: Use a smart constructor and make this actually ver
9494
9595-- | A specific revision of data; it may be available from multiple sources
9696data ThunkRev = ThunkRev
97− { _thunkRev_commit :: Ref
97+ { _thunkRev_commit :: Ref Ref.SHA1
9898 , _thunkRev_nixSha256 :: NixSha256
9999 }
100100 deriving (Show, Eq, Ord)
@@ -149,7 +149,7 @@ getThunkGitBranch (ThunkPtr _ src) = fmap untagName $ case src of
149149 ThunkSource_GitHub s -> _gitHubSource_branch s
150150 ThunkSource_Git s -> _gitSource_branch s
151151
152−commitNameToRef :: Name Commit -> Ref
152+commitNameToRef :: Name Commit -> Ref Ref.SHA1
153153commitNameToRef (N c) = Ref.fromHex $ encodeUtf8 c
154154
155155-- TODO: Use spinner here.
lib/command/src/Obelisk/Command/Utils.hs+1−1
@@ -134,7 +134,7 @@ gitLsRemote repository mRef mBranch = do
134134 ["ls-remote", "--exit-code", repository, branchName]
135135 let t = T.pack out
136136 maps <- case MP.runParser parseLsRemote "" t of
137− Left err -> failWith $ T.pack $ MP.parseErrorPretty' t err
137+ Left err -> failWith $ T.pack $ MP.errorBundlePretty err
138138 Right table -> pure $ bimap M.fromList M.fromList $ partitionEithers $ table
139139 putLog Debug $ "git ls-remote maps: " <> T.pack (show maps)
140140 pure (exitCode, maps)