stack-1.4.0: The Haskell Tool Stack

Safe Haskell | None
Language | Haskell2010

Stack.Upload

Contents

- Upload
- Credentials
  - Credentials source

Description

Provide ability to upload tarballs to Hackage.

Synopsis

- nopUploader :: Config -> UploadSettings -> IO Uploader
- mkUploader :: Config -> UploadSettings -> IO Uploader
- data Uploader
- upload :: Uploader -> FilePath -> IO ()
- uploadBytes :: Uploader -> String -> ByteString -> IO ()
- data UploadSettings
- defaultUploadSettings :: UploadSettings
- setUploadUrl :: String -> UploadSettings -> UploadSettings
- setCredsSource :: (Config -> HackageCredsSource) -> UploadSettings -> UploadSettings
- setSaveCreds :: Bool -> UploadSettings -> UploadSettings
- data HackageCreds
- loadCreds :: HackageCredsSource -> IO (HackageCreds, FromFile)
- saveCreds :: Config -> HackageCreds -> IO ()
- type FromFile = Bool
- data HackageCredsSource
- fromAnywhere :: Config -> HackageCredsSource
- fromPrompt :: HackageCredsSource
- fromFile :: Config -> HackageCredsSource
- fromMemory :: Text -> Text -> HackageCredsSource

# Upload

nopUploader :: Config -> UploadSettings -> IO Uploader #

mkUploader :: Config -> UploadSettings -> IO Uploader #

Turn the given settings into an `Uploader`.

Since 0.1.0.0

data Uploader #

The computed value from a `UploadSettings`.

Typically, you want to use this with `upload`.

Since 0.1.0.0

upload :: Uploader -> FilePath -> IO () #

Upload a single tarball with the given `Uploader`.

Since 0.1.0.0

uploadBytes :: Uploader -> String -> ByteString -> IO () #

Upload a single tarball with the given `Uploader`. Instead of sending a file like `upload`, this sends a lazy bytestring.

Since 0.1.2.1

data UploadSettings #

Settings for creating an `Uploader`.

Since 0.1.0.0

defaultUploadSettings :: UploadSettings #

Default value for `UploadSettings`.

Use setter functions to change defaults.

Since 0.1.0.0

setUploadUrl :: String -> UploadSettings -> UploadSettings #

Change the upload URL.

Default: "https://hackage.haskell.org/packages/"

Since 0.1.0.0

setCredsSource :: (Config -> HackageCredsSource) -> UploadSettings -> UploadSettings #

How to get the Hackage credentials.

Default: `fromAnywhere`

Since 0.1.0.0

setSaveCreds :: Bool -> UploadSettings -> UploadSettings #

Save new credentials to the config file.

Default: `True`

Since 0.1.0.0

# Credentials

data HackageCreds #

Username and password to log into Hackage.

Since 0.1.0.0

Instances

Show HackageCreds # |
Methods showsPrec :: Int -> HackageCreds -> ShowS # show :: HackageCreds -> String # showList :: [HackageCreds] -> ShowS #
FromJSON HackageCreds # |
Methods parseJSON :: Value -> Parser HackageCreds # parseJSONList :: Value -> Parser [HackageCreds] #
ToJSON HackageCreds # |
Methods toJSON :: HackageCreds -> Value # toEncoding :: HackageCreds -> Encoding # toJSONList :: [HackageCreds] -> Value # toEncodingList :: [HackageCreds] -> Encoding #

loadCreds :: HackageCredsSource -> IO (HackageCreds, FromFile) #

Load Hackage credentials from the given source.

Since 0.1.0.0

saveCreds :: Config -> HackageCreds -> IO () #

Save the given credentials to the credentials file.

Since 0.1.0.0

type FromFile = Bool #

Whether the Hackage credentials were loaded from a file.

This information is useful since, typically, you only want to save the credentials to a file if it wasn't already loaded from there.

Since 0.1.0.0

## Credentials source

data HackageCredsSource #

A source for getting Hackage credentials.

Since 0.1.0.0

fromAnywhere :: Config -> HackageCredsSource #

Try to load the credentials from the config file. If that fails, ask the user to enter them.

Since 0.1.0.0

fromPrompt :: HackageCredsSource #

Load the Hackage credentials from the prompt, asking the user to type them in.

Since 0.1.0.0

fromFile :: Config -> HackageCredsSource #

Load the Hackage credentials from the JSON config file.

Since 0.1.0.0

fromMemory :: Text -> Text -> HackageCredsSource #

Load the Hackage credentials from the given arguments.

Since 0.1.0.0