epub-tools 1.0.0.0 → 1.0.0.1
raw patch · 13 files changed
+862/−957 lines, 13 filesdep +HUnitdep ~basesetup-changed
Dependencies added: HUnit
Dependency ranges changed: base
Files
- Setup.hs +2/−11
- TODO +0/−11
- doc/INSTALL +0/−24
- doc/dev/notes +0/−12
- epub-tools.cabal +62/−9
- src/EpubTools/EpubMeta/Opts.hs +1/−1
- src/EpubTools/EpubName/Opts.hs +1/−1
- src/EpubTools/EpubZip/Opts.hs +1/−1
- testsuite/epubname.hs +795/−0
- testsuite/runtests.hs +0/−786
- util/all-books.sh +0/−17
- util/prefs/boring +0/−69
- util/win-dist.sh +0/−15
Setup.hs view
@@ -1,19 +1,10 @@ #! /usr/bin/env runhaskell --- Copyright: 2008-2011 Dino Morelli+-- Copyright: 2008, 2011 Dino Morelli -- License: BSD3 (see LICENSE) -- Author: Dino Morelli <dino@ui3.info> import Distribution.Simple-import System.Cmd ( system ) -main = defaultMainWithHooks (simpleUserHooks - { runTests = testRunner- } )-- where- -- Target for running all unit tests- testRunner _ _ _ _ = do- system $ "runhaskell -isrc testsuite/runtests.hs"- return ()+main = defaultMain
− TODO
@@ -1,11 +0,0 @@-------general--- Some notes in README about installing epubcheck if possible---------epubmeta--- Maybe more options for modifying metadata from the command-line-
− doc/INSTALL
@@ -1,24 +0,0 @@-Installation information for the Windows binary distribution---First, understand that this is command-line software. You don't run-it with the mouse. There is no icon. It's not going in your Start-menu. It's to be run from within a command shell.---These epub tools will run from the Windows cmd.exe shell.--Even better, what I would do is install the cygwin tools and run-them from a bash or similar shell. Having cygwin in place, I would-place the binaries in /usr/local/bin, which should be on your PATH-in cygwin shells. And you're good to go.---For help, try this in your shell:-- > epubmeta.exe --help- > epubname.exe --help- > epubzip.exe --help---And if you find bugs or problems, email: dino@ui3.info
− doc/dev/notes
@@ -1,12 +0,0 @@-This project may benefit from the use of some other tools out here-such as epubcheck, zip and unzip--- Tools unzipping can try to fall back on unzip upon failure--- epubmeta needs write capability--- epub creation, think about this--- always release Windows binaries--- OSX too?
epub-tools.cabal view
@@ -1,6 +1,6 @@ name: epub-tools-cabal-version: >= 1.2-version: 1.0.0.0+cabal-version: >= 1.8+version: 1.0.0.1 build-type: Simple license: BSD3 license-file: LICENSE@@ -12,15 +12,27 @@ synopsis: Command line utilities for working with epub files description: A suite of command-line utilities for creating and manipulating epub book files. Included are: epubmeta, epubname, epubzip category: Application, Console-tested-with: GHC >= 6.12.3+tested-with: GHC >= 7.0.3+extra-source-files: testsuite/*.hs +source-repository head+ type: darcs+ location: http://ui3.info/darcs/epub-tools/+ executable epubmeta main-is: EpubTools/epubmeta.hs- build-depends: base >= 3 && < 5, bytestring, epub-metadata >= 2.2, - process, zip-archive+ build-depends: base >= 3 && < 5, bytestring, directory,+ epub-metadata >= 2.2, filepath, mtl, process,+ zip-archive hs-source-dirs: src+ other-modules: EpubTools.EpubMeta.Display+ EpubTools.EpubMeta.Edit+ EpubTools.EpubMeta.Export+ EpubTools.EpubMeta.Import+ EpubTools.EpubMeta.Opts+ EpubTools.EpubMeta.Util - -- To strip debug symbols from the binary, for Windows, not portable+ -- Strip symbols from binary, for Windows, not portable, see [1] below --ghc-options: -Wall -optl-s ghc-options: -Wall @@ -29,16 +41,57 @@ build-depends: base >= 3 && < 5, directory, epub-metadata >= 2.2, mtl, regex-compat hs-source-dirs: src+ other-modules: EpubTools.EpubName.Format.Anonymous+ EpubTools.EpubName.Format.AuthorBasic+ EpubTools.EpubName.Format.AuthorDouble+ EpubTools.EpubName.Format.AuthorSt+ EpubTools.EpubName.Format.AuthorThird+ EpubTools.EpubName.Format.MagAeon+ EpubTools.EpubName.Format.MagAnalog+ EpubTools.EpubName.Format.MagApex+ EpubTools.EpubName.Format.MagBcs+ EpubTools.EpubName.Format.MagChallengingDestiny+ EpubTools.EpubName.Format.MagClarkesworld+ EpubTools.EpubName.Format.MagEclipse+ EpubTools.EpubName.Format.MagFsf+ EpubTools.EpubName.Format.MagFutureOrbits+ EpubTools.EpubName.Format.MagGud+ EpubTools.EpubName.Format.MagInterzone+ EpubTools.EpubName.Format.MagLightspeed+ EpubTools.EpubName.Format.MagNameIssue+ EpubTools.EpubName.Format.MagNemesis+ EpubTools.EpubName.Format.MagRageMachine+ EpubTools.EpubName.Format.MagSomethingWicked+ EpubTools.EpubName.Format.MagUniverse+ EpubTools.EpubName.Format.SFBestOf+ EpubTools.EpubName.Formatters+ EpubTools.EpubName.Format.Util+ EpubTools.EpubName.Opts+ EpubTools.EpubName.Util - -- To strip debug symbols from the binary, for Windows, not portable+ -- Strip symbols from binary, for Windows, not portable, see [1] below --ghc-options: -Wall -optl-s ghc-options: -Wall +test-suite epubname-tests+ type: exitcode-stdio-1.0+ main-is: epubname.hs+ build-depends: base, epub-metadata >= 2.2, HUnit, mtl, regex-compat+ hs-source-dirs: src testsuite+ ghc-options: -Wall+ executable epubzip main-is: EpubTools/epubzip.hs- build-depends: base >= 3 && < 5, epub-metadata >= 2.2, filepath+ build-depends: base >= 3 && < 5, directory, epub-metadata >= 2.2,+ filepath, mtl, regex-compat hs-source-dirs: src+ other-modules: EpubTools.EpubZip.Opts - -- To strip debug symbols from the binary, for Windows, not portable+ -- Strip symbols from binary, for Windows, not portable, see [1] below --ghc-options: -Wall -optl-s ghc-options: -Wall+++-- [1] The right way to handle this should be an if os(windows) block+-- but that makes this package unacceptable to Hackage. Sorry,+-- you'll have to use comments to switch this on.
src/EpubTools/EpubMeta/Opts.hs view
@@ -103,5 +103,5 @@ , "" , "For more information please see the IDPF OPF specification found here: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm" , ""- , "Version 1.0.0.0 Dino Morelli <dino@ui3.info>"+ , "Version 1.0.0.1 Dino Morelli <dino@ui3.info>" ]
src/EpubTools/EpubName/Opts.hs view
@@ -110,5 +110,5 @@ , "" , "For more information please see the IDPF OPF specification found here: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm" , ""- , "Version 1.0.0.0 Dino Morelli <dino@ui3.info>"+ , "Version 1.0.0.1 Dino Morelli <dino@ui3.info>" ]
src/EpubTools/EpubZip/Opts.hs view
@@ -68,5 +68,5 @@ , "" , "For more information please see the IDPF OPF specification found here: http://idpf.org/epub/20/spec/OPF_2.0.1_draft.htm" , ""- , "Version 1.0.0.0 Dino Morelli <dino@ui3.info>"+ , "Version 1.0.0.1 Dino Morelli <dino@ui3.info>" ]
+ testsuite/epubname.hs view
@@ -0,0 +1,795 @@+-- Copyright: 2008-2011 Dino Morelli+-- License: BSD3 (see LICENSE)+-- Author: Dino Morelli <dino@ui3.info>++module Main+ where++import Codec.Epub.Opf.Package.Metadata+import System.Exit+import Test.HUnit ( Counts (..), Test (..), assertEqual, runTestTT )+import Test.HUnit.Base ( Assertion )++import EpubTools.EpubName.Formatters ( tryFormatting )+import EpubTools.EpubName.Opts+import EpubTools.EpubName.Util+++main :: IO ()+main = do+ counts <- runTestTT tests+ exit $ testsPassed counts+++exit :: Bool -> IO ()+exit True = exitWith ExitSuccess+exit False = exitWith $ ExitFailure 1+++testsPassed :: Counts -> Bool+testsPassed (Counts _ _ e f) = (e == 0) && (f == 0)+++tests :: Test+tests = TestList+ [ testAuthorMinimal+ , testAuthorRole+ , testAuthorFileas+ , testAuthorFull+ , testAuthorDoubleAnd+ , testNoAuthor+ , testNoAuthorPubDate+ , testCapsTitle+ , testColon+ , testBracketTitle+ , testNoTitle+ , testAllPunctuation+ , testPubYear+ , testPubYearUnwanted+ , testMagAeon+ , testMagAEon+ , testMagApexLong+ , testMagApexShort+ , testChallengingDestinyShort+ , testChallengingDestinyLong+ , testChallengingDestinyPub+ , testAnalog+ , testAsimovs+ , testFsfShort+ , testFsfLong+ , testMagFutureOrbits+ , testGudShort+ , testGudLong+ , testInterzoneShort+ , testInterzoneLong+ , testNemesisShort+ , testNemesisLong+ , testMagSomethingWicked+ , testSFBestOf+ , testMagBlackStatic+ , testRageMachineMag+ , testEclipseMag+ , testBcs+ , testBkpFileAs+ , testBkpText+ , testBkpMissing+ , testMagUniverse+ , testMagClarkesworld+ ]+++assertNewNameOpts :: Options -> String -> Metadata + -> (String, String) -> Assertion+assertNewNameOpts opts desc meta expected = do+ result <- runEN opts $ tryFormatting ("", meta)+ let actual = either (\em -> ("NO FORMATTER", em)) id result+ assertEqual desc expected actual+++assertNewName :: String -> Metadata -> (String, String) -> Assertion+assertNewName = assertNewNameOpts defaultOptions+++testAuthorMinimal :: Test+testAuthorMinimal = TestCase $+ assertNewName "minimal author" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing "Herman Melville"]+ , metaTitles = [MetaTitle Nothing "Moby Dick"]+ }+ expected =+ ( "AuthorBasic"+ , "MelvilleHerman-MobyDick.epub"+ )+++testAuthorRole :: Test+testAuthorRole = TestCase $+ assertNewName "author with role" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut") Nothing+ "Herman Melville"]+ , metaTitles = [MetaTitle Nothing "Moby Dick"]+ }+ expected =+ ( "AuthorBasic"+ , "MelvilleHerman-MobyDick.epub"+ )+++testAuthorFileas :: Test+testAuthorFileas = TestCase $+ assertNewName "author with file-as" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing+ (Just "Melville, Herman")+ "Herman Melville"]+ , metaTitles = [MetaTitle Nothing "Moby Dick"]+ }+ expected =+ ( "AuthorBasic"+ , "MelvilleHerman-MobyDick.epub"+ )+++testAuthorFull :: Test+testAuthorFull = TestCase $+ assertNewName "author fully filled out" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut")+ (Just "Melville, Herman")+ "Herman Melville"]+ , metaTitles = [MetaTitle Nothing "Moby Dick"]+ }+ expected =+ ( "AuthorBasic"+ , "MelvilleHerman-MobyDick.epub"+ )+++testNoAuthor :: Test+testNoAuthor = TestCase $+ assertNewName "no author(s) at all" meta expected+ where+ meta = emptyMetadata+ { metaCreators =+ [ MetaCreator (Just "edt") Nothing+ "Graham Spindlewest"+ , MetaCreator (Just "ill") Nothing+ "Eva Tunglewacker"+ ]+ , metaTitles = [MetaTitle Nothing+ "Some Collection of Fine Stories, Volume 1"]+ }+ expected =+ ( "SFBestOf"+ , "SomeCollectionOfFineStoriesVolume1.epub"+ )+++testNoAuthorPubDate :: Test+testNoAuthorPubDate = TestCase $+ assertNewName "no author(s) at all, with publication date" + meta expected+ where+ meta = emptyMetadata+ { metaCreators =+ [ MetaCreator (Just "edt") Nothing+ "Graham Spindlewest"+ , MetaCreator (Just "ill") Nothing+ "Eva Tunglewacker"+ ]+ , metaTitles = [MetaTitle Nothing+ "Some Collection of Fine Stories, Volume 1"]+ , metaDates = [MetaDate (Just "original-publication")+ "2008"]+ }+ expected =+ ( "SFBestOf"+ , "SomeCollectionOfFineStoriesVolume1_2008.epub"+ )+++testAuthorDoubleAnd :: Test+testAuthorDoubleAnd = TestCase $+ assertNewName "two authors separated by and" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing+ "Kevin J. Anderson and Rebecca Moesta"]+ , metaTitles = [MetaTitle Nothing "Rough Draft"]+ }+ expected =+ ( "AuthorDouble"+ , "Anderson_Moesta-RoughDraft.epub"+ )+++testCapsTitle :: Test+testCapsTitle = TestCase $+ assertNewName "title all caps" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing "Greg Bear"]+ , metaTitles = [MetaTitle Nothing "EON"]+ }+ expected =+ ( "AuthorBasic"+ , "BearGreg-Eon.epub"+ )+++testColon :: Test+testColon = TestCase $+ assertNewName "colon becomes underscore" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing "Ed Howdershelt"]+ , metaTitles = [MetaTitle Nothing + "Book 1: 3rd World Products, Inc."]+ }+ expected =+ ( "AuthorBasic"+ , "HowdersheltEd-Book1_3rdWorldProductsInc.epub"+ )+++testBracketTitle :: Test+testBracketTitle = TestCase $+ assertNewName "title with brackets" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing "Mercedes Lackey"]+ , metaTitles = [MetaTitle Nothing "SKitty [Shipscat series #1]"]+ }+ expected =+ ( "AuthorBasic"+ , "LackeyMercedes-Skitty_ShipscatSeries1.epub"+ )+++testNoTitle :: Test+testNoTitle = TestCase $+ assertNewName "missing title" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing+ "Nobody McCrankypants"]+ }+ expected =+ ( "NO FORMATTER"+ , " [ERROR No formatter found]"+ )+++testAllPunctuation :: Test+testAllPunctuation = TestCase $+ assertNewName "big test of all punctuation" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing+ "Dino Morelli"]+ , metaTitles = [MetaTitle Nothing+ "The *crazy*: Sand-box. Of Smedley's discontent, fear & Malnourishment? (Maybe not!); [Part #2]"]+ }+ expected =+ ( "AuthorBasic"+ , "MorelliDino-TheCrazy_SandBoxOfSmedleysDiscontentFearAndMalnourishmentMaybeNot_Part2.epub"+ )+++testPubYear :: Test+testPubYear = TestCase $+ assertNewName "book with a publication year" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing "Jim Jones"]+ , metaTitles = [MetaTitle Nothing "A Timeless Story"]+ , metaDates = [MetaDate (Just "original-publication") "2003"]+ }+ expected =+ ( "AuthorBasic"+ , "JonesJim-ATimelessStory_2003.epub"+ )+++testPubYearUnwanted :: Test+testPubYearUnwanted = TestCase $+ assertNewNameOpts opts+ "book with a publication year but we don't want"+ meta expected+ where+ opts = defaultOptions { optYear = False }+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing "Jim Jones"]+ , metaTitles = [MetaTitle Nothing "A Timeless Story"]+ , metaDates = [MetaDate (Just "original-publication") "2003"]+ }+ expected =+ ( "AuthorBasic"+ , "JonesJim-ATimelessStory.epub"+ )+++testMagAeon :: Test+testMagAeon = TestCase $+ assertNewName "Aeon magazine" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing "Aeon Authors"]+ , metaTitles = [MetaTitle Nothing "Aeon Eight"]+ }+ expected =+ ( "MagAeon"+ , "AeonMagazine08.epub"+ )+++testMagAEon :: Test+testMagAEon = TestCase $+ assertNewName "AEon magazine" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing "AEon Authors"]+ , metaTitles = [MetaTitle Nothing "Aeon Thirteen"]+ }+ expected =+ ( "MagAeon"+ , "AeonMagazine13.epub"+ )+++testMagApexLong :: Test+testMagApexLong = TestCase $+ assertNewName "Apex Magazine, older, long title" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut") Nothing+ "Apex Authors"]+ , metaTitles = [MetaTitle Nothing+ "Apex Science Fiction and Horror Digest #9"]+ }+ expected =+ ( "MagApex"+ , "ApexMagazine009.epub"+ )+++testMagApexShort :: Test+testMagApexShort = TestCase $+ assertNewName "Apex Magazine, newer, short title" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut") Nothing+ "Apex Authors"]+ , metaTitles = [MetaTitle Nothing+ "Apex Magazine Issue 17"]+ }+ expected =+ ( "MagApex"+ , "ApexMagazine017.epub"+ )+++testChallengingDestinyShort :: Test+testChallengingDestinyShort = TestCase $+ assertNewName "Challenging Destiny Magazine, short" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing+ "Crystalline Sphere Authors"]+ , metaTitles = [MetaTitle Nothing+ "Challenging Destiny #23"]+ }+ expected =+ ( "MagChallengingDestiny"+ , "ChallengingDestinyMagazine023.epub"+ )+++testChallengingDestinyLong :: Test+testChallengingDestinyLong = TestCase $+ assertNewName "Challenging Destiny Magazine, long" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "Crystalline Sphere Authors"]+ , metaTitles = [MetaTitle Nothing + "Challenging Destiny #24: August 2007"]+ }+ expected =+ ( "MagChallengingDestiny"+ , "ChallengingDestinyMagazine024.epub"+ )+++testChallengingDestinyPub :: Test+testChallengingDestinyPub = TestCase $+ assertNewName "Challenging Destiny Magazine, Publishing in author"+ meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "Crystalline Sphere Publishing"]+ , metaTitles = [MetaTitle Nothing + "Challenging Destiny #18"]+ }+ expected =+ ( "MagChallengingDestiny"+ , "ChallengingDestinyMagazine018.epub"+ )+++testAnalog :: Test+testAnalog = TestCase $+ assertNewName "Analog" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing+ "Dell Magazine Authors"]+ , metaTitles = [MetaTitle Nothing+ "Analog SFF, July-August 2003"]+ }+ expected =+ ( "MagAnalog"+ , "AnalogSF2003-07_08.epub"+ )+++testAsimovs :: Test+testAsimovs = TestCase $+ assertNewName "Asimovs" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing+ "Dell Magazine Authors"]+ , metaTitles = [MetaTitle Nothing+ "Asimov's SF, August 2003"]+ }+ expected =+ ( "MagAnalog"+ , "AsimovsSF2003-08.epub"+ )+++testFsfShort :: Test+testFsfShort = TestCase $+ assertNewName "FSF Magazine, short" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing+ "Spilogale Authors"]+ , metaTitles = [MetaTitle Nothing "FSF, April 2008"]+ }+ expected =+ ( "MagFsf"+ , "FantasyScienceFiction2008-04.epub"+ )+++testFsfLong :: Test+testFsfLong = TestCase $+ assertNewName "FSF Magazine, long" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "Spilogale Authors"]+ , metaTitles = [MetaTitle Nothing + "FSF Magazine, April 2006"]+ }+ expected =+ ( "MagFsf"+ , "FantasyScienceFiction2006-04.epub"+ )+++testMagFutureOrbits :: Test+testMagFutureOrbits = TestCase $+ assertNewName "testMagFutureOrbits" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "Vander Neut Publications, L.L.C."]+ , metaTitles = [MetaTitle Nothing + "Future Orbits Issue 5, June/July 2002"]+ }+ expected =+ ( "MagFutureOrbits"+ , "FutureOrbitsMagazine05_2002-06_07.epub"+ )+++testGudShort :: Test+testGudShort = TestCase $+ assertNewName "Gud Magazine, short" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "GUD Magazine Authors"]+ , metaTitles = [MetaTitle Nothing + "GUD Magazine Issue 0 :: Spring 2007"]+ }+ expected =+ ( "MagGud"+ , "GUDMagazine00.epub"+ )+++testGudLong :: Test+testGudLong = TestCase $+ assertNewName "Gud Magazine, long" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "GUD Magazine Authors, Jeff Somers, Jeremy Shipp"]+ , metaTitles = [MetaTitle Nothing + "GUD Magazine Issue 2 :: Spring 2008"]+ }+ expected =+ ( "MagGud"+ , "GUDMagazine02.epub"+ )+++testInterzoneShort :: Test+testInterzoneShort = TestCase $+ assertNewName "Interzone Magazine, short" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "TTA Press Authors"]+ , metaTitles = [MetaTitle Nothing + "Interzone SFF #212"]+ }+ expected =+ ( "MagInterzone"+ , "InterzoneSFF212.epub"+ )+++testInterzoneLong :: Test+testInterzoneLong = TestCase $+ assertNewName "Interzone Magazine, long" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "TTA Press Authors"]+ , metaTitles = [MetaTitle Nothing + "Interzone Science Fiction and Fantasy Magazine #216"]+ }+ expected =+ ( "MagInterzone"+ , "InterzoneSFF216.epub"+ )+++testNemesisShort :: Test+testNemesisShort = TestCase $+ assertNewName "Nemesis Magazine, short" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "Stephen Adams"]+ , metaTitles = [MetaTitle Nothing + "Nemesis Magazine #2"]+ }+ expected =+ ( "MagNemesis"+ , "NemesisMag002.epub"+ )+++testNemesisLong :: Test+testNemesisLong = TestCase $+ assertNewName "Nemesis Magazine, long" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "Stephen Adams"]+ , metaTitles = [MetaTitle Nothing + "Nemesis Magazine #7: Featuring Victory Rose in Death Stalks the Ruins"]+ }+ expected =+ ( "MagNemesis"+ , "NemesisMag007.epub"+ )+++testMagSomethingWicked :: Test+testMagSomethingWicked = TestCase $+ assertNewName "Something Wicked Magazine" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "Something Wicked Authors"]+ , metaTitles = [MetaTitle Nothing + "Something Wicked SF and Horror Magazine #5"]+ }+ expected =+ ( "MagSomethingWicked"+ , "SomethingWickedMagazine05.epub"+ )+++testSFBestOf :: Test+testSFBestOf = TestCase $+ assertNewName "Science Fiction: The Best of the Year" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "Rich Horton"]+ , metaTitles = [MetaTitle Nothing + "Science Fiction: The Best of the Year, 2007 Edition"]+ }+ expected =+ ( "SFBestOf"+ , "ScienceFiction_TheBestOfTheYear2007Edition.epub"+ )+++testMagBlackStatic :: Test+testMagBlackStatic = TestCase $+ assertNewName "Black Static Magazine" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator Nothing Nothing + "TTA Press Authors"]+ , metaTitles = [MetaTitle Nothing + "Black Static Horror Magazine #5"]+ }+ expected =+ ( "MagNameIssue"+ , "BlackStaticHorrorMagazine05.epub"+ )+++testRageMachineMag :: Test+testRageMachineMag = TestCase $+ assertNewName "Rage Machine Magazine" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "edt") Nothing + "G. W. Thomas"]+ , metaTitles = [MetaTitle Nothing + "Rage Machine Magazine #1--December 2005"]+ }+ expected =+ ( "MagRageMachine"+ , "RageMachineMagazine1_2005-12.epub"+ )+++testEclipseMag :: Test+testEclipseMag = TestCase $+ assertNewName "Eclipse Magazine" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut")+ (Just "Strahan, Jonathan")+ "Jonathan Strahan"]+ , metaTitles = [MetaTitle Nothing + "Eclipse One"]+ }+ expected =+ ( "MagEclipse"+ , "Eclipse01.epub"+ )+++testBcs :: Test+testBcs = TestCase $+ assertNewName "Beneath Ceaseless Skies Magazine" meta expected+ where+ meta = emptyMetadata+ { metaCreators = + [ MetaCreator (Just "aut")+ (Just "Tidwell, Erin A.")+ "Hoover, Kenneth Mark"+ , MetaCreator (Just "aut")+ (Just "Tidwell, Erin A.")+ "Tidwell, Erin A."+ ]+ , metaTitles = [MetaTitle Nothing + "Beneath Ceaseless Skies #32"]+ }+ expected =+ ( "MagBcs"+ , "BeneathCeaselessSkies_Issue032.epub"+ )+++testBkpFileAs :: Test+testBkpFileAs = TestCase $+ assertNewNameOpts opts + "book publisher suffix requested and present in file-as"+ meta expected+ where+ opts = defaultOptions { optPublisher = True }+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut") Nothing+ "Herman Melville"]+ , metaContributors = [MetaCreator (Just "bkp") (Just "acme") + "Acme Publishing, Inc."]+ , metaTitles = [MetaTitle Nothing "Moby Dick"]+ }+ expected =+ ( "AuthorBasic"+ , "MelvilleHerman-MobyDick_acme.epub"+ )+++testBkpText :: Test+testBkpText = TestCase $+ assertNewNameOpts opts + "book publisher suffix requested and present in text"+ meta expected+ where+ opts = defaultOptions { optPublisher = True }+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut") Nothing+ "Herman Melville"]+ , metaContributors = [MetaCreator (Just "bkp") Nothing+ "Acme Publishing, Inc."]+ , metaTitles = [MetaTitle Nothing "Moby Dick"]+ }+ expected =+ ( "AuthorBasic"+ , "MelvilleHerman-MobyDick.epub"+ )+++testBkpMissing :: Test+testBkpMissing = TestCase $+ assertNewNameOpts opts + "book publisher suffix requested and not present"+ meta expected+ where+ opts = defaultOptions { optPublisher = True }+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut") Nothing+ "Herman Melville"]+ , metaTitles = [MetaTitle Nothing "Moby Dick"]+ }+ expected =+ ( "AuthorBasic"+ , "MelvilleHerman-MobyDick.epub"+ )+++testMagUniverse :: Test+testMagUniverse = TestCase $+ assertNewNameOpts opts + "Jim Baen's Universe Magazine"+ meta expected+ where+ opts = defaultOptions { optPublisher = True }+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut") Nothing+ "Jim Baen's Universe"]+ , metaTitles = [MetaTitle Nothing "Jim Baen's Universe-Vol 4 Num 6"]+ }+ expected =+ ( "MagUniverse"+ , "JimBaensUniverseVol04Num06.epub"+ )+++testMagClarkesworld :: Test+testMagClarkesworld = TestCase $+ assertNewName "Clarkesworld Magazine" meta expected+ where+ meta = emptyMetadata+ { metaCreators = [MetaCreator (Just "aut")+ (Just "Kowal, Mary Robinette")+ "Mary Robinette Kowal"]+ , metaTitles = [MetaTitle Nothing+ "Clarkesworld Magazine - Issue 21"]+ }+ expected =+ ( "MagClarkesworld"+ , "Clarkesworld021.epub"+ )
− testsuite/runtests.hs
@@ -1,786 +0,0 @@--- Copyright: 2008-2011 Dino Morelli--- License: BSD3 (see LICENSE)--- Author: Dino Morelli <dino@ui3.info>--module Main- where--import Codec.Epub.Opf.Package.Metadata-import Control.Monad.Error-import Test.HUnit ( Counts, Test (..), assertEqual, runTestTT )-import Test.HUnit.Base ( Assertion )--import EpubTools.EpubName.Formatters ( tryFormatting )-import EpubTools.EpubName.Opts-import EpubTools.EpubName.Util---assertNewNameOpts :: Options -> String -> Metadata - -> (String, String) -> Assertion-assertNewNameOpts opts desc meta expected = do- result <- runEN opts $ tryFormatting ("", meta)- let actual = either (\em -> ("NO FORMATTER", em)) id result- assertEqual desc expected actual---assertNewName :: String -> Metadata -> (String, String) -> Assertion-assertNewName = assertNewNameOpts defaultOptions---main :: IO ()-main = do- runTestTT tests- return ()---tests :: Test-tests = TestList- [ testAuthorMinimal- , testAuthorRole- , testAuthorFileas- , testAuthorFull- , testAuthorDoubleAnd- , testNoAuthor- , testNoAuthorPubDate- , testCapsTitle- , testColon- , testBracketTitle- , testNoTitle- , testAllPunctuation- , testPubYear- , testPubYearUnwanted- , testMagAeon- , testMagAEon- , testMagApexLong- , testMagApexShort- , testChallengingDestinyShort- , testChallengingDestinyLong- , testChallengingDestinyPub- , testAnalog- , testAsimovs- , testFsfShort- , testFsfLong- , testMagFutureOrbits- , testGudShort- , testGudLong- , testInterzoneShort- , testInterzoneLong- , testNemesisShort- , testNemesisLong- , testMagSomethingWicked- , testSFBestOf- , testMagBlackStatic- , testRageMachineMag- , testEclipseMag- , testBcs- , testBkpFileAs- , testBkpText- , testBkpMissing- , testMagUniverse- , testMagClarkesworld- ]---testAuthorMinimal :: Test-testAuthorMinimal = TestCase $- assertNewName "minimal author" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing "Herman Melville"]- , metaTitles = [MetaTitle Nothing "Moby Dick"]- }- expected =- ( "AuthorBasic"- , "MelvilleHerman-MobyDick.epub"- )---testAuthorRole :: Test-testAuthorRole = TestCase $- assertNewName "author with role" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut") Nothing- "Herman Melville"]- , metaTitles = [MetaTitle Nothing "Moby Dick"]- }- expected =- ( "AuthorBasic"- , "MelvilleHerman-MobyDick.epub"- )---testAuthorFileas :: Test-testAuthorFileas = TestCase $- assertNewName "author with file-as" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing- (Just "Melville, Herman")- "Herman Melville"]- , metaTitles = [MetaTitle Nothing "Moby Dick"]- }- expected =- ( "AuthorBasic"- , "MelvilleHerman-MobyDick.epub"- )---testAuthorFull :: Test-testAuthorFull = TestCase $- assertNewName "author fully filled out" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut")- (Just "Melville, Herman")- "Herman Melville"]- , metaTitles = [MetaTitle Nothing "Moby Dick"]- }- expected =- ( "AuthorBasic"- , "MelvilleHerman-MobyDick.epub"- )---testNoAuthor :: Test-testNoAuthor = TestCase $- assertNewName "no author(s) at all" meta expected- where- meta = emptyMetadata- { metaCreators =- [ MetaCreator (Just "edt") Nothing- "Graham Spindlewest"- , MetaCreator (Just "ill") Nothing- "Eva Tunglewacker"- ]- , metaTitles = [MetaTitle Nothing- "Some Collection of Fine Stories, Volume 1"]- }- expected =- ( "SFBestOf"- , "SomeCollectionOfFineStoriesVolume1.epub"- )---testNoAuthorPubDate :: Test-testNoAuthorPubDate = TestCase $- assertNewName "no author(s) at all, with publication date" - meta expected- where- meta = emptyMetadata- { metaCreators =- [ MetaCreator (Just "edt") Nothing- "Graham Spindlewest"- , MetaCreator (Just "ill") Nothing- "Eva Tunglewacker"- ]- , metaTitles = [MetaTitle Nothing- "Some Collection of Fine Stories, Volume 1"]- , metaDates = [MetaDate (Just "original-publication")- "2008"]- }- expected =- ( "SFBestOf"- , "SomeCollectionOfFineStoriesVolume1_2008.epub"- )---testAuthorDoubleAnd :: Test-testAuthorDoubleAnd = TestCase $- assertNewName "two authors separated by and" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing- "Kevin J. Anderson and Rebecca Moesta"]- , metaTitles = [MetaTitle Nothing "Rough Draft"]- }- expected =- ( "AuthorDouble"- , "Anderson_Moesta-RoughDraft.epub"- )---testCapsTitle :: Test-testCapsTitle = TestCase $- assertNewName "title all caps" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing "Greg Bear"]- , metaTitles = [MetaTitle Nothing "EON"]- }- expected =- ( "AuthorBasic"- , "BearGreg-Eon.epub"- )---testColon :: Test-testColon = TestCase $- assertNewName "colon becomes underscore" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing "Ed Howdershelt"]- , metaTitles = [MetaTitle Nothing - "Book 1: 3rd World Products, Inc."]- }- expected =- ( "AuthorBasic"- , "HowdersheltEd-Book1_3rdWorldProductsInc.epub"- )---testBracketTitle :: Test-testBracketTitle = TestCase $- assertNewName "title with brackets" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing "Mercedes Lackey"]- , metaTitles = [MetaTitle Nothing "SKitty [Shipscat series #1]"]- }- expected =- ( "AuthorBasic"- , "LackeyMercedes-Skitty_ShipscatSeries1.epub"- )---testNoTitle :: Test-testNoTitle = TestCase $- assertNewName "missing title" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing- "Nobody McCrankypants"]- }- expected =- ( "NO FORMATTER"- , " [ERROR No formatter found]"- )---testAllPunctuation :: Test-testAllPunctuation = TestCase $- assertNewName "big test of all punctuation" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing- "Dino Morelli"]- , metaTitles = [MetaTitle Nothing- "The *crazy*: Sand-box. Of Smedley's discontent, fear & Malnourishment? (Maybe not!); [Part #2]"]- }- expected =- ( "AuthorBasic"- , "MorelliDino-TheCrazy_SandBoxOfSmedleysDiscontentFearAndMalnourishmentMaybeNot_Part2.epub"- )---testPubYear :: Test-testPubYear = TestCase $- assertNewName "book with a publication year" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing "Jim Jones"]- , metaTitles = [MetaTitle Nothing "A Timeless Story"]- , metaDates = [MetaDate (Just "original-publication") "2003"]- }- expected =- ( "AuthorBasic"- , "JonesJim-ATimelessStory_2003.epub"- )---testPubYearUnwanted :: Test-testPubYearUnwanted = TestCase $- assertNewNameOpts opts- "book with a publication year but we don't want"- meta expected- where- opts = defaultOptions { optYear = False }- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing "Jim Jones"]- , metaTitles = [MetaTitle Nothing "A Timeless Story"]- , metaDates = [MetaDate (Just "original-publication") "2003"]- }- expected =- ( "AuthorBasic"- , "JonesJim-ATimelessStory.epub"- )---testMagAeon :: Test-testMagAeon = TestCase $- assertNewName "Aeon magazine" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing "Aeon Authors"]- , metaTitles = [MetaTitle Nothing "Aeon Eight"]- }- expected =- ( "MagAeon"- , "AeonMagazine08.epub"- )---testMagAEon :: Test-testMagAEon = TestCase $- assertNewName "AEon magazine" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing "AEon Authors"]- , metaTitles = [MetaTitle Nothing "Aeon Thirteen"]- }- expected =- ( "MagAeon"- , "AeonMagazine13.epub"- )---testMagApexLong :: Test-testMagApexLong = TestCase $- assertNewName "Apex Magazine, older, long title" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut") Nothing- "Apex Authors"]- , metaTitles = [MetaTitle Nothing- "Apex Science Fiction and Horror Digest #9"]- }- expected =- ( "MagApex"- , "ApexMagazine009.epub"- )---testMagApexShort :: Test-testMagApexShort = TestCase $- assertNewName "Apex Magazine, newer, short title" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut") Nothing- "Apex Authors"]- , metaTitles = [MetaTitle Nothing- "Apex Magazine Issue 17"]- }- expected =- ( "MagApex"- , "ApexMagazine017.epub"- )---testChallengingDestinyShort :: Test-testChallengingDestinyShort = TestCase $- assertNewName "Challenging Destiny Magazine, short" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing- "Crystalline Sphere Authors"]- , metaTitles = [MetaTitle Nothing- "Challenging Destiny #23"]- }- expected =- ( "MagChallengingDestiny"- , "ChallengingDestinyMagazine023.epub"- )---testChallengingDestinyLong :: Test-testChallengingDestinyLong = TestCase $- assertNewName "Challenging Destiny Magazine, long" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "Crystalline Sphere Authors"]- , metaTitles = [MetaTitle Nothing - "Challenging Destiny #24: August 2007"]- }- expected =- ( "MagChallengingDestiny"- , "ChallengingDestinyMagazine024.epub"- )---testChallengingDestinyPub :: Test-testChallengingDestinyPub = TestCase $- assertNewName "Challenging Destiny Magazine, Publishing in author"- meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "Crystalline Sphere Publishing"]- , metaTitles = [MetaTitle Nothing - "Challenging Destiny #18"]- }- expected =- ( "MagChallengingDestiny"- , "ChallengingDestinyMagazine018.epub"- )---testAnalog :: Test-testAnalog = TestCase $- assertNewName "Analog" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing- "Dell Magazine Authors"]- , metaTitles = [MetaTitle Nothing- "Analog SFF, July-August 2003"]- }- expected =- ( "MagAnalog"- , "AnalogSF2003-07_08.epub"- )---testAsimovs :: Test-testAsimovs = TestCase $- assertNewName "Asimovs" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing- "Dell Magazine Authors"]- , metaTitles = [MetaTitle Nothing- "Asimov's SF, August 2003"]- }- expected =- ( "MagAnalog"- , "AsimovsSF2003-08.epub"- )---testFsfShort :: Test-testFsfShort = TestCase $- assertNewName "FSF Magazine, short" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing- "Spilogale Authors"]- , metaTitles = [MetaTitle Nothing "FSF, April 2008"]- }- expected =- ( "MagFsf"- , "FantasyScienceFiction2008-04.epub"- )---testFsfLong :: Test-testFsfLong = TestCase $- assertNewName "FSF Magazine, long" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "Spilogale Authors"]- , metaTitles = [MetaTitle Nothing - "FSF Magazine, April 2006"]- }- expected =- ( "MagFsf"- , "FantasyScienceFiction2006-04.epub"- )---testMagFutureOrbits :: Test-testMagFutureOrbits = TestCase $- assertNewName "testMagFutureOrbits" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "Vander Neut Publications, L.L.C."]- , metaTitles = [MetaTitle Nothing - "Future Orbits Issue 5, June/July 2002"]- }- expected =- ( "MagFutureOrbits"- , "FutureOrbitsMagazine05_2002-06_07.epub"- )---testGudShort :: Test-testGudShort = TestCase $- assertNewName "Gud Magazine, short" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "GUD Magazine Authors"]- , metaTitles = [MetaTitle Nothing - "GUD Magazine Issue 0 :: Spring 2007"]- }- expected =- ( "MagGud"- , "GUDMagazine00.epub"- )---testGudLong :: Test-testGudLong = TestCase $- assertNewName "Gud Magazine, long" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "GUD Magazine Authors, Jeff Somers, Jeremy Shipp"]- , metaTitles = [MetaTitle Nothing - "GUD Magazine Issue 2 :: Spring 2008"]- }- expected =- ( "MagGud"- , "GUDMagazine02.epub"- )---testInterzoneShort :: Test-testInterzoneShort = TestCase $- assertNewName "Interzone Magazine, short" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "TTA Press Authors"]- , metaTitles = [MetaTitle Nothing - "Interzone SFF #212"]- }- expected =- ( "MagInterzone"- , "InterzoneSFF212.epub"- )---testInterzoneLong :: Test-testInterzoneLong = TestCase $- assertNewName "Interzone Magazine, long" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "TTA Press Authors"]- , metaTitles = [MetaTitle Nothing - "Interzone Science Fiction and Fantasy Magazine #216"]- }- expected =- ( "MagInterzone"- , "InterzoneSFF216.epub"- )---testNemesisShort :: Test-testNemesisShort = TestCase $- assertNewName "Nemesis Magazine, short" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "Stephen Adams"]- , metaTitles = [MetaTitle Nothing - "Nemesis Magazine #2"]- }- expected =- ( "MagNemesis"- , "NemesisMag002.epub"- )---testNemesisLong :: Test-testNemesisLong = TestCase $- assertNewName "Nemesis Magazine, long" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "Stephen Adams"]- , metaTitles = [MetaTitle Nothing - "Nemesis Magazine #7: Featuring Victory Rose in Death Stalks the Ruins"]- }- expected =- ( "MagNemesis"- , "NemesisMag007.epub"- )---testMagSomethingWicked :: Test-testMagSomethingWicked = TestCase $- assertNewName "Something Wicked Magazine" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "Something Wicked Authors"]- , metaTitles = [MetaTitle Nothing - "Something Wicked SF and Horror Magazine #5"]- }- expected =- ( "MagSomethingWicked"- , "SomethingWickedMagazine05.epub"- )---testSFBestOf :: Test-testSFBestOf = TestCase $- assertNewName "Science Fiction: The Best of the Year" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "Rich Horton"]- , metaTitles = [MetaTitle Nothing - "Science Fiction: The Best of the Year, 2007 Edition"]- }- expected =- ( "SFBestOf"- , "ScienceFiction_TheBestOfTheYear2007Edition.epub"- )---testMagBlackStatic :: Test-testMagBlackStatic = TestCase $- assertNewName "Black Static Magazine" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator Nothing Nothing - "TTA Press Authors"]- , metaTitles = [MetaTitle Nothing - "Black Static Horror Magazine #5"]- }- expected =- ( "MagNameIssue"- , "BlackStaticHorrorMagazine05.epub"- )---testRageMachineMag :: Test-testRageMachineMag = TestCase $- assertNewName "Rage Machine Magazine" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "edt") Nothing - "G. W. Thomas"]- , metaTitles = [MetaTitle Nothing - "Rage Machine Magazine #1--December 2005"]- }- expected =- ( "MagRageMachine"- , "RageMachineMagazine1_2005-12.epub"- )---testEclipseMag :: Test-testEclipseMag = TestCase $- assertNewName "Eclipse Magazine" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut")- (Just "Strahan, Jonathan")- "Jonathan Strahan"]- , metaTitles = [MetaTitle Nothing - "Eclipse One"]- }- expected =- ( "MagEclipse"- , "Eclipse01.epub"- )---testBcs :: Test-testBcs = TestCase $- assertNewName "Beneath Ceaseless Skies Magazine" meta expected- where- meta = emptyMetadata- { metaCreators = - [ MetaCreator (Just "aut")- (Just "Tidwell, Erin A.")- "Hoover, Kenneth Mark"- , MetaCreator (Just "aut")- (Just "Tidwell, Erin A.")- "Tidwell, Erin A."- ]- , metaTitles = [MetaTitle Nothing - "Beneath Ceaseless Skies #32"]- }- expected =- ( "MagBcs"- , "BeneathCeaselessSkies_Issue032.epub"- )---testBkpFileAs :: Test-testBkpFileAs = TestCase $- assertNewNameOpts opts - "book publisher suffix requested and present in file-as"- meta expected- where- opts = defaultOptions { optPublisher = True }- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut") Nothing- "Herman Melville"]- , metaContributors = [MetaCreator (Just "bkp") (Just "acme") - "Acme Publishing, Inc."]- , metaTitles = [MetaTitle Nothing "Moby Dick"]- }- expected =- ( "AuthorBasic"- , "MelvilleHerman-MobyDick_acme.epub"- )---testBkpText :: Test-testBkpText = TestCase $- assertNewNameOpts opts - "book publisher suffix requested and present in text"- meta expected- where- opts = defaultOptions { optPublisher = True }- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut") Nothing- "Herman Melville"]- , metaContributors = [MetaCreator (Just "bkp") Nothing- "Acme Publishing, Inc."]- , metaTitles = [MetaTitle Nothing "Moby Dick"]- }- expected =- ( "AuthorBasic"- , "MelvilleHerman-MobyDick.epub"- )---testBkpMissing :: Test-testBkpMissing = TestCase $- assertNewNameOpts opts - "book publisher suffix requested and not present"- meta expected- where- opts = defaultOptions { optPublisher = True }- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut") Nothing- "Herman Melville"]- , metaTitles = [MetaTitle Nothing "Moby Dick"]- }- expected =- ( "AuthorBasic"- , "MelvilleHerman-MobyDick.epub"- )---testMagUniverse :: Test-testMagUniverse = TestCase $- assertNewNameOpts opts - "Jim Baen's Universe Magazine"- meta expected- where- opts = defaultOptions { optPublisher = True }- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut") Nothing- "Jim Baen's Universe"]- , metaTitles = [MetaTitle Nothing "Jim Baen's Universe-Vol 4 Num 6"]- }- expected =- ( "MagUniverse"- , "JimBaensUniverseVol04Num06.epub"- )---testMagClarkesworld :: Test-testMagClarkesworld = TestCase $- assertNewName "Clarkesworld Magazine" meta expected- where- meta = emptyMetadata- { metaCreators = [MetaCreator (Just "aut")- (Just "Kowal, Mary Robinette")- "Mary Robinette Kowal"]- , metaTitles = [MetaTitle Nothing- "Clarkesworld Magazine - Issue 21"]- }- expected =- ( "MagClarkesworld"- , "Clarkesworld021.epub"- )
− util/all-books.sh
@@ -1,17 +0,0 @@-#! /bin/bash--# Copyright: 2008-2011 Dino Morelli-# License: BSD3 (see LICENSE)-# Author: Dino Morelli <dino@ui3.info>---cd /var/local/archive/doc/books/fiction--tempDir="/home/dino/temp"-allFile="epubname-all"--find . -name '*.epub' | xargs -n 30 epubname -n -v1 > $tempDir/$allFile--cd $tempDir--grep -v 'No-action' $allFile | grep -v 'formatter:' | sed -e 's/.*\///' | perl -ne '($o, $n) = /(.*) -> (.*)/; if ($o ne $n) { print $_ }' | sort > epubname-changed
− util/prefs/boring
@@ -1,69 +0,0 @@-# Boring file regexps:-\.hi$-\.hi-boot$-\.o-boot$-\.o$-\.o\.cmd$-\.p_hi$-\.p_o$-\.installed-pkg-config-\.setup-config-\.setup-config^dist(/|$)-# *.ko files aren't boring by default because they might-# be Korean translations rather than kernel modules.-# \.ko$-\.ko\.cmd$-\.mod\.c$-(^|/)\.tmp_versions($|/)-(^|/)CVS($|/)-\.cvsignore$-^\.#-(^|/)RCS($|/)-,v$-(^|/)\.svn($|/)-(^|/)\.hg($|/)-(^|/)\.git($|/)-\.bzr$-(^|/)SCCS($|/)-~$-(^|/)_darcs($|/)-(^|/)\.darcsrepo($|/)-\.bak$-\.BAK$-\.orig$-\.rej$-(^|/)vssver\.scc$-\.swp$-(^|/)MT($|/)-(^|/)\{arch\}($|/)-(^|/).arch-ids($|/)-(^|/),-\.prof$-(^|/)\.DS_Store$-(^|/)BitKeeper($|/)-(^|/)ChangeSet($|/)-\.py[co]$-\.elc$-\.class$-\.zwc$-\.revdep-rebuild.*-\..serverauth.*-\#-(^|/)Thumbs\.db$-(^|/)autom4te\.cache($|/)-(^|/)config\.(log|status)$-^\.depend$-(^|/)(tags|TAGS)$-#(^|/)\.[^/]-(^|/|\.)core$-\.(obj|a|exe|so|lo|la)$-^\.darcs-temp-mail$--darcs-backup[[:digit:]]+$-\.(fas|fasl|sparcf|x86f)$-\.part$-(^|/)\.waf-[[:digit:].]+-[[:digit:]]+($|/)-(^|/)\.lock-wscript$-^\.darcs-temp-mail$-\_vti_cnf$-\_vti_pvt$-(^|/)dist($|/)
− util/win-dist.sh
@@ -1,15 +0,0 @@-#! /bin/bash--if [ -z "$1" ]-then- echo "ERROR: Please give basename for zip file"- echo "example: ./util/win-dist.sh epub-tools-1.0.0.0-win"- exit 1-fi--zipFile="$1.zip"--rm $zipFile--buildDir="dist/build"-zip -j $zipFile doc/INSTALL $buildDir/epubmeta/epubmeta.exe $buildDir/epubname/epubname.exe $buildDir/epubzip/epubzip.exe