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.
a979da1Phil Freeman
LICENSE+1−1
@@ -1,6 +1,6 @@
1The MIT License (MIT)
1The MIT License (MIT)
2
2
3−Copyright (c) 2013 Phil Freeman
3+Copyright (c) 2013-14 Phil Freeman, (c) 2014 Gary Burgess, and other contributors
4
4
5Permission is hereby granted, free of charge, to any person obtaining a copy of
5Permission is hereby granted, free of charge, to any person obtaining a copy of
6this software and associated documentation files (the "Software"), to deal in
6this software and associated documentation files (the "Software"), to deal in
bundle/.gitignore+1
@@ -1,2 +1,3 @@
1+build/
1*.tar.gz
2*.tar.gz
2*.sha
3*.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
25cp ../dist/build/psc/psc build/purescript/
25cp ../dist/build/psc/psc build/purescript/
26cp ../dist/build/psci/psci build/purescript/
26cp ../dist/build/psci/psci build/purescript/
27cp ../dist/build/psc-make/psc-make build/purescript/
27cp ../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/
29cp ../prelude/prelude.purs build/purescript/
29cp ../prelude/prelude.purs build/purescript/
30+cp README build/purescript/
30−cp install.sh build/purescript/
31+cp ../LICENSE build/purescript/
31
32
32# Make the binary bundle
33# Make the binary bundle
33pushd build > /dev/null
34pushd 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
229
229
230termInfo :: TermInfo
230termInfo :: TermInfo
231termInfo = defTI
231termInfo = defTI
232− { termName = "docgen"
232+ { termName = "psc-docs"
233 , version = showVersion Paths.version
233 , version = showVersion Paths.version
234 , termDoc = "Generate Markdown documentation from PureScript extern files"
234 , termDoc = "Generate Markdown documentation from PureScript extern files"
235 }
235 }
purescript.cabal+2−2
@@ -123,12 +123,12 @@ executable psci
123 Parser
123 Parser
124 ghc-options: -Wall -O2
124 ghc-options: -Wall -O2
125
125
126−executable docgen
126+executable psc-docs
127 build-depends: base >=4 && <5, cmdtheline -any, purescript -any, utf8-string -any,
127 build-depends: base >=4 && <5, cmdtheline -any, purescript -any, utf8-string -any,
128 process -any, mtl -any
128 process -any, mtl -any
129 main-is: Main.hs
129 main-is: Main.hs
130 buildable: True
130 buildable: True
131− hs-source-dirs: docgen
131+ hs-source-dirs: psc-docs
132 other-modules:
132 other-modules:
133 ghc-options: -Wall -O2
133 ghc-options: -Wall -O2
134
134
src/Language/PureScript.hs+16−12
@@ -41,15 +41,16 @@ import qualified Paths_purescript as Paths
41import Data.List (sortBy, groupBy, intercalate)
41import Data.List (sortBy, groupBy, intercalate)
42import Data.Time.Clock
42import Data.Time.Clock
43import Data.Function (on)
43import Data.Function (on)
44−import Data.Maybe (listToMaybe, fromMaybe)
44+import Data.Maybe (fromMaybe)
45import Control.Monad.Error
45import Control.Monad.Error
46import Control.Arrow ((&&&))
46import Control.Arrow ((&&&))
47import Control.Applicative
47import Control.Applicative
48import qualified Data.Map as M
48import qualified Data.Map as M
49import qualified Data.Set as S
49import qualified Data.Set as S
50
50
51−import System.FilePath ((</>), pathSeparator)
51+import System.FilePath ((</>), pathSeparator, takeDirectory)
52−import System.Directory (getHomeDirectory, doesFileExist)
52+import System.Directory (getAppUserDataDirectory, doesFileExist)
53+import System.Environment (getProgName)
53
54
54-- |
55-- |
55-- Compile a collection of modules
56-- Compile a collection of modules
@@ -232,17 +233,20 @@ importPrelude :: Module -> Module
232importPrelude = addDefaultImport (ModuleName [ProperName C.prelude])
233importPrelude = addDefaultImport (ModuleName [ProperName C.prelude])
233
234
234preludeFilename :: IO FilePath
235preludeFilename :: IO FilePath
235−preludeFilename = fromMaybe missingPrelude . listToMaybe <$> do
236+preludeFilename = do
236− fs <- sequence [homePrelude, cabalPrelude]
237+ fs <- sequence [localPrelude, appPrelude, cabalPrelude]
237− filterM doesFileExist fs
238+ es <- filterM doesFileExist fs
239+ case es of
240+ (x : _) -> return x
241+ _ -> error "No Prelude found."
238 where
242 where
239− missingPrelude :: FilePath
243+ localPrelude :: IO FilePath
240− missingPrelude = error "No Prelude found in user home or cabal path."
244+ localPrelude = ((</> "prelude.purs") . takeDirectory) <$> getProgName
241
245
242− homePrelude :: IO FilePath
246+ appPrelude :: IO FilePath
243− homePrelude = do
247+ appPrelude = do
244− homeDir <- getHomeDirectory
248+ appDir <- getAppUserDataDirectory "purescript"
245− return $ homeDir </> ".purescript" </> "prelude" </> "prelude.purs"
249+ return $ appDir </> "prelude" </> "prelude.purs"
246
250
247 cabalPrelude :: IO FilePath
251 cabalPrelude :: IO FilePath
248 cabalPrelude = Paths.getDataFileName "prelude/prelude.purs"
252 cabalPrelude = Paths.getDataFileName "prelude/prelude.purs"