packages feed

hackage-sparks (empty) → 0.1

raw patch · 6 files changed

+109/−0 lines, 6 filesdep +basedep +directorydep +filepathsetup-changedbinary-added

Dependencies added: base, directory, filepath, hsparklines, old-locale, old-time, parsedate, tagsoup

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2008 Don Stewart++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:++1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright+   notice, this list of conditions and the following disclaimer in the+   documentation and/or other materials provided with the distribution.++3. Neither the name of the author nor the names of his contributors+   may be used to endorse or promote products derived from this software+   without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+POSSIBILITY OF SUCH DAMAGE.
+ Main.hs view
@@ -0,0 +1,51 @@+--------------------------------------------------------------------+-- |+-- Module    : Generate sparkline graphs of hackage uploads+-- Copyright : (c) Don Stewart 2008+-- License   : BSD3+--+-- Maintainer: Don Stewart <dons@galois.com>+-- Stability : provisional+-- Portability:+--+--------------------------------------------------------------------++import Data.List+import Data.Maybe+import Graphics.Rendering.HSparklines+import System.Locale+import System.Time+import System.Time.Parse+import System.Directory+import System.FilePath+import Text.HTML.Download++url = "http://hackage.haskell.org/packages/archive/log"++png1 = "hackage-monthly.png"+png2 = "hackage-daily.png"++main :: IO ()+main = do+    pwd <- getCurrentDirectory+    src <- openURL url+    let dates    = catMaybes . sort . map parse . lines $ src++    -- uploads per year+    let  permonth = groupBy month dates+    graph <- make ((barSpark {bgColor = rgb 0xee 0xee 0xee}) ) (map genericLength permonth)+    savePngFile png1 graph+    putStrLn $ "Wrote: " ++ pwd </> png1++    -- print uploads this month+    let today = last dates+        thismonth = groupBy day . filter (month today) $ dates+    graph <- make ((barSpark {bgColor = rgb 0xee 0xee 0xee+                             , limits = (0,20)} )) (map genericLength thismonth)+    savePngFile png2 graph+    putStrLn $ "Wrote: " ++ pwd </> png2++  where+    parse = parseCalendarTime defaultTimeLocale "%c"+    month a b = ctYear a == ctYear b && ctMonth a == ctMonth b+    day   a b = month a b && ctDay a == ctDay b
+ Setup.lhs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+> import Distribution.Simple+> main = defaultMain
+ examples/hackage-daily.png view

binary file changed (absent → 191 bytes)

+ examples/hackage-monthly.png view

binary file changed (absent → 226 bytes)

+ hackage-sparks.cabal view
@@ -0,0 +1,25 @@+name:                hackage-sparks+version:             0.1+homepage:            http://code.haskell.org/~dons/code/hackage-sparks+license:             BSD3+license-file:        LICENSE+author:              Don Stewart+maintainer:          dons@galois.com+category:            Graphics+synopsis:            Generate sparkline graphs of hackage statistics+description:         Generate sparkline graphs of hackage statistics+cabal-version:       >= 1.2+build-type:          Simple++flag small_base+  description: Choose the new smaller, split-up base package.++executable hackagesparks+    main-is:         Main.hs++    if flag(small_base) +        build-depends:   base >= 3, old-locale, old-time, directory+    else+        build-depends:   base <  3+    build-depends:   hsparklines, tagsoup, parsedate, filepath+