Skip to content

Commit

Permalink
Rename docgen, remove installation script, update license, change dir…
Browse files Browse the repository at this point in the history
…ectory for prelude. Fix #657.
  • Loading branch information
paf31 committed Nov 3, 2014
1 parent af0492a commit a979da1
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 73 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

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

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
1 change: 1 addition & 0 deletions bundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
*.tar.gz
*.sha
30 changes: 30 additions & 0 deletions bundle/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
____ ____ _ _
| _ \ _ _ _ __ ___/ ___| ___ _ __(_)_ __ | |_
| |_) | | | | '__/ _ \___ \ / __| '__| | '_ \| __|
| __/| |_| | | | __/___) | (__| | | | |_) | |_
|_| \__,_|_| \___|____/ \___|_| |_| .__/ \__|
|_|

Installation Instructions
-------------------------

This bundle contains the following executables:

- psc The PureScript compiler (generates JavaScript for use
in the browser)
- psc-make The PureScript compiler (generates CommonJS modules)
- psci The PureScript interactive module (requires NodeJS)
- docgen A documentation generator

and the following additional files:

- prelude.purs The Prelude (standard library source code)

Copy these files anywhere on your PATH.

The PureScript compiler will look for the Prelude in the following locations:

- ~/.purescript/prelude/prelude.purs or
C:/Documents And Settings/<user name>/Application Data/purescript/prelude/prelude.purs
- The directory of the compiler executable

5 changes: 3 additions & 2 deletions bundle/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ strip ../dist/build/docgen/docgen
cp ../dist/build/psc/psc build/purescript/
cp ../dist/build/psci/psci build/purescript/
cp ../dist/build/psc-make/psc-make build/purescript/
cp ../dist/build/docgen/docgen build/purescript/
cp ../dist/build/psc-docs/psc-docs build/purescript/
cp ../prelude/prelude.purs build/purescript/
cp install.sh build/purescript/
cp README build/purescript/
cp ../LICENSE build/purescript/

# Make the binary bundle
pushd build > /dev/null
Expand Down
55 changes: 0 additions & 55 deletions bundle/install.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docgen/Main.hs → psc-docs/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ term = docgen <$> includeHeirarcy <*> inputFiles

termInfo :: TermInfo
termInfo = defTI
{ termName = "docgen"
{ termName = "psc-docs"
, version = showVersion Paths.version
, termDoc = "Generate Markdown documentation from PureScript extern files"
}
Expand Down
4 changes: 2 additions & 2 deletions purescript.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ executable psci
Parser
ghc-options: -Wall -O2

executable docgen
executable psc-docs
build-depends: base >=4 && <5, cmdtheline -any, purescript -any, utf8-string -any,
process -any, mtl -any
main-is: Main.hs
buildable: True
hs-source-dirs: docgen
hs-source-dirs: psc-docs
other-modules:
ghc-options: -Wall -O2

Expand Down
28 changes: 16 additions & 12 deletions src/Language/PureScript.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ import qualified Paths_purescript as Paths
import Data.List (sortBy, groupBy, intercalate)
import Data.Time.Clock
import Data.Function (on)
import Data.Maybe (listToMaybe, fromMaybe)
import Data.Maybe (fromMaybe)
import Control.Monad.Error
import Control.Arrow ((&&&))
import Control.Applicative
import qualified Data.Map as M
import qualified Data.Set as S

import System.FilePath ((</>), pathSeparator)
import System.Directory (getHomeDirectory, doesFileExist)
import System.FilePath ((</>), pathSeparator, takeDirectory)
import System.Directory (getAppUserDataDirectory, doesFileExist)
import System.Environment (getProgName)

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

preludeFilename :: IO FilePath
preludeFilename = fromMaybe missingPrelude . listToMaybe <$> do
fs <- sequence [homePrelude, cabalPrelude]
filterM doesFileExist fs
preludeFilename = do
fs <- sequence [localPrelude, appPrelude, cabalPrelude]
es <- filterM doesFileExist fs
case es of
(x : _) -> return x
_ -> error "No Prelude found."
where
missingPrelude :: FilePath
missingPrelude = error "No Prelude found in user home or cabal path."
localPrelude :: IO FilePath
localPrelude = ((</> "prelude.purs") . takeDirectory) <$> getProgName

homePrelude :: IO FilePath
homePrelude = do
homeDir <- getHomeDirectory
return $ homeDir </> ".purescript" </> "prelude" </> "prelude.purs"
appPrelude :: IO FilePath
appPrelude = do
appDir <- getAppUserDataDirectory "purescript"
return $ appDir </> "prelude" </> "prelude.purs"

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

0 comments on commit a979da1

Please sign in to comment.