Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #932 #934

Merged
merged 2 commits into from
Apr 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* [Issue #923](https://github.com/AmpersandTarski/Ampersand/issues/923) Lexer error message had disappeared. Now they show again.
* [Issue #925](https://github.com/AmpersandTarski/Ampersand/issues/925) Add warning when a script contains `BOX <ROWSNH>`, for this is deprecated and could result in an error when a prototype is being generated.
* [Issue #932](https://github.com/AmpersandTarski/Ampersand/issues/932) `--daemon` now has an optional parameter to tell what config file is used. defaults to `.ampersand`.

## v3.16.0 (8 april 2019) (few days before scedule)

Expand Down
2 changes: 1 addition & 1 deletion src/Ampersand/Daemon/Daemon/Daemon.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ startAmpersandDaemon opts = do
initialState :: Options -> IO (Either [String] DaemonState)
initialState opts = do
curDir <- getCurrentDirectory
dotAmpersand <- makeAbsolute $ curDir </> ".ampersand"
dotAmpersand <- makeAbsolute $ curDir </> daemonConfig opts
exists <- doesFileExist dotAmpersand
if exists
then do
Expand Down
12 changes: 8 additions & 4 deletions src/Ampersand/Misc/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ data Options = Options { environment :: EnvironmentOptions
, dirCustomizations :: [FilePath] -- the directory that is copied after generating the prototype
, allInterfaces :: Bool
, runAsDaemon :: Bool -- run Ampersand as a daemon. (for use with the vscode extension)
, daemonConfig :: FilePath -- the path (relative from current directory OR absolute) and filename of a file that contains the root file(s) to be watched by the daemon.
, dbName :: String
, namespace :: String
, testRule :: Maybe String
Expand Down Expand Up @@ -226,6 +227,7 @@ getOptions' envOpts =
, genPrototype = False
, allInterfaces = False
, runAsDaemon = False
, daemonConfig = ".ampersand"
, namespace = ""
, testRule = Nothing
-- , customCssFile = Nothing
Expand Down Expand Up @@ -443,12 +445,14 @@ options = [ (Option ['v'] ["version"]
"generate interfaces, which currently does not work."
, Public)
, (Option [] ["daemon"]
(NoArg (\opts -> opts{runAsDaemon = True}))
"Run ampersand as daemon, for use by the vscode ampersand-language-extention."
, Hidden)
(OptArg (\fn opts -> opts{runAsDaemon = True
,daemonConfig = fromMaybe (daemonConfig opts) fn
})"configfile")
"Run ampersand as daemon, for use by the vscode ampersand-language-extention. An optional parameter may be specified to tell what config file is used. This defaults to `.ampersand`."
, Public)
, (Option ['e'] ["export"]
(OptArg (\mbnm opts -> opts{export2adl = True
,outputfile = fromMaybe "Export.adl" mbnm}) "file")
,outputfile = fromMaybe "Export.adl" mbnm}) "file")
"export as plain Ampersand script, for round-trip testing of the Ampersand compiler."
, Public)
, (Option ['o'] ["outputDir"]
Expand Down
27 changes: 21 additions & 6 deletions src/Ampersand/Prototype/GenFrontend.hs
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,14 @@ downloadPrototypeFramework Options{..} =
then do
verboseLn "Emptying folder to deploy prototype framework"
destroyDestinationDir
let url = "https://github.com/AmpersandTarski/Prototype/archive/"++zwolleVersion++".zip"
verboseLn "Start downloading prototype framework."
response <-
parseRequest ("https://github.com/AmpersandTarski/Prototype/archive/"++zwolleVersion++".zip") >>=
httpBS
response <- (parseRequest url >>= httpBS) `catch` \err ->
exitWith . FailedToInstallPrototypeFramework $
[ "Error encountered during deployment of prototype framework:"
, " Failed to download "<>url
, show (err :: SomeException)
]
let archive = removeTopLevelFolder
. toArchive
. BL.fromStrict
Expand All @@ -474,9 +478,20 @@ downloadPrototypeFramework Options{..} =
let zipoptions =
[OptVerbose | verboseP ]
++ [OptDestination destination]
extractFilesFromArchive zipoptions archive
writeFile (destination </> ".frameworkSHA")
(show . zComment $ archive)
(extractFilesFromArchive zipoptions archive `catch` \err ->
exitWith . FailedToInstallPrototypeFramework $
[ "Error encountered during deployment of prototype framework:"
, " Failed to extract the archive found at "<>url
, show (err :: SomeException)
])
let dest = destination </> ".frameworkSHA"
(writeFile dest (show . zComment $ archive) `catch` \err ->
exitWith . FailedToInstallPrototypeFramework $
[ "Error encountered during deployment of prototype framework:"
, "Archive seems valid: "<>url
, " Failed to write contents of archive to "<>dest
, show (err :: SomeException)
])
return x
else return x
) `catch` \err -> -- git failed to execute
Expand Down