git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Moved config creation to Setup.hs.
0bafd28joneshf
Setup.hsnew file+25
@@ -0,0 +1,25 @@
1+{-# LANGUAGE CPP #-}
2+
3+module Main where
4+
5+import Distribution.PackageDescription
6+import Distribution.Simple
7+import Distribution.Simple.LocalBuildInfo
8+import Distribution.Simple.Setup
9+
10+import System.Directory
11+import System.Environment.XDG.BaseDir
12+#if !defined(mingw32_HOST_OS) || !defined(__MINGW32__)
13+import System.Posix.Files
14+#endif
15+
16+main :: IO ()
17+main = defaultMainWithHooks $ simpleUserHooks {postInst = setupXDG}
18+
19+setupXDG :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
20+setupXDG _ _ _ _ = do
21+ configDir <- getUserConfigDir "purescript"
22+ createDirectoryIfMissing True configDir
23+#if !defined(mingw32_HOST_OS) || !defined(__MINGW32__)
24+ setFileMode configDir ownerModes
25+#endif
Setup.lhsdeleted−6
@@ -1,6 +0,0 @@
1−#!/usr/bin/runhaskell
2−> module Main where
3−> import Distribution.Simple
4−> main :: IO ()
5−> main = defaultMain
6−
psci/Main.hs+8−11
@@ -26,7 +26,7 @@ import Data.Maybe (mapMaybe)
26import Data.Traversable (traverse)
26import Data.Traversable (traverse)
27
27
28import System.Console.Haskeline
28import System.Console.Haskeline
29−import System.Directory (createDirectoryIfMissing, findExecutable)
29+import System.Directory (findExecutable)
30import System.Exit
30import System.Exit
31import System.Environment.XDG.BaseDir
31import System.Environment.XDG.BaseDir
32import System.Process
32import System.Process
@@ -36,9 +36,16 @@ import qualified Paths_purescript as Paths
36import qualified System.IO.UTF8 as U (readFile)
36import qualified System.IO.UTF8 as U (readFile)
37import qualified Text.Parsec as Parsec (eof)
37import qualified Text.Parsec as Parsec (eof)
38
38
39+getHistoryFilename :: IO FilePath
40+getHistoryFilename = getUserConfigFile "purescript" "psci_history"
41+
39getPreludeFilename :: IO FilePath
42getPreludeFilename :: IO FilePath
40getPreludeFilename = Paths.getDataFileName "prelude/prelude.purs"
43getPreludeFilename = Paths.getDataFileName "prelude/prelude.purs"
41
44
45+findNodeProcess :: IO (Maybe String)
46+findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
47+ where names = ["nodejs", "node"]
48+
42options :: P.Options
49options :: P.Options
43options = P.Options True False True (Just "Main") True "PS" []
50options = P.Options True False True (Just "Main") True "PS" []
44
51
@@ -117,16 +124,6 @@ loadModule moduleFile = do
117 moduleText <- U.readFile moduleFile
124 moduleText <- U.readFile moduleFile
118 return . either (Left . show) Right $ P.runIndentParser "" P.parseModules moduleText
125 return . either (Left . show) Right $ P.runIndentParser "" P.parseModules moduleText
119
126
120−findNodeProcess :: IO (Maybe String)
121−findNodeProcess = runMaybeT . msum $ map (MaybeT . findExecutable) names
122− where names = ["nodejs", "node"]
123−
124−getHistoryFilename :: IO FilePath
125−getHistoryFilename = do
126− purescriptConfig <- getUserConfigDir "purescript"
127− createDirectoryIfMissing True purescriptConfig
128− getUserConfigFile "purescript" "psci_history"
129−
130main :: IO ()
127main :: IO ()
131main = do
128main = do
132 preludeFilename <- getPreludeFilename
129 preludeFilename <- getPreludeFilename
purescript.cabal+3−2
@@ -1,7 +1,7 @@
1name: purescript
1name: purescript
2version: 0.4.1
2version: 0.4.1
3cabal-version: >=1.8
3cabal-version: >=1.8
4−build-type: Simple
4+build-type: Custom
5license: MIT
5license: MIT
6license-file: LICENSE
6license-file: LICENSE
7copyright: (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
7copyright: (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
@@ -17,7 +17,8 @@ data-dir: ""
17library
17library
18 build-depends: base >=4 && <5, cmdtheline -any, containers -any,
18 build-depends: base >=4 && <5, cmdtheline -any, containers -any,
19 directory -any, filepath -any, mtl -any, parsec -any, syb -any,
19 directory -any, filepath -any, mtl -any, parsec -any, syb -any,
20− transformers -any, utf8-string -any, pattern-arrows -any, monad-unify >= 0.2 && < 0.3
20+ transformers -any, utf8-string -any, pattern-arrows -any, monad-unify >= 0.2 && < 0.3,
21+ xdg-basedir -any, unix -any
21 exposed-modules: Data.Generics.Extras
22 exposed-modules: Data.Generics.Extras
22 Language.PureScript
23 Language.PureScript
23 Language.PureScript.Options
24 Language.PureScript.Options