File tree Expand file tree Collapse file tree 4 files changed +14
-12
lines changed
src/main/scala/uk/co/randomcoding/sbt Expand file tree Collapse file tree 4 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ the hooks that are available.
10
10
11
11
### How to use
12
12
13
- ` sbt-git-hooks ` is an auto plugin for SBT 1.0.
13
+ ` sbt-git-hooks ` is an auto plugin for SBT 1.1.x
14
14
15
15
Add the plugin to your build with the following in ` project/plugins.sbt ` :
16
16
17
17
```
18
- addSbtPlugin("uk.co.randomcoding" % "sbt-git-hooks" % "0.1 .0")
18
+ addSbtPlugin("uk.co.randomcoding" % "sbt-git-hooks" % "0.2 .0")
19
19
```
20
20
21
21
Then run the task ` writeHooks ` to copy the hooks into ` .git/hooks `
Original file line number Diff line number Diff line change 1
1
name := " sbt-git-hooks"
2
2
3
- version := " 0.1 .0"
3
+ version := " 0.2 .0"
4
4
5
- scalaVersion := " 2.12.3 "
5
+ scalaVersion := " 2.12.6 "
6
6
7
7
organization := " uk.co.randomcoding"
8
8
Original file line number Diff line number Diff line change 1
- sbt.version = 1.0.1
1
+ sbt.version = 1.1.6
Original file line number Diff line number Diff line change @@ -56,12 +56,14 @@ object GitHooks extends AutoPlugin {
56
56
object WriteGitHooks {
57
57
58
58
def apply (hooksSourceDir : File , hooksTargetDir : File , log : ManagedLogger ): Unit = {
59
- log.info(s " Copying hooks from ${hooksSourceDir.getAbsolutePath} into ${hooksTargetDir.getAbsolutePath}" )
60
- Option (hooksSourceDir.listFiles).map(_.toList).getOrElse(Nil ).foreach { hook =>
61
- val hookTarget = hooksTargetDir.toPath.resolve(hook.getName)
62
- log.info(s " Copying ${hook.getName} to $hookTarget" )
63
- Files .copy(hook.toPath, hookTarget, StandardCopyOption .REPLACE_EXISTING )
64
- if (! Properties .isWin) Files .setPosixFilePermissions(hookTarget, PosixFilePermissions .fromString(" rwxr-xr-x" ))
65
- }
59
+ if (hooksTargetDir.exists()) {
60
+ log.info(s " Copying hooks from ${hooksSourceDir.getAbsolutePath} into ${hooksTargetDir.getAbsolutePath}" )
61
+ Option (hooksSourceDir.listFiles).map(_.toList).getOrElse(Nil ).foreach { hook =>
62
+ val hookTarget = hooksTargetDir.toPath.resolve(hook.getName)
63
+ log.info(s " Copying ${hook.getName} to $hookTarget" )
64
+ Files .copy(hook.toPath, hookTarget, StandardCopyOption .REPLACE_EXISTING )
65
+ if (! Properties .isWin) Files .setPosixFilePermissions(hookTarget, PosixFilePermissions .fromString(" rwxr-xr-x" ))
66
+ }
67
+ } else log.info(s " ${hooksTargetDir.getPath} does not exist (possibly within a submodule). Not writing any hooks. " )
66
68
}
67
69
}
You can’t perform that action at this time.
0 commit comments