]> gitweb.michael.orlitzky.com - mailbox-count.git/blobdiff - mailbox-count.cabal
src/OptionalConfiguration.hs: use an explicit mappend.
[mailbox-count.git] / mailbox-count.cabal
index 3dfe80d10adacbae95eeeda9de00cb8c16b72832..4852d92fa590e9e234b63faa98e6852604e8ca6b 100644 (file)
 name:           mailbox-count
-version:        0.1.0
+version:        0.0.4
 cabal-version:  >= 1.8
 author:         Michael Orlitzky
 maintainer:    Michael Orlitzky <michael@orlitzky.com>
-license:        GPL-3
+license:        AGPL-3
 license-file:   doc/LICENSE
-homepage:       http://michael.orlitzky.com/code/mailbox-count.php
 bug-reports:    mailto:michael@orlitzky.com
 category:       Mail, Utils
 build-type:     Simple
 extra-source-files:
+  doc/mailbox-countrc.example
   doc/man1/mailbox-count.1
+  test/fixtures/postfixadmin.sqlite3
 synopsis:
   Count mailboxes in a SQL database.
 description:
-  Count mailboxes in a SQL database.
+  /Usage/:
+  .
+  @
+  mailbox-count [OPTIONS]
+  @
+  .
+  Mailbox-count produces a simple count of mailboxes that exist
+  per-domain in some SQL database. The default queries are compatible
+  with the schema used by PostfixAdmin <http://postfixadmin.sourceforge.net/>,
+  but it is possible to supply your own queries via the @--summary-query@
+  and @--detail-query@ options.
+  .
+  The summary report lists each domain, along with the number of
+  mailboxes owned by that domain. The order is determined by the summary
+  query, which lists the domains alphabetically by default.
+  .
+  The default detail report shows the same, but also contains a list of
+  each individual mailbox (again in alphabetical order) belonging to the
+  domains.
+  .
+  /Input/:
+  .
+  None.
+  .
+  /Output/:
+  .
+  Either a summary, or detailed report (with @--detail@) of the
+  number of mailboxes per-domain contained in the database.
+  .
+  /Options/:
+  .
+  @
+  \--database
+  @
+  .
+  The name of the database (or file, if SQLite) to which we should
+  connect.
+  .
+  Default: The name of the current user (Postgres only).
+  .
+  @
+  \--detail
+  @
+  .
+  Produce a detailed report listing all mailboxes by domain.
+  .
+  @
+  \--detail-query
+  @
+  .
+  SQL query used to produce the detail report. This should return the
+  set of all (domain, username) pairs. See the default value for an
+  example.
+  .
+  Default: \"SELECT domain,username FROM mailbox ORDER BY domain;\"
+  .
+  @
+  \--host
+  @
+  .
+  Hostname where the database is located (Postgres-only).
+  .
+  Default: None, a UNIX domain socket connection is attempted (Postgres only)
+  .
+  @
+  \--password
+  @
+  .
+  Password used to connect to the database (Postgres-only).
+  .
+  Default: None (assumes passwordless authentication)
+  .
+  @
+  \--port
+  @
+  Port number used to connect to the database (Postgres-only).
+  .
+  Default: None, a UNIX domain socket connection is attempted (Postgres only)
+  .
+  @
+  \--summary-query
+  @
+  .
+  SQL query used to produce the summary report. This should return
+  (domain, user count) pairs. See the default value for an
+  example.
+  .
+  Default: \"SELECT domain,COUNT(username) FROM mailbox GROUP BY domain
+  ORDER BY domain;\"
+  .
+  @
+  \--username
+  @
+  .
+  Username used to connect to the database (Postgres-only).
+  .
+  Default: The current user
+  .
+  /Examples/:
+  .
+  The default summary report:
+  .
+  @
+  $ mailbox-count --database=postfixadmin.sqlite3
+  Summary (number of mailboxes per domain)
+  \----------------------------------------
+  example.com:     3
+  example.invalid: 1
+  example.net:     2
+  example.org:     1
+  @
+  .
+  The more detailed report:
+  .
+  @
+  $ mailbox-count --detail --database=postfixadmin.sqlite3
+  Detail (list of all mailboxes by domain)
+  \----------------------------------------
+  example.com (3):
+  &#x20; user1
+  &#x20; user3
+  &#x20; user5
+
+  example.invalid (1):
+  &#x20; user7
+
+  example.net (2):
+  &#x20; user2
+  &#x20; user4
+
+  example.org (1):
+  &#x20; user6
+  @
+
+
 
 executable mailbox-count
   build-depends:
