packages feed

webdriver 0.3.1 → 0.3.2

raw patch · 4 files changed

+31/−12 lines, 4 filesdep ~filesystem-trees

Dependency ranges changed: filesystem-trees

Files

CHANGELOG.md view
@@ -1,6 +1,6 @@ # Change Log -## upcoming release+## hs-webdriver 0.3.1   ###API changes *The representation of Profiles has changed, allowing it to store arbitrary files as well as extensions. The functional API for working with preferences and extensions ismostly unchanged, except for the behavior of calling addExtension consecutively with the same filepath argument.
src/Test/WebDriver/Common/Profile.hs view
@@ -6,7 +6,12 @@ module Test.WebDriver.Common.Profile        ( -- *Profiles and profile preferences          Profile(..), PreparedProfile(..), ProfilePref(..), ToPref(..)-       , getPref, addPref, deletePref, addExtension, deleteExtension+         -- * Preferences+       , getPref, addPref, deletePref+         -- * Extensions+       , addExtension, deleteExtension, hasExtension+         -- * Other files+       , addFile, deleteFile, hasFile          -- *Preparing profiles from disk        , prepareLoadedProfile_          -- *Preparing zipped profiles@@ -26,17 +31,17 @@ import qualified Data.ByteString.Lazy as LBS import qualified Data.ByteString.Base64 as B64 - import Codec.Archive.Zip-import System.FilePath hiding (addExtension)-+import System.FilePath hiding (addExtension, hasExtension)  import Data.Fixed import Data.Ratio import Data.Int import Data.Word-+import Data.List+import Data.Maybe import Data.Typeable+ import Control.Exception import Control.Applicative import Control.Monad.Base@@ -164,11 +169,16 @@ deleteFile :: FilePath -> Profile b -> Profile b deleteFile path prof = asList prof $ filter (\(_,p) -> p == path) +-- |Determines if a profile contains the given file. specified as a path relative to+-- the profile directory.+hasFile :: String -> Profile b -> Bool+hasFile path (Profile files _) = isJust $ find (\(_,d) ->  d == path) files+ -- |Add a new extension to the profile. The file path should refer to -- an .xpi file or an extension directory on the filesystem. If possible, -- you should avoiding adding the same extension twice to a given profile. addExtension :: FilePath -> Profile b -> Profile b-addExtension path = addFile path ("extensions/" </> name)+addExtension path = addFile path ("extensions" </> name)   where (_, name) = splitFileName path  -- |Delete an existing extension from the profile. The string parameter @@ -176,7 +186,12 @@ -- directory of the profile. This operation has no effect if the extension was  -- never added to the profile. deleteExtension :: String -> Profile b -> Profile b-deleteExtension name = deleteFile ("extensions/" </> name)+deleteExtension name = deleteFile ("extensions" </> name)++-- |Determines if a profile contains the given extension. specified as an .xpi file +-- or directory name+hasExtension :: String -> Profile b -> Bool+hasExtension name prof = hasFile ("extensions" </> name) prof  asMap :: Profile b          -> (HM.HashMap Text ProfilePref -> HM.HashMap Text ProfilePref)
src/Test/WebDriver/Firefox/Profile.hs view
@@ -12,13 +12,17 @@        , ProfilePref(..), ToPref(..)        , addPref, getPref, deletePref          -- * Extensions-       , addExtension, deleteExtension+       , addExtension, deleteExtension, hasExtension+         -- * Other Files+       , addFile, removeFile, hasFile          -- * Loading and preparing profiles        , prepareProfile, prepareTempProfile          -- ** Preparing profiles from disk        , loadProfile, prepareLoadedProfile, prepareLoadedProfile_          -- ** Preparing zip archives        , prepareZippedProfile, prepareZipArchive, prepareRawZip+         -- ** Preferences parsing error+       , ProfileParseError(..)        ) where import Test.WebDriver.Common.Profile import Data.Aeson@@ -29,7 +33,7 @@ import Data.ByteString as BS (readFile) import qualified Data.ByteString.Lazy.Char8 as LBS -import System.FilePath hiding (addExtension)+import System.FilePath hiding (addExtension, hasExtension) import System.Directory import System.IO.Temp (createTempDirectory) import qualified System.File.Tree as FS
webdriver.cabal view
@@ -1,5 +1,5 @@ Name: webdriver-Version: 0.3.1+Version: 0.3.2 Cabal-Version: >= 1.6 License: BSD3 License-File: LICENSE@@ -47,7 +47,7 @@                  , transformers-base < 1.0                  , vector >= 0.3                  , lifted-base == 0.1.*-                 , filesystem-trees == 0.0.*+                 , filesystem-trees >= 0.1 && < 0.3                  , data-default                  , temporary                  , base64-bytestring