Skip to content
Browse files

bird nest now cleans up after itself (removes *.o, *.hi, and YourApp.…

…hs intermediate files).
  • Loading branch information...
1 parent e89acb6 commit 19135f11c6426aa58e3c74bb548318338801fcd6 @moonmaster9000 committed Aug 1, 2010
Showing with 4 additions and 10 deletions.
  1. +4 −10 bin/bird.hs
View
14 bin/bird.hs
@@ -15,28 +15,22 @@ runArg a =
appModuleName <- return $ head . reverse $ split '/' appModuleNamePath
partialRouteFile <- readFile $ appModuleName ++ ".bird.hs"
writeFile (appModuleName ++ ".hs") ((appModulePrelude appModuleName)++ "\n" ++ partialRouteFile ++ "\n" ++ appModuleEpilogue)
- readProcess "ghc" ["--make", "-O2", "Main.hs"] ""
+ system "ghc --make -O2 Main.hs"
files <- getDirectoryContents appModuleNamePath
- return $ map cleanGHC files
+ system $ "rm *.o *.hi " ++ appModuleName ++ ".hs"
renameFile "Main" appModuleName
return ()
"fly" -> do
appModuleNamePath <- getCurrentDirectory
appModuleName <- return $ head . reverse $ split '/' appModuleNamePath
- readProcess ("./" ++ appModuleName) [] ""
+ system $ "./" ++ appModuleName
return ()
appName -> createBirdApp appName
-cleanGHC file =
- if any (`isSuffixOf` file) [".hi", ".o"]
- then removeFile file
- else return ()
-
appModulePrelude appModuleName =
+ "--This file is generated by bird. It will be overwritten the next time you run 'bird nest'. Edit at your own peril.\n" ++
"module " ++ appModuleName ++ " where\n" ++
"import Bird\n\n"
--- ++ "-- get, post, put, delete :: Path -> BirdResponder ()\n"
-
appModuleEpilogue =
"get _ = status 404\n" ++

0 comments on commit 19135f1

Please sign in to comment.
Something went wrong with that request. Please try again.