packages feed

hsinstall 1.3 → 1.4

raw patch · 3 files changed

+66/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

+ changelog.md view
@@ -0,0 +1,32 @@+1.4 (2016-10-11)++   * Added missing files to extra-source-files+   * Added switch for making a symlink to the app directory+++1.3 (2016-10-07)++   * Fixed error in docs+++1.2 (2016-10-07)++   * Added example additional script copying code+   * Updated developer instructions+   * Added a tested-with line to the cabal file+++1.1 (2016-10-07)++   * Updated to stackage lts-7.2+++1.0 (2016-10-02)++   * Cleaned up cabal file+   * Wrote API docs+   * Cleaned up README+   * Aborting the installation if `stack install` fails+   * Added instructions for compiling install.hs+   * Added library for locating resources at runtime+   * Initial release
hsinstall.cabal view
@@ -1,5 +1,5 @@ name:                hsinstall-version:             1.3+version:             1.4 synopsis:            Install Haskell software description:         This is a utility to install Haskell programs on a system using stack. Even though stack has an `install` command, I found it to be not enough for my needs. This software tries to install the binaries, the LICENSE file and also the resources directory if it finds one. There is also an optional library component to assist with locating installed data files at runtime. homepage:            @@ -14,9 +14,12 @@ cabal-version:       >=1.10 tested-with:         GHC >= 8.0.1 data-files:          resources/foo-extra-source-files:  README.md+extra-source-files:  changelog.md+                     README.md                      resources/foo+                     stack.yaml                      util/install.hs+                     util/prefs/boring  executable an-app    hs-source-dirs:     app
util/install.hs view
@@ -27,13 +27,14 @@    { optClean = False    , optDelete = False    , optHelp = False+   , optLink = False    , optPrefix = "/opt"    , optRsrcCpVerbose = True    , optInstType = FHS    , optVersion = True    } -data InstallType = Bundle | FHS+data InstallType = Bundle | FHS deriving Eq   main :: IO ()@@ -92,11 +93,24 @@       copyTree (optRsrcCpVerbose opts) rsrcDirSrc (rsrcDir dirs)       return () +   -- Make the symlink+   when (optLink opts) $ do+      if (optInstType opts == FHS) then+         putStrLn "No link will be made because installation type is fhs"+      else if (not . optVersion $ opts) then+         putStrLn "No link will be made because the app dir already has no version part"+      else do+         printf "Making symbolic link now %s -> %s\n" (linkPath dirs) (appDir dirs)+         system $ printf "rm %s" (linkPath dirs)+         system $ printf "ln -s %s %s" (appDir dirs) (linkPath dirs)+         return ()+    exitSuccess   data Dirs = Dirs    { appDir :: FilePath+   , linkPath :: FilePath    , binDir :: FilePath    , docDir :: FilePath    , rsrcDir :: FilePath@@ -105,17 +119,18 @@  constructDirs :: Options -> PackageId -> Dirs constructDirs opts pkgId =-   Dirs appDir binDir' (appDir </> "doc") (appDir </> "resources")+   Dirs appDir' linkPath' binDir' (appDir' </> "doc") (appDir' </> "resources")     where       project = unPackageName . pkgName $ pkgId       version = showVersion . pkgVersion $ pkgId       versionPart = if optVersion opts then "-" ++ version else ""-      appDir = case (optInstType opts) of+      appDir' = case (optInstType opts) of          Bundle -> optPrefix opts </> (project ++ versionPart)          FHS    -> optPrefix opts </> "share" </> (project ++ versionPart)+      linkPath' = optPrefix opts </> project       binDir' = case (optInstType opts) of-         Bundle -> appDir </> "bin"+         Bundle -> appDir' </> "bin"          FHS    -> optPrefix opts </> "bin"  @@ -134,6 +149,7 @@    { optClean :: Bool    , optDelete :: Bool    , optHelp :: Bool+   , optLink :: Bool    , optPrefix :: FilePath    , optRsrcCpVerbose :: Bool    , optInstType :: InstallType@@ -178,6 +194,14 @@    , Option ['h'] ["help"]       (NoArg (\opts -> opts { optHelp = True } ))       "This help information."+   , Option ['l'] ["link"]+      (NoArg (\opts -> opts { optLink = True } ))+      ("Create symlink PROJECT -> PROJECT-VERSION in PREFIX dir. Only useful for bundle installations. Does not work on Windows."+         ++ (defaultText . optLink $ defaultOptions))+   , Option ['L'] ["no-link"]+      (NoArg (\opts -> opts { optLink = True } ))+      ("Do not create symlink PROJECT -> PROJECT-VERSION in PREFIX dir."+         ++ (defaultText . not . optLink $ defaultOptions))    , Option ['p'] ["prefix"]       (ReqArg (\s opts -> opts { optPrefix = s } ) "PREFIX" )       (printf "Install prefix directory. Defaults to %s so what you'll end up with is %s/PROJECT-VERSION"@@ -233,6 +257,7 @@          , "bundle is sort-of a self-contained structure like this:"          , ""          , "  $PREFIX/"+         , "    $PROJECT -> $PROJECT-$VERSION    <-- if --link was specified"          , "    $PROJECT-$VERSION/    <-- this is the \"app directory\""          , "      bin/..."          , "      doc/LICENSE"