@@ -9,11 +9,13 @@ import Happstack.Server.Compression
99import System.Directory (makeRelativeToCurrentDirectory)
1010import System.Environment
1111import qualified Language.Elm as Elm
12−import Paths_Elm
12+import Paths_elm_server
13+
14+runtime = "/elm-" ++ show version ++ ".js"
1315
1416serve :: String -> IO ()
1517serve libLoc = do
16− putStrLn "Elm Server 0.4.0.3: running at <http://localhost:8000>"
18+ putStrLn ("Elm Server "++show version++": running at <http://localhost:8000>")
1719 simpleHTTP nullConf $ do
1820 _ <- compressedResponseFilter
1921 msum [ uriRest serveElm
@@ -29,10 +31,10 @@ serveElm fp = do
2931 let ('/':filePath) = fp
3032 guard (".elm" `isSuffixOf` filePath)
3133 content <- liftIO (readFile filePath)
32− ok . toResponse $ Elm.toHtml "elm-runtime.js" (pageTitle filePath) content
34+ ok . toResponse $ Elm.toHtml runtime (pageTitle filePath) content
3335
3436serveLib libLoc fp = do
35− guard (fp == "/elm-runtime.js")
37+ guard (fp == runtime)
3638 serveFile (asContentType "application/javascript") libLoc
3739
3840main :: IO ()
@@ -40,11 +42,8 @@ main = getArgs >>= parse
4042
4143parse :: [String] -> IO ()
4244parse ("--help":_) = putStrLn usage
43−parse ("--version":_) = putStrLn "The Elm Server 0.4.0.3"
44−parse [] = do
45− absolutePath <- getDataFileName "elm-runtime-0.4.0.3.js"
46− runtime <- makeRelativeToCurrentDirectory absolutePath
47− serve runtime
45+parse ("--version":_) = putStrLn ("The Elm Server " ++ show version)
46+parse [] = serve =<< Elm.runtimeLocation
4847parse [arg]
4948 | "--runtime-location=" `isPrefixOf` arg =
5049 serve . tail $ dropWhile (/='=') arg
@@ -63,7 +62,7 @@ usage =
6362 \Example: elm-server\n\
6463 \\n\
6564 \Resource Locations:\n\
66− \ --runtime-location set the location of the Elm runtime (elm-mini.js)\n\
65+ \ --runtime-location set the location of the Elm runtime\n\
6766 \\n\
6867 \Compiler Information:\n\
6968 \ --version print the version information and exit\n\