summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilMitchell <>2019-05-15 12:57:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-05-15 12:57:00 (GMT)
commit7e50a044c06728fdbd768feb66e3ec0751dc2dfe (patch)
tree058e03727a9ac3cf7d598ef288e200f2e4ea1130
parent73c62b66392752ebb9e793ff96a149cf4992475d (diff)
version 0.3.3HEAD0.3.3master
-rw-r--r--CHANGES.txt26
-rw-r--r--LICENSE2
-rw-r--r--README.md8
-rw-r--r--nsis.cabal6
-rw-r--r--src/Development/NSIS/Show.hs2
-rw-r--r--src/Development/NSIS/Sugar.hs20
-rw-r--r--src/Development/NSIS/Type.hs7
-rw-r--r--test/Examples/Example1.hs8
8 files changed, 40 insertions, 39 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index cd9feae..fafde73 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,20 +1,22 @@
Changelog for NSIS
-0.3.2
+0.3.3, released 2019-05-15
+ Add Welcome page
+0.3.2, released 2017-11-24
Support Semigroup class
-0.3.1
+0.3.1, released 2017-02-21
#11, add unsafeInject and unsafeInjectGlobal
#10, add unicode function
-0.3
+0.3, released 2015-06-24
Make strCheck take a message
Add a plugin for helping with radio button
Make constant force an evaluation
Make section return the section id
Generalise the type of nsis
Add a radio button example
-0.2.5
+0.2.5, released 2015-03-17
Support OName on file
-0.2.4
+0.2.4, released 2014-12-09
#3, clone the EnvVarUpdate plugin
Add abort
Add strCheck function
@@ -26,7 +28,7 @@ Changelog for NSIS
Remove upper bounds
#2, add setDetailsPrint
Add support for parameters to the finish page
-0.2.3
+0.2.3, released 2013-11-04
Add explicit page events
#1, add a Win7 taskbar progress plugin module
Collapse duplicate events into one
@@ -41,17 +43,17 @@ Changelog for NSIS
Add execWait and execShell
Add envVar
Add copyFiles function
-0.2.2
+0.2.2, released 2013-04-16
Change writeFileLines' to not build up a large buffer
-0.2.1
+0.2.1, released 2013-03-17
#592, make the License page take a license file
-0.2
+0.2, released 2013-01-14
Add Applicative instance for Action
Add str, int and bool functions
-0.1.2
+0.1.2, released 2012-03-25
Allow transformers-0.3.0.0
-0.1.1
+0.1.1, released 2012-03-04
Improved documentation
Remove findOnce, you can use fileExists instead
-0.1
+0.1, released 2012-03-04
Start of changelog
diff --git a/LICENSE b/LICENSE
index 0cc8415..f40b577 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright Neil Mitchell 2012-2017.
+Copyright Neil Mitchell 2012-2019.
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/README.md b/README.md
index 38fcb5e..e386b59 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# NSIS Manual [![Hackage version](https://img.shields.io/hackage/v/nsis.svg?label=Hackage)](https://hackage.haskell.org/package/nsis) [![Build Status](https://img.shields.io/travis/ndmitchell/nsis.svg)](https://travis-ci.org/ndmitchell/nsis)
+# NSIS Manual [![Hackage version](https://img.shields.io/hackage/v/nsis.svg?label=Hackage)](https://hackage.haskell.org/package/nsis) [![Stackage version](https://www.stackage.org/package/nsis/badge/nightly?label=Stackage)](https://www.stackage.org/package/nsis) [![Build status](https://img.shields.io/travis/ndmitchell/nsis/master.svg?label=Build)](https://travis-ci.org/ndmitchell/nsis)
-This library makes it easier to write [NSIS Windows Installers](http://nsis.sourceforge.net/). You should use this library if:
+This library makes it easier to write [NSIS Windows Installers](https://nsis.sourceforge.net/). You should use this library if:
* You want to write a Windows Installer, and have picked NSIS (which is a common choice, and in my opinion, one of the best installer generators for Windows).
@@ -26,7 +26,7 @@ Using this library we can write:
## A Simple Example
-The [Examples](https://github.com/ndmitchell/nsis/tree/master/Examples) directory contains a number of simple NSIS scripts, several ported from the NSIS distributed examples. As a simple example:
+The [Examples](https://github.com/ndmitchell/nsis/tree/master/test/Examples) directory contains a number of simple NSIS scripts, several ported from the NSIS distributed examples. As a simple example:
import Development.NSIS
@@ -43,7 +43,7 @@ The [Examples](https://github.com/ndmitchell/nsis/tree/master/Examples) director
setOutPath "$INSTDIR" -- Where to install files in this section
file [] "Example1.hs" -- File to put into this section
-Running this code will generate a file `example1.nsi` that can be processed with `makensis` to produce the installer `example1.exe`. Documentation on each of the functions [is available here](http://hackage.haskell.org/package/nsis/docs/Development-NSIS.html).
+Running this code will generate a file `example1.nsi` that can be processed with `makensis` to produce the installer `example1.exe`. Documentation on each of the functions [is available here](https://hackage.haskell.org/package/nsis/docs/Development-NSIS.html).
## Contributions welcome
diff --git a/nsis.cabal b/nsis.cabal
index c68e1db..566e74b 100644
--- a/nsis.cabal
+++ b/nsis.cabal
@@ -1,15 +1,15 @@
cabal-version: >= 1.18
build-type: Simple
name: nsis
-version: 0.3.2
+version: 0.3.3
license: BSD3
license-file: LICENSE
category: Development
author: Neil Mitchell <ndmitchell@gmail.com>
maintainer: Neil Mitchell <ndmitchell@gmail.com>
-copyright: Neil Mitchell 2012-2017
+copyright: Neil Mitchell 2012-2019
synopsis: DSL for producing Windows Installer using NSIS.
-tested-with: GHC==8.2.1, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3
+tested-with: GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3
description:
NSIS (Nullsoft Scriptable Install System, <http://nsis.sourceforge.net/>) is a tool that allows programmers
to create installers for Windows.
diff --git a/src/Development/NSIS/Show.hs b/src/Development/NSIS/Show.hs
index fb039b4..da183f3 100644
--- a/src/Development/NSIS/Show.hs
+++ b/src/Development/NSIS/Show.hs
@@ -26,7 +26,7 @@ showNSIS xs =
concat [("Function " ++ show name) : map indent (outs fs body) ++ ["FunctionEnd"] | (name,body) <- funs] ++
(if null descs then [] else
["!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN"] ++
- map indent ["!insertmacro MUI_DESCRIPTION_TEXT " ++ show i ++ " " ++ show d | (i,d) <- descs] ++
+ [indent $ "!insertmacro MUI_DESCRIPTION_TEXT " ++ show i ++ " " ++ show d | (i,d) <- descs] ++
["!insertmacro MUI_FUNCTION_DESCRIPTION_END"])
where descs = filter (not . null . snd) $ concatMap secDescs $ universeBi xs
inits = filter (\x -> not (isSection x) && not (isGlobal x)) xs
diff --git a/src/Development/NSIS/Sugar.hs b/src/Development/NSIS/Sugar.hs
index 8957e5b..a9f1a11 100644
--- a/src/Development/NSIS/Sugar.hs
+++ b/src/Development/NSIS/Sugar.hs
@@ -43,8 +43,8 @@ newtype Action a = Action (State S a)
-- The @ty@ argument should be one of 'String', 'Int' or 'Bool'.
newtype Value ty = Value {fromValue :: Val}
-tyString = typeOf (undefined :: String)
-tyInt = typeOf (undefined :: Int)
+tyString = typeRep (Proxy :: Proxy String)
+tyInt = typeRep (Proxy :: Proxy Int)
unique :: Action Int
@@ -72,7 +72,7 @@ lit x = [Literal x | x /= ""]
-- 'while' var $ do
-- 'iff_' cond1 $ 'goto' abort
-- 'iff_' cond2 $ 'goto' abort
--- var '@=' 'strDrop' 1 var
+-- var '@=' 'strDrop' 1 var
-- 'label' abort
-- @
--
@@ -151,7 +151,7 @@ type Exp ty = Action (Value ty)
instance forall a . Typeable a => IsString (Exp a) where
fromString o = do
scopes <- Action $ gets scopes
- let rty = typeOf (undefined :: a)
+ let rty = typeRep (Proxy :: Proxy a)
let grab good name = case lookup name $ concat scopes of
Nothing -> error $ "Couldn't find variable, $" ++ name ++ ", in " ++ show o
@@ -163,7 +163,7 @@ instance forall a . Typeable a => IsString (Exp a) where
-- "$VAR" permits any type, everything else requires string
case parseString o of
[Right var] -> return $ Value $ grab [rty] var
-
+
_ | rty /= tyString ->
error $ "Cannot use concatenated variables/literals to produce anything other than String, but you tried " ++ show rty ++ ", in " ++ show o
xs -> fmap (Value . fromValue) $ strConcat $ flip map xs $ \i -> return $ Value $ case i of
@@ -195,7 +195,7 @@ instance Num (Exp Int) where
(*) = intOp "*"
(-) = intOp "-"
abs a = share a $ \a -> a %< 0 ? (negate a, a)
- signum a = share a $ \a -> a %== 0 ? (0, a %< 0 ? (-1, 1))
+ signum a = share a $ \a -> a %== 0 ? (0, a %< 0 ? (-1, 1))
instance Integral (Exp Int) where
mod = intOp "%"
@@ -226,9 +226,7 @@ instance Semigroup (Exp String) where
instance Monoid (Exp String) where
mempty = fromString ""
mappend = (<>)
- mconcat xs = do
- xs <- sequence xs
- return $ Value $ f $ concatMap fromValue xs
+ mconcat xs = Value . f . concatMap fromValue <$> sequence xs
where
f (Literal "":xs) = f xs
f (Literal x:Literal y:zs) = f $ Literal (x++y) : zs
@@ -299,8 +297,8 @@ addScope name v = Action $
modify $ \s -> let now:rest = scopes s in
if name `elem` map fst now
then error $ "Defined twice in one scope, " ++ name
- else s{scopes=((name,(typeOf (undefined :: t), fromValue v)):now):rest}
-
+ else s{scopes=((name,(typeRep (Proxy :: Proxy t), fromValue v)):now):rest}
+
-- | Create a mutable variable a name, which can be modified with '@='.
diff --git a/src/Development/NSIS/Type.hs b/src/Development/NSIS/Type.hs
index 540c074..86f8a35 100644
--- a/src/Development/NSIS/Type.hs
+++ b/src/Development/NSIS/Type.hs
@@ -153,7 +153,7 @@ data FileMode
| ModeWrite -- All contents of file are destroyed.
| ModeAppend -- ^ Opened for both read and write, contents preserved.
deriving (Data,Typeable,Bounded,Enum,Eq,Ord)
-
+
instance Show FileMode where
show ModeRead = "r"
show ModeWrite = "w"
@@ -197,7 +197,7 @@ data Compressor = LZMA | ZLIB | BZIP2 deriving (Data,Typeable,Show)
instance Default Compressor where def = ZLIB
-data ACompressor = ACompressor
+data ACompressor = ACompressor
{compType :: Compressor
,compSolid :: Bool
,compFinal :: Bool
@@ -291,7 +291,8 @@ instance Default MessageBoxType where def = MB_ICONINFORMATION
data Page
- = License FilePath
+ = Welcome
+ | License FilePath
| Components
| Directory
| InstFiles
diff --git a/test/Examples/Example1.hs b/test/Examples/Example1.hs
index 67d604a..d820911 100644
--- a/test/Examples/Example1.hs
+++ b/test/Examples/Example1.hs
@@ -8,11 +8,11 @@ import Development.NSIS
-- Based on example1.nsi from NSIS
--
-- This script is perhaps one of the simplest NSIs you can make. All of the
--- optional settings are left to their default settings. The installer simply
+-- optional settings are left to their default settings. The installer simply
-- prompts the user asking them where to install, and drops a copy of example1.hs
--- there.
+-- there.
example1 = do
-
+
-- The name of the installer
name "Example1"
@@ -28,7 +28,7 @@ example1 = do
---------------------------------
-- Pages
-
+
page Directory
page InstFiles