Hello community, here is the log from the commit of package ghc-friendly-time for openSUSE:Factory checked in at 2017-08-31 20:47:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-friendly-time (Old) and /work/SRC/openSUSE:Factory/.ghc-friendly-time.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-friendly-time" Thu Aug 31 20:47:03 2017 rev:2 rq:513243 version:0.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-friendly-time/ghc-friendly-time.changes 2017-04-12 18:06:29.232498637 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-friendly-time.new/ghc-friendly-time.changes 2017-08-31 20:47:05.474382706 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:06:50 UTC 2017 - [email protected] + +- Update to version 0.4.1 revision 1. + +------------------------------------------------------------------- Old: ---- friendly-time-0.4.tar.gz New: ---- friendly-time-0.4.1.tar.gz friendly-time.cabal ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-friendly-time.spec ++++++ --- /var/tmp/diff_new_pack.OuvUKc/_old 2017-08-31 20:47:06.586226642 +0200 +++ /var/tmp/diff_new_pack.OuvUKc/_new 2017-08-31 20:47:06.590226080 +0200 @@ -19,13 +19,14 @@ %global pkg_name friendly-time %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.4 +Version: 0.4.1 Release: 0 Summary: Print time information in friendly ways License: BSD-3-Clause Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz +Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-old-locale-devel BuildRequires: ghc-rpm-macros @@ -51,6 +52,7 @@ %prep %setup -q -n %{pkg_name}-%{version} +cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ friendly-time-0.4.tar.gz -> friendly-time-0.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/friendly-time-0.4/friendly-time.cabal new/friendly-time-0.4.1/friendly-time.cabal --- old/friendly-time-0.4/friendly-time.cabal 2015-05-04 18:58:31.000000000 +0200 +++ new/friendly-time-0.4.1/friendly-time.cabal 2017-07-21 19:29:16.000000000 +0200 @@ -1,36 +1,49 @@ -name: friendly-time -version: 0.4 -author: Pat Brisbin <[email protected]> -maintainer: Pat Brisbin <[email protected]> -category: Web, Yesod -license: BSD3 -license-file: LICENSE -synopsis: Print time information in friendly ways -description: Print time information in friendly ways -build-type: Simple -cabal-version: >= 1.10 -build-type: Simple +-- This file has been generated from package.yaml by hpack version 0.17.0. +-- +-- see: https://github.com/sol/hpack + +name: friendly-time +version: 0.4.1 +synopsis: Print time information in friendly ways +description: Print time information in friendly ways +category: Web, Yesod +author: Pat Brisbin <[email protected]> +maintainer: Pat Brisbin <[email protected]> +license: BSD3 +license-file: LICENSE +build-type: Simple +cabal-version: >= 1.10 + +source-repository head + type: git + location: git://github.com/pbrisbin/friendly-time.git library - default-language: Haskell2010 - hs-source-dirs: src - ghc-options: -Wall - exposed-modules: Data.Time.Format.Human - build-depends: base >= 4 && < 5 - , time >= 1.4 - , old-locale + hs-source-dirs: + src + ghc-options: -Wall + build-depends: + time >=1.4 + , old-locale + , base >=4 && <5 + exposed-modules: + Data.Time.Format.Human + Data.Time.Format.Human.Locales + other-modules: + Paths_friendly_time + default-language: Haskell2010 test-suite spec - type: exitcode-stdio-1.0 - default-language: Haskell2010 - hs-source-dirs: test - main-is: Spec.hs - build-depends: base - , hspec - , friendly-time - , time >= 1.4 - , old-locale - -source-repository head - type: git - location: git://github.com/pbrisbin/friendly-time.git + type: exitcode-stdio-1.0 + main-is: Spec.hs + hs-source-dirs: + test + build-depends: + time >=1.4 + , old-locale + , base + , hspec + , friendly-time + other-modules: + Data.Time.Format.HumanSpec + default-language: Haskell2010 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/friendly-time-0.4/src/Data/Time/Format/Human/Locales.hs new/friendly-time-0.4.1/src/Data/Time/Format/Human/Locales.hs --- old/friendly-time-0.4/src/Data/Time/Format/Human/Locales.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/friendly-time-0.4.1/src/Data/Time/Format/Human/Locales.hs 2017-07-21 19:19:48.000000000 +0200 @@ -0,0 +1,62 @@ +module Data.Time.Format.Human.Locales + ( spanishHumanTimeLocale + ) where + +import Data.Time +import Data.Time.Format.Human + +-- | Spanish human time locale. +spanishHumanTimeLocale :: HumanTimeLocale +spanishHumanTimeLocale = HumanTimeLocale + { justNow = "Justo ahora" + , secondsAgo = \f x -> (dir f ++ " " ++ x ++ " segundos") + , oneMinuteAgo = \f -> dir f ++ " un minuto" + , minutesAgo = \f x -> (dir f ++ " " ++ x ++ " minutos") + , oneHourAgo = \f -> dir f ++ " una hora" + , aboutHoursAgo = \f x -> dir f ++ " aproximadamente " ++ x ++ " horas" + , at = \_ -> ("El " ++) + , daysAgo = \f x -> (dir f ++ " " ++ x ++ " dias") + , weekAgo = \f x -> (dir f ++ " " ++ x ++ " semana") + , weeksAgo = \f x -> (dir f ++ " " ++ x ++ " semanas") + , onYear = ("En " ++) + , locale = spanishTimeLocale + , timeZone = utc + , dayOfWeekFmt = "%A a las %l:%M %p" + , thisYearFmt = "%b/%e" + , prevYearFmt = "%Y/%b/%e" + } + where + dir True = "Dentro de" + dir False = "Hace" + spanishTimeLocale = TimeLocale { + wDays = [("Domingo", "Dom"), ("Lunes", "Lun"), + ("Martes", "Mar"), ("Miercoles", "Mie"), + ("Jueves", "Jue"), ("Viernes", "Vie"), + ("Sabado", "Sab")], + + months = [("Enero", "Ene"), ("Febrero", "Feb"), + ("Marzo", "Mar"), ("Abril", "Abr"), + ("Mayo", "May"), ("Junio", "Jun"), + ("Julio", "Jul"), ("Agosto", "Ago"), + ("Septiembre", "Sep"), ("Octubre", "Oct"), + ("Noviembre", "Nov"), ("Diciembre", "Dec")], + + amPm = ("AM", "PM"), + dateTimeFmt = "%a %b %e %H:%M:%S %Z %Y", + dateFmt = "%y/%m/%d", + timeFmt = "%H:%M:%S", + time12Fmt = "%I:%M:%S %p", + knownTimeZones = + [ + TimeZone 0 False "UT", + TimeZone 0 False "GMT", + TimeZone (-5 * 60) False "EST", + TimeZone (-4 * 60) True "EDT", + TimeZone (-6 * 60) False "CST", + TimeZone (-5 * 60) True "CDT", + TimeZone (-7 * 60) False "MST", + TimeZone (-6 * 60) True "MDT", + TimeZone (-8 * 60) False "PST", + TimeZone (-7 * 60) True "PDT" + ] + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/friendly-time-0.4/test/Data/Time/Format/HumanSpec.hs new/friendly-time-0.4.1/test/Data/Time/Format/HumanSpec.hs --- old/friendly-time-0.4/test/Data/Time/Format/HumanSpec.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/friendly-time-0.4.1/test/Data/Time/Format/HumanSpec.hs 2017-07-21 19:19:48.000000000 +0200 @@ -0,0 +1,98 @@ +{-# LANGUAGE CPP #-} + +module Data.Time.Format.HumanSpec + ( main + , spec + ) where + +import Test.Hspec +import Data.Time.Format.Human + +import Data.Maybe (fromJust) +import Data.Time + +#if !MIN_VERSION_time(1,5,0) +import System.Locale (defaultTimeLocale) +parseTimeM _ = parseTime +#endif + + +main :: IO () +main = hspec spec + +spec :: Spec +spec = describe "humanReadableTime'" $ do + it "returns just now for near times" $ do + let n = parseTime' "2015-01-01 01:00:00.1" + t = parseTime' "2015-01-01 01:00:00" + + humanReadableTime' n t `shouldBe` "just now" + humanReadableTime' t n `shouldBe` "just now" + + it "returns seconds for times less than a minute" $ do + let n = parseTime' "2015-01-01 01:00:59" + let t = parseTime' "2015-01-01 01:00:00" + + humanReadableTime' n t `shouldBe` "59 seconds ago" + humanReadableTime' t n `shouldBe` "59 seconds from now" + + it "returns minutes for times less than an hour" $ do + let n = parseTime' "2015-01-01 01:59:00" + let t = parseTime' "2015-01-01 01:00:00" + + humanReadableTime' n t `shouldBe` "59 minutes ago" + humanReadableTime' t n `shouldBe` "59 minutes from now" + + it "returns hours for times less than a day" $ do + let n = parseTime' "2015-01-01 23:59:00" + let t = parseTime' "2015-01-01 01:00:00" + + humanReadableTime' n t `shouldBe` "about 22 hours ago" + humanReadableTime' t n `shouldBe` "about 22 hours from now" + + context "when less than 5 days " $ do + let n = parseTime' "2015-01-04 01:00:00" + let t = parseTime' "2015-01-01 01:00:00" + + it "returns day of week in EDT" $ do + let l = defaultHumanTimeLocale { timeZone = read "EDT" } + + humanReadableTimeI18N' l n t `shouldBe` "at 9:00 PM on Wednesday" + humanReadableTimeI18N' l t n `shouldBe` "at 9:00 PM on Saturday" + + it "returns day of week in India" $ do + let l = defaultHumanTimeLocale { timeZone = read "+0530" } + + humanReadableTimeI18N' l n t `shouldBe` "at 6:30 AM on Thursday" + humanReadableTimeI18N' l t n `shouldBe` "at 6:30 AM on Sunday" + + it "returns days for times less than 10 days" $ do + let n = parseTime' "2015-01-10 01:00:00" + let t = parseTime' "2015-01-01 01:00:00" + + humanReadableTime' n t `shouldBe` "9 days ago" + humanReadableTime' t n `shouldBe` "9 days from now" + + it "returns weeks for times less than 5 weeks" $ do + let n = parseTime' "2015-01-29 01:00:00" + let t = parseTime' "2015-01-01 01:00:00" + + humanReadableTime' n t `shouldBe` "4 weeks ago" + humanReadableTime' t n `shouldBe` "4 weeks from now" + + it "returns a date string without year for this year" $ do + let n = parseTime' "2015-12-30 01:00:00" + let t = parseTime' "2015-01-01 01:00:00" + + humanReadableTime' n t `shouldBe` "on Jan 1" -- TODO: spacing + humanReadableTime' t n `shouldBe` "on Dec 30" + + it "returns a date string including the year for previous years" $ do + let n = parseTime' "2025-12-30 01:00:00" + let t = parseTime' "2015-01-01 01:00:00" + + humanReadableTime' n t `shouldBe` "on Jan 1, 2015" -- TODO: spacing + humanReadableTime' t n `shouldBe` "on Dec 30, 2025" + +parseTime' :: String -> UTCTime +parseTime' = fromJust . parseTimeM True defaultTimeLocale "%F %T%Q" ++++++ friendly-time.cabal ++++++ -- This file has been generated from package.yaml by hpack version 0.17.0. -- -- see: https://github.com/sol/hpack name: friendly-time version: 0.4.1 x-revision: 1 synopsis: Print time information in friendly ways description: Print time information in friendly ways category: Web, Yesod author: Pat Brisbin <[email protected]> maintainer: Pat Brisbin <[email protected]> license: BSD3 license-file: LICENSE build-type: Simple cabal-version: >= 1.10 source-repository head type: git location: git://github.com/pbrisbin/friendly-time.git library hs-source-dirs: src ghc-options: -Wall build-depends: time >=1.5 , old-locale , base >=4 && <5 exposed-modules: Data.Time.Format.Human Data.Time.Format.Human.Locales other-modules: Paths_friendly_time default-language: Haskell2010 test-suite spec type: exitcode-stdio-1.0 main-is: Spec.hs hs-source-dirs: test build-depends: time >=1.4 , old-locale , base , hspec , friendly-time other-modules: Data.Time.Format.HumanSpec default-language: Haskell2010
