git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Rename docgen, remove installation script, update license, change directory for prelude. Fix #657.
commita979da11f0985c8e151e7090c0efc4076b7a7b14 authorPhil Freeman <paf31@cantab.net> dateSun 2 Nov 2014, 17:13 (12 years ago) parentaf0492a
8 files changed+54−73
LICENSE+1−1 bundle/.gitignore+1 bundle/README+30 bundle/build.sh+3−2 bundle/install.sh−55 docgen/Main.hs → psc-docs/Main.hs+1−1 purescript.cabal+2−2 src/Language/PureScript.hs+16−12
LICENSE+1−1
@@ -1,6 +1,6 @@
11The 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
55Permission is hereby granted, free of charge, to any person obtaining a copy of
66this software and associated documentation files (the "Software"), to deal in
bundle/.gitignore+1
@@ -1,2 +1,3 @@
1+build/
12*.tar.gz
23*.sha
bundle/READMEnew file+30
@@ -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+3−2
@@ -25,9 +25,10 @@ strip ../dist/build/docgen/docgen
2525cp ../dist/build/psc/psc build/purescript/
2626cp ../dist/build/psci/psci build/purescript/
2727cp ../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/
2929cp ../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
3334pushd build > /dev/null
bundle/install.shdeleted−55
@@ -1,55 +0,0 @@
1−set -e
2−
3−clear
4−
5−echo " ____ ____ _ _ "
6−echo "| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_ "
7−echo "| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|"
8−echo "| __/| |_| | | | __/___) | (__| | | | |_) | |_ "
9−echo "|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|"
10−echo " |_| "
11−echo
12−echo "This script will "
13−echo
14−echo " - Copy binary files to /usr/local/purescript/bin/"
15−echo " - Copy source code to ~/.purescript/prelude/"
16−echo
17−echo "PureScript is distributed under the MIT license:"
18−echo
19−echo "Permission is hereby granted, free of charge, to any person obtaining a copy of"
20−echo "this software and associated documentation files (the 'Software'), to deal in"
21−echo "the Software without restriction, including without limitation the rights to"
22−echo "use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of"
23−echo "the Software, and to permit persons to whom the Software is furnished to do so,"
24−echo "subject to the following conditions:"
25−echo
26−echo "The above copyright notice and this permission notice shall be included in all"
27−echo "copies or substantial portions of the Software."
28−echo
29−echo "THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"
30−echo "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS"
31−echo "FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR"
32−echo "COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER"
33−echo "IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN"
34−echo "CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
35−echo
36−echo "Press any key to continue or ^C to exit."
37−echo
38−
39−read
40−
41−echo "Copying binary files to /usr/local/purescript/bin/ ..."
42−
43−mkdir -p /usr/local/purescript/bin/
44−cp psc psci psc-make docgen /usr/local/purescript/bin/
45−
46−echo "Copying source code to ~/.purescript/prelude/ ..."
47−
48−mkdir -p ~/.purescript/prelude
49−cp prelude.purs ~/.purescript/prelude/
50−
51−echo "You can add the PureScript binaries to your PATH variable as follows:"
52−echo
53−echo " echo \"export PATH=/usr/local/purescript/bin/:\\\$PATH\" >> ~/.bash_profile"
54−echo " source ~/.bash_profile"
55−
docgen/Main.hs → psc-docs/Main.hsrenamed+1−1
@@ -229,7 +229,7 @@ term = docgen <$> includeHeirarcy <*> inputFiles
229229
230230termInfo :: TermInfo
231231termInfo = 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+2−2
@@ -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+16−12
@@ -41,15 +41,16 @@ import qualified Paths_purescript as Paths
4141import Data.List (sortBy, groupBy, intercalate)
4242import Data.Time.Clock
4343import Data.Function (on)
44−import Data.Maybe (listToMaybe, fromMaybe)
44+import Data.Maybe (fromMaybe)
4545import Control.Monad.Error
4646import Control.Arrow ((&&&))
4747import Control.Applicative
4848import qualified Data.Map as M
4949import 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
232233importPrelude = addDefaultImport (ModuleName [ProperName C.prelude])
233234
234235preludeFilename :: 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"