packages feed

dash-haskell 1.1.0.1 → 1.1.0.2

raw patch · 5 files changed

+99/−93 lines, 5 files

Files

README.md view
@@ -4,19 +4,19 @@    **direct to browser lookup:**   ![look-up](/img/lookup.png?raw=true)-  +   **keyword, module, and package searching:**   ![listing](/img/listing.png?raw=true)  dash-haskell facilitates Haskell documentation in IDE(s) with the following qualities:-  +   * **Local**      Documentation is stored in [dash](http://kapeli.com/dash) docsets on the filesystem,     avoiding the need to query **often inaccurate, version lagged** information from a remote resource such as *hackage*,     *hoogle*, or *hayoo*.-    +   * **Resolved from Project Dependencies**      With dash-haskell, one can build dash docsets from:@@ -25,14 +25,14 @@      * an arbitrary package db    * **Scope Narrowed**-    +     IDE plugins such as [helm-dash](https://github.com/areina/helm-dash)     allow for only specific docsets to be active. This means that     when searching for an identifier, e.g. *fromJust*, only the     packages you've built in your configuration are searched. Searches     can then be further narrowed by module etc. -  * **Prolifically Standardized** +  * **Prolifically Standardized**      [dash docsets](http://kapeli.com/dash) are an open, easily assimilated standard, and     are used across many IDE(s).@@ -45,7 +45,7 @@  ```dash-haskell parsec-3.1.5 ``` -builds ```docsets/parsec-3.1.5.docset``` using the default db ordering (global, user). +builds ```docsets/parsec-3.1.5.docset``` using the default db ordering (global, user).  Note: haddock documentation for the package must first be built prior to calling dash-haskell on it, e.g. ```@@ -59,7 +59,7 @@ Summary ======= ```-dash-haskell v1.1.0.1, a dash docset construction tool for Haskell packages+dash-haskell v1.1.0.2, a dash docset construction tool for Haskell packages  Usage: dash-haskell [-o|--output <dir>] [-q|--quiet] [-c|--cabal <file.cabal>]                     [-x|--cabal-excludes ghc,lens..] [-s|--sandbox]@@ -97,7 +97,7 @@ ```  $ git clone http://www.github.com/jfeltz/dash-haskell  $ cd dash-haskell- $ cabal install + $ cabal install ```  Package Resolution@@ -118,16 +118,16 @@   * [helm](https://github.com/emacs-helm/helm) , a fuzzy finder plugin for emacs   * [helm-dash](https://github.com/areina/helm-dash) , the essential extension to helm in order to lookup dash docsets -  For limiting helm-dash to project specific docsets, the following also helps. +  For limiting helm-dash to project specific docsets, the following also helps.    ```lisp-(defun activate-package-docsets (root) +(defun activate-package-docsets (root)   (progn-     (setq helm-dash-docsets-path root) +     (setq helm-dash-docsets-path root)      (setq helm-dash-common-docsets (helm-dash-installed-docsets))-      -     (message -      (format "activated %d docsets from: %s" ++     (message+      (format "activated %d docsets from: %s"         (length helm-dash-common-docsets) root))   ))   ```@@ -148,7 +148,7 @@   set pre-built criteria, pre-built skipping, project package sync.   and provide a ```--rebuild``` to force rebuild of a docset -* **version biasing** +* **version biasing**    provide option to bias package version to highest when it is otherwise ambiguous @@ -157,13 +157,13 @@   provide summary information to help users better understand which   packages failed and succeeded -* ```conf``` argument support +* ```conf``` argument support -    build docset directly from a package db .conf +    build docset directly from a package db .conf -* ```doc``` argument +* ```doc``` argument -    build docsets directly from a package doc directory +    build docsets directly from a package doc directory     (containing the requisite ```*.haddock``` interface and html files)  Contributors
dash-haskell.cabal view
@@ -1,5 +1,5 @@ name:                dash-haskell-version:             1.1.0.1+version:             1.1.0.2 synopsis:            Convert package Haddock to Dash docsets (IDE docs) homepage:            http://www.github.com/jfeltz/dash-haskell Bug-reports:         https://github.com/jfeltz/dash-haskell/issues@@ -7,13 +7,13 @@ license-file:        LICENSE author:              John P. Feltz maintainer:          jfeltz@gmail.com-copyright:           (c) 2014, 2015 John P. Feltz +copyright:           (c) 2014, 2015 John P. Feltz category:            Documentation build-type:          Simple cabal-version:       >= 1.22-extra-source-files:  README.md +extra-source-files:  README.md -description: +description:   A Dash.app docset is a file-layout for allowing easy lookup and   indexing of programming docs, e.g. API functions and modules. A   number of plugins offer docset lookup in editors such as Emacs and@@ -34,7 +34,7 @@   >./docsets/parsec-3.1.5.docset   .   >$ dash-haskell -c foo.cabal -s-  .           +  .   builds all packages listed as dependencies in the cabal file, using the   default db ordering (global, sandbox, user).   .@@ -44,7 +44,7 @@   .   Versions:   .-  The version numbering scheme for this package is defined as follows, given: +  The version numbering scheme for this package is defined as follows, given:   .   >dash-haskell-a.b.c.d   .
src/Main.hs view
@@ -10,26 +10,26 @@ import           Pipe.FileSystem import           Pipes import           System.Environment-    + -- | This yields requested packages from command line and cabal file, if any.-prod_Dependencies :: O.Options -> ProducerM C.Dependency () +prod_Dependencies :: O.Options -> ProducerM C.Dependency () prod_Dependencies options = do   cabal_deps <- lift cabalDeps   let deps = cabal_deps ++ O.packages options-  if L.null deps then +  if L.null deps then     liftIO $ putStrLn "quitting due to no package dependencies evaluated"   else     each . nub' $ deps   where     -- This produces a version disjoint package list from the cabal file.     cabalDeps :: M [C.Dependency]-    cabalDeps =  -      maybe +    cabalDeps =+      maybe         (return []) (`readPackages` (S.fromList $ O.cabalExclusions options)) $         O.cabalFile options  main :: IO ()-main = do +main = do   args <- getArgs   case L.partition (== "help") args of     ([], args') -> do@@ -37,14 +37,14 @@        runM (newEnv (not . O.quiet $ options)) . runEffect $         -- writes converted html, haddock, and sql db-        cons_writeFiles (O.outputDir options) +        cons_writeFiles (O.outputDir options)         <-< pipe_PackageConf options  -- yields vetted package configs-        <-< prod_Dependencies options -- produces dependencies from options +        <-< prod_Dependencies options -- produces dependencies from options     (_, rest) -> toHelp docs rest-  -  where ++  where    parserInfo :: ParserInfo O.Options    parserInfo = info (helper <*> O.parser)  $-     header "dash-haskell v1.1.0.1, a dash docset construction tool for Haskell packages"+     header "dash-haskell v1.1.0.2, a dash docset construction tool for Haskell packages"      <> progDesc "additional help is available with \"dash-haskell help <topic|option>\""      <> footer "http://www.github.com/jfeltz/dash-haskell (C) John P. Feltz 2014, 2015"
src/Options.hs view
@@ -26,7 +26,8 @@ } deriving Show  parser :: Parser Options-parser = Options <$> +parser =+  Options <$>    (strOption $      long "output"      <> short 'o'
src/Pipe/Conf.hs view
@@ -3,7 +3,7 @@ import Control.Monad.IO.Class import Control.Monad.M import PackageConf-import FilePath       +import FilePath import Text.ParserCombinators.Parsec hiding (State) import qualified Distribution.InstalledPackageInfo   as CI import qualified Distribution.Simple.Compiler        as CC@@ -28,90 +28,95 @@  field :: String -> Parser String field str =-  string str +  string str   >> char ':'-  >> many (char ' ') +  >> many (char ' ')   >> manyTill anyToken (void (char '\n') <|> eof) -singleField :: String -> Parser String -singleField str = try (field str) <|> (anyToken >> singleField str) - -parsedDbPath :: String -> M String +singleField :: String -> Parser String+singleField str = try (field str) <|> (anyToken >> singleField str)++parsedDbPath :: String -> M String parsedDbPath path = do   buf <- liftIO $ readFile path   fromE $ runParser (singleField "package-db") () path buf  cabalSandboxConfig :: FilePath-cabalSandboxConfig = "./cabal.sandbox.config"       +cabalSandboxConfig = "./cabal.sandbox.config"  cabalDb :: Db -> M CC.PackageDB-cabalDb db = +cabalDb db =   case db of-    (Global   ) -> return CC.GlobalPackageDB-    (User     ) -> return CC.UserPackageDB-    (Dir  p) ->-      fromCheck =<< liftIO (checkDir p "b") -    s@(Sandbox) ->-      fromCheck =<< liftIO (checkFile cabalSandboxConfig (show s)) -  where-    fromCheck Nothing        =-      CC.SpecificPackageDB <$> parsedDbPath cabalSandboxConfig -    fromCheck (Just err_str) =-      err err_str -        +    (Global ) -> return CC.GlobalPackageDB+    (User   ) -> return CC.UserPackageDB+    (Dir  p ) -> do+      fromCheck p =<< liftIO (checkDir p "package-db")+    s@(Sandbox) -> do+      result <- liftIO $ checkFile cabalSandboxConfig (show s)+      case result of+        Nothing -> do+          db'    <- parsedDbPath cabalSandboxConfig+          fromCheck db' =<< liftIO (checkDir db' "sandbox package-db")+        Just error_str ->+          err error_str+   where+     fromCheck :: FilePath -> Maybe String -> M CC.PackageDB+     fromCheck path Nothing          = return $ CC.SpecificPackageDB path+     fromCheck _    (Just error_str) = err error_str+ ghcVersionRange :: CV.VersionRange-ghcVersionRange = - CV.intersectVersionRanges -   (CV.orLaterVersion (CV.Version [7,10]   [])) -   (CV.earlierVersion (CV.Version [7,10,2] [])) +ghcVersionRange =+ CV.intersectVersionRanges+   (CV.orLaterVersion (CV.Version [7,10]   []))+   (CV.earlierVersion (CV.Version [7,10,2] [])) -toIndex :: [CC.PackageDB] -> M CI.InstalledPackageIndex -toIndex stack = do +toIndex :: [CC.PackageDB] -> M CI.InstalledPackageIndex+toIndex stack = do   version <- liftIO $ CP.programFindVersion CP.ghcPkgProgram CVB.normal "ghc-pkg"   case version of     Nothing ->       warning $         "unable to determine ghc-pkg version, \n" ++ clause     Just v ->-      unless (CV.withinRange v ghcVersionRange) $ +      unless (CV.withinRange v ghcVersionRange) $         warning $           "ghc-pkg version: "           ++ show (CT.disp v) ++ " not within allowable range,\n"           ++ clause   liftIO $ do-    minimal_programs <- CP.configureAllKnownPrograms CVB.normal $ +    minimal_programs <- CP.configureAllKnownPrograms CVB.normal $       CP.restoreProgramDb [CP.ghcPkgProgram, CP.ghcProgram] CP.emptyProgramDb      CG.getInstalledPackages CVB.silent stack minimal_programs   where     clause :: String-    clause = -      "results may not match current supported haddock: " -      ++ show (CT.disp ghcVersionRange) +    clause =+      "results may not match current supported haddock: "+      ++ show (CT.disp ghcVersionRange) -fromIndex :: C.Dependency -> CI.InstalledPackageIndex -> Maybe PackageConf -fromIndex dep index = -  let +fromIndex :: C.Dependency -> CI.InstalledPackageIndex -> Maybe PackageConf+fromIndex dep index =+  let     -- For clarity:     versions :: [(CV.Version, [CI.InstalledPackageInfo])]     versions = CI.lookupDependency index dep   in-    listToMaybe . catMaybes . concatMap (map toConf . snd) $ versions +    listToMaybe . catMaybes . concatMap (map toConf . snd) $ versions   where-    toConf :: CI.InstalledPackageInfo -> Maybe PackageConf -    toConf info = do +    toConf :: CI.InstalledPackageInfo -> Maybe PackageConf+    toConf info = do       interfaceFile' <- listToMaybe $ CI.haddockInterfaces info       htmlDir'       <- listToMaybe $ CI.haddockHTMLs info-      return $ -        PackageConf +      return $+        PackageConf           (Ghc.stringToPackageKey . show . CT.disp $ CI.sourcePackageId info)-          interfaceFile' htmlDir' +          interfaceFile' htmlDir'           (CI.exposed info)  toOptionDbs :: O.Options -> S.Set Db-toOptionDbs options = -  S.fromList . catMaybes $ -    (Dir <$> O.db options) +toOptionDbs options =+  S.fromList . catMaybes $+    (Dir <$> O.db options)     : map (uncurry toMaybe)         [ (not $ O.nouser options, User), (O.sandbox options, Sandbox) ] @@ -122,10 +127,10 @@   if S.null s then     Right []   else-    Left $ "failed to match package db(s) with defined ordering, dbs:\n" ++ +    Left $ "failed to match package db(s) with defined ordering, dbs:\n" ++            (indenting 2 . listing $ S.toList s)-fromOrdering (o:ordering) s =  -  if not $ S.member o s then +fromOrdering (o:ordering) s =+  if not $ S.member o s then     fromOrdering ordering s   else     case L.find (o ==) (S.elems s) of@@ -134,7 +139,7 @@  pipe_PackageConf :: O.Options -> PipeM C.Dependency PackageConf () pipe_PackageConf options = do-  index <- lift $ do +  index <- lift $ do     dbs <- -- Right now the cabal API requires a global db,           -- and for that to be first.       (Global:)@@ -147,18 +152,18 @@     toIndex =<< stackreverse <$> mapM cabalDb dbs   forever $ do     dep <- await-    case fromIndex dep index of -      Nothing -> -        lift . warning $ -          "failed to find suitable documentation candidate for package:\n " -          ++ (show . CT.disp $ dep) +    case fromIndex dep index of+      Nothing ->+        lift . warning $+          "failed to find suitable documentation candidate for package:\n "+          ++ (show . CT.disp $ dep)       Just conf -> do         strings <- liftIO $ problems conf         if L.null strings then           yield conf         else do-          lift . warning $ -            "skipping package: " ++ show (CT.disp dep) ++ ", with conf problems:\n" +          lift . warning $+            "skipping package: " ++ show (CT.disp dep) ++ ", with conf problems:\n"              ++ indenting 2 (listing strings)           return ()   where@@ -166,4 +171,4 @@     -- Cabal right now actually evaluates the stack from right to left.     -- not left to right.. and we still have to preserve the first member     -- (Global)-    stackreverse s = head s : L.reverse (drop 1 s) +    stackreverse s = head s : L.reverse (drop 1 s)