Skip to content

Instantly share code, notes, and snippets.

@jeffreyolchovy
Created May 16, 2017 11:32
Show Gist options
  • Select an option

  • Save jeffreyolchovy/34af0ce69d249db7da5cafc54eb9aae9 to your computer and use it in GitHub Desktop.

Select an option

Save jeffreyolchovy/34af0ce69d249db7da5cafc54eb9aae9 to your computer and use it in GitHub Desktop.
package sbttweeter
import sbt._
import sbt.Keys._
object TweeterKeys {
val tweeterConsumerKey = settingKey[String]("The Twitter application consumer key")
val tweeterConsumerSecret = settingKey[String]("The Twitter application consumer secret")
val tweeterAccessToken = settingKey[String]("The Twitter user access token")
val tweeterAccessTokenSecret = settingKey[String]("The Twitter user access token secret")
val tweeterTweet = inputKey[Long]("Post a tweet to the configured Twitter account")
}
object TweeterPlugin extends AutoPlugin {
object autoImport {
val TweeterKeys = sbttweeter.TweeterKeys
val tweeterConsumerKey = TweeterKeys.tweeterConsumerKey
val tweeterConsumerSecret = TweeterKeys.tweeterConsumerSecret
val tweeterAccessToken = TweeterKeys.tweeterAccessToken
val tweeterAccessTokenSecret = TweeterKeys.tweeterAccessTokenSecret
val tweeterTweet = TweeterKeys.tweeterTweet
}
import autoImport._
override def projectSettings = Seq(
// Required settings that must be defined by the project utilizing the plugin
tweeterConsumerKey := {
sys.error("The application consumer key is not defined. Please declare a value for the `tweeterConsumerKey` key.")
},
tweeterConsumerSecret := {
sys.error("The application consumer secret is not defined. Please declare a value for the `tweeterConsumerSecret` key.")
},
tweeterAccessToken := {
???
},
tweeterAccessTokenSecret := {
???
},
// The one input task that will be available to our plugin users, by default
tweeterTweet := {
???
}
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment