This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Publishing._ | |
lazy val root = (project in file(".")) | |
.settings(ReleaseSettings: _*) | |
.aggregate(plugin, library) | |
.enablePlugins(CrossPerProjectPlugin) | |
lazy val plugin = (project in file("plugin")) | |
.settings(PublishSettings: _*) | |
.settings(scriptedSettings: _*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbt._ | |
import sbt.Keys._ | |
import sbtrelease.ReleasePlugin.autoImport._ | |
import sbtrelease.ReleaseStateTransformations._ | |
object Publishing { | |
/* `publish` performs a no-op */ | |
val NoopPublishSettings = Seq( | |
packagedArtifacts in RootProject(file(".")) := Map.empty, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sbtrelease.ReleaseStateTransformations._ | |
name := "tweeter-positive" | |
organization := "com.example" | |
// current timestamp has been added as version metadata to prevent the suppression of duplicate tweets | |
version := s"1.2.3+${System.currentTimeMillis}" | |
// for 'real' projects, we'll want to use most of the default `releaseProcess` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override def projectSettings = Seq( | |
// Required settings that must be defined by the project utilizing the plugin | |
tweeterConsumerKey := { | |
tweeterConsumerKey.??(undefinedKeyError(tweeterConsumerKey.key)).value | |
}, | |
tweeterConsumerSecret := { | |
tweeterConsumerSecret.??(undefinedKeyError(tweeterConsumerSecret.key)).value | |
}, | |
tweeterAccessToken := { | |
tweeterAccessToken.??(undefinedKeyError(tweeterAccessToken.key)).value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The one input task that will be available to our plugin users, by default | |
tweeterTweet := { | |
val log = streams.value.log | |
val tweet = spaceDelimited("<text of tweet>").parsed.mkString(" ") | |
val consumerKey = tweeterConsumerKey.value | |
val consumerSecret = tweeterConsumerSecret.value | |
val accessToken = tweeterAccessToken.value | |
val accessTokenSecret = tweeterAccessTokenSecret.value | |
val client = TweeterService(consumerKey, consumerSecret, accessToken, accessTokenSecret) | |
client.post(tweet) match { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sbttweeter | |
import scala.util.{Success, Failure} | |
import sbt._ | |
import sbt.Keys._ | |
import sbt.complete.DefaultParsers.spaceDelimited | |
import com.example.sbt.TweeterService | |
object TweeterKeys { | |
val tweeterConsumerKey = settingKey[String]("The Twitter application consumer key") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name := "tweeter-negative" | |
tweeterConsumerKey := "foo" | |
tweeterConsumerSecret := "bar" | |
tweeterAccessToken := "baz" | |
tweeterAccessTokenSecret := "qux" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazy val root = (project in file(".")) | |
.aggregate(plugin, library) | |
.enablePlugins(CrossPerProjectPlugin) | |
lazy val plugin = (project in file("plugin")) | |
.settings(scriptedSettings: _*) | |
.settings( | |
name := "sbt-tweeter", | |
sbtPlugin := true, | |
scalaVersion := "2.10.6", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
NewerOlder