Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

Commit

Permalink
Merge branch 'pr/129' into next
Browse files Browse the repository at this point in the history
Conflicts:
	.gitignore
	Setup.hs
	backend/Main.hs
	elm-reactor.cabal
  • Loading branch information
process-bot committed Aug 12, 2015
2 parents d71fa1a + 97c2bf1 commit 771c409
Show file tree
Hide file tree
Showing 11 changed files with 661 additions and 206 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
dist
assets/_reactor/debug.js
assets/_reactor/index.js
elm-stuff
cabal.sandbox.config
elm.js
.cabal-sandbox/
40 changes: 35 additions & 5 deletions Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import System.FilePath
import System.Directory


-- RUN EVERYTHING

main :: IO ()
main =
defaultMainWithHooks simpleUserHooks { postBuild = myPostBuild }
Expand All @@ -19,25 +21,53 @@ main =
myPostBuild :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
myPostBuild args flags pd lbi =
do putStrLn "Custom build step: creating and collecting all static resources"

buildSideBar
buildIndex

src <- readFile ("frontend" </> "debugger-implementation.js")
appendFile output src
appendFile debugPath src
postBuild simpleUserHooks args flags pd lbi


output :: FilePath
output =
-- PATHS

debugPath :: FilePath
debugPath =
"assets" </> "_reactor" </> "debug.js"


indexPath :: FilePath
indexPath =
"assets" </> "_reactor" </> "index.js"


-- BUILD STATIC FILES

buildSideBar :: IO ()
buildSideBar =
compile "Debugger.elm" debugPath


buildIndex :: IO ()
buildIndex =
compile "Index.elm" indexPath


compile :: FilePath -> FilePath -> IO ()
compile source target =
do (exitCode, out, err) <-
readProcessWithExitCode "elm-make" [ "--yes", "frontend" </> "Debugger.elm", "--output=" ++ output ] ""
readProcessWithExitCode
"elm-make"
[ "--yes", "frontend" </> source, "--output=" ++ target ]
""

case exitCode of
ExitSuccess ->
return ()

ExitFailure _ ->
do hPutStrLn stderr ("Failed to build Debugger.elm\n\n" ++ out ++ err)
do hPutStrLn stderr (unlines ["Failed to build" ++ source, "", out, err])
exitFailure


Binary file removed assets/_reactor/wrench.png
Binary file not shown.
Loading

0 comments on commit 771c409

Please sign in to comment.