GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Commit for release 0.0.7.1 · nstack/nstack@9e394d5

This repository was archived by the owner on Feb 7, 2024. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • nstack-cli
    • app
      • NStackCLI.hs
    • nstack-cli.cabal
  • nstack-prelude
    • nstack-prelude.cabal
    • src/NStack/Prelude
      • Exception.hs
  • nstack
    • nstack.cabal
    • src/NStack
      • Module
        • Types.hs
      • Settings.hs
      • Settings
        • Parser.hs
        • Types.hs
    • test_output.xml
    • test
      • TestSuite.hs
  • stack.yaml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎nstack-cli/app/NStackCLI.hs‎

Copy file name to clipboardExpand all lines: nstack-cli/app/NStackCLI.hs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ formatNotebook module_name fn_name = DSLSource $
9292

9393
run :: Command -> CCmd ()
9494
run (InitCommand initStack mBase gitRepo) = CLI.initCommand initStack mBase gitRepo
95-
run (StartCommand debug module_name fn_name) = callServer startCommand (formatNotebook module_name fn_name, debug) CLI.showStartMessage
96-
run (NotebookCommand debug mDsl) = do
95+
run (StartCommand debugOpt module_name fn_name) = callServer startCommand (formatNotebook module_name fn_name, debugOpt) CLI.showStartMessage
96+
run (NotebookCommand debugOpt mDsl) = do
9797
liftInput . HL.outputStrLn $ "NStack Notebook - import modules, write a workflow, and press " <> endStream <> " when finished to start it: "
9898
dsl <- maybe (liftIO $ DSLSource <$> TIO.getContents) pure mDsl
9999
liftInput . HL.outputStrLn $ "Building and running NStack Workflow. Please wait. This may take some time."
100-
callServer startCommand (dsl, debug) CLI.showStartMessage
100+
callServer startCommand (dsl, debugOpt) CLI.showStartMessage
101101
where endStream = if os == "mingw32" then "<Ctrl-Z>" else "<Ctrl-D>"
102102
run (StopCommand pId) = callServer stopCommand pId CLI.showStopMessage
103103
run (LogsCommand pId) = callServer logsCommand pId catLogs
Collapse file

‎nstack-cli/nstack-cli.cabal‎

Copy file name to clipboardExpand all lines: nstack-cli/nstack-cli.cabal
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: nstack-cli
2-
version: 0.0.7
2+
version: 0.0.7.1
33
cabal-version: >=1.22
44
build-type: Simple
55
license: BSD3
Collapse file

‎nstack-prelude/nstack-prelude.cabal‎

Copy file name to clipboardExpand all lines: nstack-prelude/nstack-prelude.cabal
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: nstack-prelude
2-
version: 0.0.7
2+
version: 0.0.7.1
33
cabal-version: >=1.22
44
build-type: Simple
55
license: BSD3
Collapse file

‎nstack-prelude/src/NStack/Prelude/Exception.hs‎

Copy file name to clipboardExpand all lines: nstack-prelude/src/NStack/Prelude/Exception.hs
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ module NStack.Prelude.Exception
22
( TransientError(..)
33
, PermanentError(..)
44
, throwPermanentError
5+
, throwPermanentErrorT
56
)
67
where
78

89
import Control.Exception
10+
import Data.Text (unpack, Text)
911
import Data.Typeable (Typeable)
1012
import Control.Monad.IO.Class (MonadIO(..))
1113

@@ -24,3 +26,6 @@ instance Exception PermanentError where
2426
-- | A shortcut for commonly-occurring @liftIO . throwIO . PermanentError@.
2527
throwPermanentError :: MonadIO m => String -> m a
2628
throwPermanentError = liftIO . throwIO . PermanentError
29+
30+
throwPermanentErrorT :: MonadIO m => Text -> m a
31+
throwPermanentErrorT = throwPermanentError . unpack
Collapse file

‎nstack/nstack.cabal‎

Copy file name to clipboardExpand all lines: nstack/nstack.cabal
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: nstack
2-
version: 0.0.7
2+
version: 0.0.7.1
33
cabal-version: >=1.22
44
build-type: Simple
55
license: BSD3
Collapse file

