Skip to content

Commit

Permalink
Merge pull request #6 from shmishleniy/n5
Browse files Browse the repository at this point in the history
  • Loading branch information
shmishleniy authored Feb 13, 2017
2 parents 16f86d5 + b88cbca commit 360ec1e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 53 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.idea
.sbt
target
target/
.DS_Store
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ or

`deploySsh yourServerName1 yourServerName2 ...`


**autoplugin (sbt >= 0.13.5)**

## Current version: 0.1.2

[Please read sbt documentation before start to work with plugin](http://www.scala-sbt.org/0.13.5/docs/Getting-Started/Using-Plugins.html)

- [Installation](#installation)
- [Configuration](#configuration)
- [Configs](#configs)
- [Locations](#locations)
- [Artifacts](#artifacts)
- [Execute scripts before/after deploy](#execute-scripts-beforeafter-deploy)
- [Execute scripts before/after deploy](#execute-scripts-beforeafter-deploy)
- [Link to task](#link-to-task)
- [Start deploy](#start-deploy)

Expand All @@ -34,7 +31,7 @@ or
Add to your `project/plugins.sbt` file:

``` sbt
addSbtPlugin("com.github.shmishleniy" % "sbt-deploy-ssh" % "0.1.2")
addSbtPlugin("com.github.shmishleniy" % "sbt-deploy-ssh" % "[0,)")
```

Add resolver to `project/plugins.sbt`:
Expand Down Expand Up @@ -111,7 +108,7 @@ There are four places where you can store your server config (All configs will b
* Config file located in user home directory
* Set server configs directly in project settings
``` sbt
``` sbt
lazy val myProject = project.enablePlugins(DeploySSH).settings(
//load build.conf from external path
deployExternalConfigFiles ++= Seq("/home/myUser/Documents/build.conf"),
Expand All @@ -135,7 +132,7 @@ val mySettings = Seq(
### Artifacts
Set artifacts to deploy
``` sbt
``` sbt
lazy val myProject = project.enablePlugins(DeploySSH).settings(
version := "1.1",
deployConfigs ++= Seq(
Expand All @@ -154,7 +151,7 @@ Deploy execution for this config:
`deploy-ssh server_5`
or
or
`deploySsh server_5`
Expand Down Expand Up @@ -198,7 +195,7 @@ lazy val myProject = project.enablePlugins(DeploySSH).settings(

### Link to task

If you need execute deploy in your task you can use `deploySshTask` and `deploySshServersNames` to config args for `deploySsh`. Or cast `deploySsh` to task.
If you need execute deploy in your task you can use `deploySshTask` and `deploySshServersNames` to config args for `deploySsh`. Or cast `deploySsh` to task.

``` sbt
lazy val myProject = project.enablePlugins(DeploySSH).settings(
Expand Down
25 changes: 8 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,20 @@ import bintray.Keys._
sbtPlugin := true

name := "sbt-deploy-ssh"

organization := "com.github.shmishleniy"

version := "0.1.2"

scalacOptions ++= Seq(
"-feature",
"-unchecked",
"-deprecation",
"-language:_",
"-encoding", "UTF-8"
)
version := org.eclipse.jgit.api.Git.open(file(".")).describe().call()

publishMavenStyle := false

bintrayPublishSettings

repository in bintray := "sbt-plugins"

licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html"))

licenses += ("MIT", url("https://opensource.org/licenses/MIT"))
bintrayOrganization in bintray := None

resolvers += "JAnalyse Repository" at "http://www.janalyse.fr/repository/"
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.2.1",
"fr.janalyse" %% "janalyse-ssh" % "0.9.19"
)

libraryDependencies ++= Dependencies.tools
scalacOptions in Compile ++= Seq("-encoding","UTF-8","-target:jvm-1.7","-deprecation","-feature")
javacOptions in Compile ++= Seq("-encoding","UTF-8","-source","1.7","-target","1.7")
20 changes: 0 additions & 20 deletions project/Dependencies.scala

This file was deleted.

1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=0.13.12
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
libraryDependencies += "org.eclipse.jgit" % "org.eclipse.jgit" % "[0,)"

scalacOptions in Compile ++= Seq("-deprecation","-feature")
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,16 @@ object DeploySSH extends AutoPlugin {
execBefore: Seq[(SSH) => Any],
execAfter: Seq[(SSH) => Any],
log: Logger): Unit = {
import java.io.File.{separator=>`/`}
val sshKey = serverConfig.sshDir.getOrElse(Properties.userHome+`/`+".ssh")+`/`+serverConfig.sshKeyFile

implicit val ssh = SSH(
SSHOptions(serverConfig.host,
serverConfig.user getOrElse Properties.userName,
serverConfig.password,
serverConfig.passphrase,
port = serverConfig.port.getOrElse(22),
sshUserDir = serverConfig.sshDir.getOrElse(
Properties.userHome + java.io.File.separator + ".ssh"),
sshKeyFile = serverConfig.sshKeyFile)
identities = SSHIdentity(sshKey)::Nil)
)
val sftp = ssh.newSftp
log.info("Exec before deploy")
Expand Down Expand Up @@ -206,4 +207,4 @@ object DeploySSH extends AutoPlugin {
directory.listFiles.filter(_.isDirectory).flatMap(getFilesFromDirectory)
else Array(directory)
}
}
}

0 comments on commit 360ec1e

Please sign in to comment.