Commit 843cd63a authored by Michael Hanus's avatar Michael Hanus
Browse files

CPM updated

parent 51387887
...@@ -53,7 +53,7 @@ cpmBanner :: String ...@@ -53,7 +53,7 @@ cpmBanner :: String
cpmBanner = unlines [bannerLine,bannerText,bannerLine] cpmBanner = unlines [bannerLine,bannerText,bannerLine]
where where
bannerText = bannerText =
"Curry Package Manager <curry-language.org/tools/cpm> (version of 12/01/2018)" "Curry Package Manager <curry-language.org/tools/cpm> (version of 15/01/2018)"
bannerLine = take (length bannerText) (repeat '-') bannerLine = take (length bannerText) (repeat '-')
main :: IO () main :: IO ()
...@@ -217,7 +217,9 @@ data DocOptions = DocOptions ...@@ -217,7 +217,9 @@ data DocOptions = DocOptions
, docManual :: Bool -- generate manual (if specified) , docManual :: Bool -- generate manual (if specified)
, docGenImports :: Bool -- generate documentation for imported pkgs , docGenImports :: Bool -- generate documentation for imported pkgs
-- (otherwise, use their standard docs) -- (otherwise, use their standard docs)
} , docPackageURL :: String -- the URL prefix where all repository
-- packages are documented
}
data TestOptions = TestOptions data TestOptions = TestOptions
{ testModules :: Maybe [String] } { testModules :: Maybe [String] }
...@@ -297,7 +299,13 @@ execOpts s = case optCommand s of ...@@ -297,7 +299,13 @@ execOpts s = case optCommand s of
docOpts :: Options -> DocOptions docOpts :: Options -> DocOptions
docOpts s = case optCommand s of docOpts s = case optCommand s of
Doc opts -> opts Doc opts -> opts
_ -> DocOptions Nothing Nothing True True False _ -> DocOptions Nothing Nothing True True False defaultBaseDocURL
-- The default URL prefix where all repository packages are documented.
-- Can be overwritten with a doc command option.
defaultBaseDocURL :: String
defaultBaseDocURL = "https://www.informatik.uni-kiel.de/~curry/cpm/DOC"
testOpts :: Options -> TestOptions testOpts :: Options -> TestOptions
testOpts s = case optCommand s of testOpts s = case optCommand s of
...@@ -544,7 +552,7 @@ optionParser allargs = optParser ...@@ -544,7 +552,7 @@ optionParser allargs = optParser
docArgs = docArgs =
option (\s a -> Right $ a { optCommand = option (\s a -> Right $ a { optCommand =
Doc (docOpts a) { docDir = Just $ s } }) Doc (docOpts a) { docDir = Just s } })
( long "docdir" ( long "docdir"
<> short "d" <> short "d"
<> help "The documentation directory (default: 'cdoc')" <> help "The documentation directory (default: 'cdoc')"
...@@ -575,6 +583,13 @@ optionParser allargs = optParser ...@@ -575,6 +583,13 @@ optionParser allargs = optParser
<> long "full" <> long "full"
<> help "Generate full program documentation (i.e., also imported packages)" <> help "Generate full program documentation (i.e., also imported packages)"
<> optional ) <> optional )
<.> option (\s a -> Right $ a { optCommand =
Doc (docOpts a) { docPackageURL = s } })
( long "url"
<> short "u"
<> help ("The URL prefix where all repository packages are " ++
"documented. Default: " ++ defaultBaseDocURL)
<> optional )
testArgs = testArgs =
option (\s a -> Right $ a { optCommand = Test (testOpts a) option (\s a -> Right $ a { optCommand = Test (testOpts a)
...@@ -1224,16 +1239,12 @@ genDocForPrograms opts cfg docdir specDir pkg = do ...@@ -1224,16 +1239,12 @@ genDocForPrograms opts cfg docdir specDir pkg = do
isImportedPackage d = importPkgDir `isPrefixOf` d isImportedPackage d = importPkgDir `isPrefixOf` d
impPkg2URL p = impPkg2URL p =
let (d,_) = break isPathSeparator (drop (length importPkgDir) p) let (d,_) = break isPathSeparator (drop (length importPkgDir) p)
in baseDocURL ++ "/" ++ d in docPackageURL opts ++ "/" ++ d
in map (\ip -> (ip,impPkg2URL ip)) (filter isImportedPackage dirs) ++ in map (\ip -> (ip,impPkg2URL ip)) (filter isImportedPackage dirs) ++
if name pkg == "base" if name pkg == "base"
then [] -- in order to generate base package documentation then [] -- in order to generate base package documentation
else [(installDir </> "lib", else [(installDir </> "lib",
baseDocURL ++ "/base-" ++ compilerBaseVersion cfg)] docPackageURL opts ++ "/base-" ++ compilerBaseVersion cfg)]
-- The URL prefix where all repository packages are documented.
baseDocURL :: String
baseDocURL = "http://www.informatik.uni-kiel.de/~mh/curry/cpm/DOC"
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
--- `test` command: run `curry check` on the modules provided as an argument --- `test` command: run `curry check` on the modules provided as an argument
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment