Skip to content

Commit ca7bc0a

Browse files
committed
Merge pull request purescript#670 from purescript/657
Rename docgen, remove installation script, update license, change direct...
2 parents 3415457 + a979da1 commit ca7bc0a

File tree

8 files changed

+54
-73
lines changed

8 files changed

+54
-73
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013 Phil Freeman
3+
Copyright (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

bundle/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
build/
12
*.tar.gz
23
*.sha

bundle/README

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
____ ____ _ _
2+
| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_
3+
| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|
4+
| __/| |_| | | | __/___) | (__| | | | |_) | |_
5+
|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|
6+
|_|
7+
8+
Installation Instructions
9+
-------------------------
10+
11+
This bundle contains the following executables:
12+
13+
- psc The PureScript compiler (generates JavaScript for use
14+
in the browser)
15+
- psc-make The PureScript compiler (generates CommonJS modules)
16+
- psci The PureScript interactive module (requires NodeJS)
17+
- docgen A documentation generator
18+
19+
and the following additional files:
20+
21+
- prelude.purs The Prelude (standard library source code)
22+
23+
Copy these files anywhere on your PATH.
24+
25+
The PureScript compiler will look for the Prelude in the following locations:
26+
27+
- ~/.purescript/prelude/prelude.purs or
28+
C:/Documents And Settings/<user name>/Application Data/purescript/prelude/prelude.purs
29+
- The directory of the compiler executable
30+

bundle/build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ strip ../dist/build/docgen/docgen
2525
cp ../dist/build/psc/psc build/purescript/
2626
cp ../dist/build/psci/psci build/purescript/
2727
cp ../dist/build/psc-make/psc-make build/purescript/
28-
cp ../dist/build/docgen/docgen build/purescript/
28+
cp ../dist/build/psc-docs/psc-docs build/purescript/
2929
cp ../prelude/prelude.purs build/purescript/
30-
cp install.sh build/purescript/
30+
cp README build/purescript/
31+
cp ../LICENSE build/purescript/
3132

3233
# Make the binary bundle
3334
pushd build > /dev/null

bundle/install.sh

Lines changed: 0 additions & 55 deletions
This file was deleted.

docgen/Main.hs renamed to psc-docs/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ term = docgen <$> includeHeirarcy <*> inputFiles
229229

230230
termInfo :: TermInfo
231231
termInfo = defTI
232-
{ termName = "docgen"
232+
{ termName = "psc-docs"
233233
, version = showVersion Paths.version
234234
, termDoc = "Generate Markdown documentation from PureScript extern files"
235235
}

purescript.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ executable psci
123123
Parser
124124
ghc-options: -Wall -O2
125125

126-
executable docgen
126+
executable psc-docs
127127
build-depends: base >=4 && <5, cmdtheline -any, purescript -any, utf8-string -any,
128128
process -any, mtl -any
129129
main-is: Main.hs
130130
buildable: True
131-
hs-source-dirs: docgen
131+
hs-source-dirs: psc-docs
132132
other-modules:
133133
ghc-options: -Wall -O2
134134

src/Language/PureScript.hs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ import qualified Paths_purescript as Paths
4141
import Data.List (sortBy, groupBy, intercalate)
4242
import Data.Time.Clock
4343
import Data.Function (on)
44-
import Data.Maybe (listToMaybe, fromMaybe)
44+
import Data.Maybe (fromMaybe)
4545
import Control.Monad.Error
4646
import Control.Arrow ((&&&))
4747
import Control.Applicative
4848
import qualified Data.Map as M
4949
import qualified Data.Set as S
5050

51-
import System.FilePath ((</>), pathSeparator)
52-
import System.Directory (getHomeDirectory, doesFileExist)
51+
import System.FilePath ((</>), pathSeparator, takeDirectory)
52+
import System.Directory (getAppUserDataDirectory, doesFileExist)
53+
import System.Environment (getProgName)
5354

5455
-- |
5556
-- Compile a collection of modules
@@ -232,17 +233,20 @@ importPrelude :: Module -> Module
232233
importPrelude = addDefaultImport (ModuleName [ProperName C.prelude])
233234

234235
preludeFilename :: IO FilePath
235-
preludeFilename = fromMaybe missingPrelude . listToMaybe <$> do
236-
fs <- sequence [homePrelude, cabalPrelude]
237-
filterM doesFileExist fs
236+
preludeFilename = do
237+
fs <- sequence [localPrelude, appPrelude, cabalPrelude]
238+
es <- filterM doesFileExist fs
239+
case es of
240+
(x : _) -> return x
241+
_ -> error "No Prelude found."
238242
where
239-
missingPrelude :: FilePath
240-
missingPrelude = error "No Prelude found in user home or cabal path."
243+
localPrelude :: IO FilePath
244+
localPrelude = ((</> "prelude.purs") . takeDirectory) <$> getProgName
241245

242-
homePrelude :: IO FilePath
243-
homePrelude = do
244-
homeDir <- getHomeDirectory
245-
return $ homeDir </> ".purescript" </> "prelude" </> "prelude.purs"
246+
appPrelude :: IO FilePath
247+
appPrelude = do
248+
appDir <- getAppUserDataDirectory "purescript"
249+
return $ appDir </> "prelude" </> "prelude.purs"
246250

247251
cabalPrelude :: IO FilePath
248252
cabalPrelude = Paths.getDataFileName "prelude/prelude.purs"

0 commit comments

Comments
 (0)