hackage-sparks 0.1 → 0.2
raw patch · 2 files changed
+19/−15 lines, 2 files
Files
- Main.hs +18/−13
- hackage-sparks.cabal +1/−2
Main.hs view
@@ -13,11 +13,11 @@ import Data.List import Data.Maybe import Graphics.Rendering.HSparklines+import System.Directory+import System.FilePath 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"@@ -25,24 +25,29 @@ png1 = "hackage-monthly.png" png2 = "hackage-daily.png" +graph = barSpark -- { bgColor = rgb 0xEE 0xEE 0xEE }+ 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+ let dates = catMaybes . sort . map parse . lines $ src - -- print uploads this month- let today = last dates+ let today = last dates+ permonth = groupBy month 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+ monthlies = map genericLength permonth+ dailies = map genericLength thismonth+ top = maximum monthlies++ graph1 <- make (graph { limits = (0,round top) }) monthlies+ graph2 <- make (graph { limits = (0,20) }) dailies++ savePngFile png1 graph1+ savePngFile png2 graph2++ putStrLn $ "Wrote: " ++ pwd </> png1 putStrLn $ "Wrote: " ++ pwd </> png2 where
hackage-sparks.cabal view
@@ -1,5 +1,5 @@ name: hackage-sparks-version: 0.1+version: 0.2 homepage: http://code.haskell.org/~dons/code/hackage-sparks license: BSD3 license-file: LICENSE@@ -16,7 +16,6 @@ executable hackagesparks main-is: Main.hs- if flag(small_base) build-depends: base >= 3, old-locale, old-time, directory else