-    base                        == 4.*,
-    cmdargs                     == 0.10.*
+    base                        >= 4.8 && < 5,
+    cmdargs                     >= 0.10,
+    configurator                >= 0.2,
+    containers                  >= 0.5,
+    directory                   >= 1.2,
+    filepath                    >= 1.3,
+    HDBC                        >= 2.4,
+    HDBC-postgresql             >= 2.3,
+    HDBC-sqlite3                >= 2.3,
+    MissingH                    >= 1.2,
+    tasty                       >= 0.8,
+    tasty-hunit                 >= 0.8
+  -- Data.Semigroup was added to GHC.Base in ghc-8.0
+  if impl(ghc < 8.0)
+     -- The minor version 0.18.2 deleted the entire API?
+     build-depends: semigroups < 0.18.2
 
   main-is:
     Main.hs
@@ -27,23 +176,50 @@ executable mailbox-count
   hs-source-dirs:
     src/
 
-  --other-modules:
-
-  ghc-options:
-    -Wall
-    -fwarn-hi-shadowing
-    -fwarn-missing-signatures
-    -fwarn-name-shadowing
-    -fwarn-orphans
-    -fwarn-type-defaults
-    -fwarn-tabs
-    -fwarn-incomplete-record-updates
-    -fwarn-monomorphism-restriction
-    -fwarn-unused-do-bind
-    -rtsopts
-    -threaded
-    -optc-O3
-    -optc-march=native
+  other-modules:
+    Configuration
+    CommandLine
+    OptionalConfiguration
+    -- WARNING: the Paths_mailbox_count module is automatically generated by
+    -- Cabal itself. We don't want it included in the release tarballs,
+    -- since we typically want the paths that the user has configured.
+    -- Nevertheless, Cabal will complain if we don't include it here.
+    Paths_mailbox_count
+    Report
+
+
+test-suite testsuite
+  type: exitcode-stdio-1.0
+  hs-source-dirs: src test
+  main-is: TestSuite.hs
+
+  other-modules:
+    Configuration
+    OptionalConfiguration
+    -- WARNING: the Paths_mailbox_count module is automatically generated by
+    -- Cabal itself. We don't want it included in the release tarballs,
+    -- since we typically want the paths that the user has configured.
+    -- Nevertheless, Cabal will complain if we don't include it here.
+    Paths_mailbox_count
+    Report
+
+  build-depends:
+    base                        >= 4.8 && < 5,
+    cmdargs                     >= 0.10,
+    configurator                >= 0.2,
+    containers                  >= 0.5,
+    directory                   >= 1.2,
+    filepath                    >= 1.3,
+    HDBC                        >= 2.4,
+    HDBC-postgresql             >= 2.3,
+    HDBC-sqlite3                >= 2.3,
+    MissingH                    >= 1.2,
+    tasty                       >= 0.8,
+    tasty-hunit                 >= 0.8
+  -- Data.Semigroup was added to GHC.Base in ghc-8.0
+  if impl(ghc < 8.0)
+     -- The minor version 0.18.2 deleted the entire API?
+     build-depends: semigroups < 0.18.2
 
 
 test-suite doctests
@@ -51,30 +227,14 @@ test-suite doctests
   hs-source-dirs: test
   main-is: Doctests.hs
   build-depends:
-    base      == 4.*,
+    base      >= 4.8 && < 5,
     -- Additional test dependencies.
-    doctest   == 0.9.*,
-    filemanip == 0.3.6.*
-
-  -- It's not entirely clear to me why I have to reproduce all of this.
-  ghc-options:
-    -Wall
-    -fwarn-hi-shadowing
-    -fwarn-missing-signatures
-    -fwarn-name-shadowing
-    -fwarn-orphans
-    -fwarn-type-defaults
-    -fwarn-tabs
-    -fwarn-incomplete-record-updates
-    -fwarn-monomorphism-restriction
-    -fwarn-unused-do-bind
-    -rtsopts
-    -threaded
-    -optc-O3
-    -optc-march=native
+    doctest   >= 0.9,
+    filemanip >= 0.3.6
+
 
 
 source-repository head
   type: git
-  location: http://michael.orlitzky.com/git/mailbox-count.git
+  location: http://gitweb.michael.orlitzky.com/mailbox-count.git
   branch: master