‎nstack/src/NStack/Module/Types.hs‎

Copy file name to clipboardExpand all lines: nstack/src/NStack/Module/Types.hs
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Data.ByteString (ByteString)
66
import qualified Data.ByteString as BS
77
import qualified Data.ByteString.Base16 as Base16
88
import Data.Coerce (coerce)
9-
import Data.SafeCopy (base, deriveSafeCopy, extension, Migrate(..))
9+
import Data.SafeCopy (base, deriveSafeCopy, extension, Migrate(..), SafeCopy(..), safePut, safeGet, contain)
1010
import Data.Semigroup
1111
import Data.Serialize (Serialize(..))
1212
import Data.Serialize.Get (getListOf)
@@ -161,6 +161,8 @@ instance Serialize FnName where
161161
put = coerce putText
162162
get = coerce getText
163163

164+
$(deriveSafeCopy 0 'base ''FnName)
165+
164166
-- | The name of an NStack type
165167
newtype TyName = TyName Text
166168
deriving (Eq, Ord, Typeable, Data, IsString, Pretty, Generic, ToJSON)
@@ -186,6 +188,10 @@ instance ToJSON a => ToJSON (Qualified a) where
186188
type QFnName = Qualified FnName
187189
type QTyName = Qualified TyName
188190

191+
instance SafeCopy QFnName where
192+
putCopy (Qualified mod' fn) = contain $ safePut mod' >> safePut fn
193+
getCopy = contain $ Qualified <$> safeGet <*> safeGet
194+
189195
instance Show a => Show (Qualified a) where
190196
show (Qualified modName methName) = pprS modName <> "." <> show methName
191197

Collapse file

‎nstack/src/NStack/Settings.hs‎

Copy file name to clipboardExpand all lines: nstack/src/NStack/Settings.hs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module NStack.Settings (SettingsT,
1818
frontendHost,
1919
serviceLimits,
2020
cliTimeout,
21+
debug,
2122
defaultFrontendHost,
2223
runSettingsParser,
2324
serverConn,
Collapse file

‎nstack/src/NStack/Settings/Parser.hs‎

Copy file name to clipboardExpand all lines: nstack/src/NStack/Settings/Parser.hs
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import qualified Data.UUID as UUID
99
import Data.Yaml.Combinators
1010

1111
import NStack.Auth (readUserId, readKey)
12+
import NStack.Module.Types (DebugOpt(..))
1213
import NStack.Settings.Types (AnalyticsSettings(..), HostName(..), ServerDetails(..), AuthSettings(..), Settings(..), InstallID(..))
1314

1415
valueWhenMatching :: a -> Parser () -> Parser a
@@ -54,6 +55,12 @@ authSettingsParser = nstackAuthParser <> trustAuthParser
5455
secretKeyParser = validate string $
5556
maybe (Left "the secret-key to be a lowercase hexstring with even length") Right . readKey
5657

58+
debugParser :: Parser DebugOpt
59+
debugParser = trueToDebug <$> bool
60+
where
61+
trueToDebug True = Debug
62+
trueToDebug False = NoDebug
63+
5764
settingsParser :: Parser Settings
5865
settingsParser = object $ Settings <$>
5966
optFieldOrNull "install-id" (InstallID <$> uuidParser) <*>
@@ -63,7 +70,8 @@ settingsParser = object $ Settings <$>
6370
optFieldOrNull "server" serverDetailsParser <*>
6471
optFieldOrNull "frontend-host" frontendHostParser <*>
6572
optFieldOrNull "service-limits" bool <*>
66-
optFieldOrNull "cli-timeout" integer
73+
optFieldOrNull "cli-timeout" integer <*>
74+
optFieldOrNull "debug" debugParser
6775
where
6876
uuidParser = validate string $
6977
maybe (Left "install-id to be a valid UUID") Right . UUID.fromText
Collapse file

‎nstack/src/NStack/Settings/Types.hs‎

Copy file name to clipboardExpand all lines: nstack/src/NStack/Settings/Types.hs
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Data.UUID (UUID)
1212
import Data.Text (Text, toLower) -- from: text
1313
import GHC.Generics
1414

15+
import NStack.Module.Types (DebugOpt(NoDebug))
1516
import NStack.Auth (SecretKey, UserId)
1617

1718
newtype InstallID = InstallID UUID deriving (Eq, Show, ToJSON, FromJSON)
@@ -47,7 +48,8 @@ data Settings = Settings { _installId :: Maybe InstallID,
4748
_server :: Maybe ServerDetails,
4849
_frontendHost :: Maybe HostName,
4950
_serviceLimits :: Maybe Bool,
50-
_cliTimeout :: Maybe Int
51+
_cliTimeout :: Maybe Int,
52+
_debug :: Maybe DebugOpt
5153
}
5254
deriving (Eq, Show)
5355

@@ -75,7 +77,7 @@ instance ToJSON AuthSettings where
7577
"secret-key" .= key]
7678

7779
defaultSettings :: Settings
78-
defaultSettings = Settings { _installId = Nothing, _analytics = Nothing, _authSettings = Nothing, _authServer = Nothing, _server = Nothing, _frontendHost = Nothing, _serviceLimits = Nothing, _cliTimeout = Nothing }
80+
defaultSettings = Settings { _installId = Nothing, _analytics = Nothing, _authSettings = Nothing, _authServer = Nothing, _server = Nothing, _frontendHost = Nothing, _serviceLimits = Nothing, _cliTimeout = Nothing, _debug = Nothing }
7981

8082
installId :: Lens' Settings (Maybe InstallID)
8183
installId f s = (\r -> s { _installId = r }) <$> f (_installId s)
@@ -98,6 +100,9 @@ serviceLimits f s = (\r -> s { _serviceLimits = Just r }) <$> f (fromMaybe True
98100
cliTimeout :: Lens' Settings Int
99101
cliTimeout f s = (\r -> s { _cliTimeout = Just r }) <$> f (fromMaybe 15 $ _cliTimeout s)
100102

103+
debug :: Lens' Settings DebugOpt
104+
debug f s = (\r -> s { _debug = Just r }) <$> f (fromMaybe NoDebug $ _debug s)
105+
101106
authKey :: Lens' AuthSettings SecretKey
102107
authKey f = \case
103108
NStackHMAC u k -> NStackHMAC u <$> f k
Collapse file

‎nstack/test/TestSuite.hs‎

Copy file name to clipboardExpand all lines: nstack/test/TestSuite.hs
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ main = defaultMainWithIngredients (antXMLRunner:defaultIngredients) $ testGroup
1919
settingsParserTests :: TestTree
2020
settingsParserTests = testGroup "Unit Tests"
2121
[ testCase "Display a proper error message when invalid analytics settings" $
22-
checkErrorMessages "test/res/invalid-analytics-settings.conf" "Expected \"enabled\", \"disabled\" instead of",
22+
checkErrorMessages "test/res/invalid-analytics-settings.conf" "Expected \"disabled\", \"enabled\" instead of",
2323
testCase "Display a proper error message when invalid install-id" $
2424
checkErrorMessages "test/res/invalid-install-id.conf" "Expected install-id to be a valid UUID instead of",
2525
testCase "Display a proper error message when invalid server" $
@@ -29,7 +29,7 @@ settingsParserTests = testGroup "Unit Tests"
2929
checkErrorMessages "test/res/invalid-authentication1.conf" "Unexpected \n\nuser-id: abc123",
3030

3131
testCase "Display a proper error message when more arguments for nstack scheme are needed" $
32-
checkErrorMessages "test/res/invalid-authentication2.conf" "Expected \"trust\" instead of:",
32+
checkErrorMessages "test/res/invalid-authentication2.conf" "Expected field \"user-id\" as part of:",
3333

3434
testCase "Display a proper error message when invalid authentication scheme is used" $
3535
checkErrorMessages "test/res/invalid-authentication3.conf" "Expected \"nstack\", \"trust\" instead of:",
@@ -76,3 +76,4 @@ parseSettingsFileTest = do
7676
(Just (HostName "http://localhost:8000"))
7777
Nothing
7878
Nothing
79+
Nothing

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.