Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 126 lines (80 sloc) 4.118 kb
2199030 adjusted readme
Andreas Schmid authored
1 sbt-test-notifier
2 =================
3
4 This is a customizable plugin for [simple-build-tool](http://code.google.com/p/simple-build-tool/)
5 to show a visual notification containing the test results.
6
7
8 Requirements
9 ------------
10
11 * Sbt version 0.7.x (not compatible with 0.5.x series).
12 * A library to display a notification, e.g.
13 ([libnotify-bin](https://launchpad.net/ubuntu/maverick/+package/libnotify-bin)
14 for Ubuntu with Gnome)
15
16
17 Usage
18 -----
19
794d6e1 changed README for better understanding
Andreas Schmid authored
20 **ATTENTION:** This will just work if you download the source, build it by your own and
21 use `publish-local` to publish it to your local repository. ;)
22 But I am working on it.
f05dff5 added correct usage description
Andreas Schmid authored
23
24
2199030 adjusted readme
Andreas Schmid authored
25 To use this plugin you have change `<your project directory>/project/plugins/Plugins.scala`:
26
27 import sbt._
28 class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
794d6e1 changed README for better understanding
Andreas Schmid authored
29 // lazy val sbtTestNotifierRepository = "sbt-test-notifier-repo" at "???"
f05dff5 added correct usage description
Andreas Schmid authored
30 lazy val sbtIdea = "de.aaschmid.sbtplugin" % "sbt-test-notifier" % "0.1"
2199030 adjusted readme
Andreas Schmid authored
31
32 // ...
33 }
34
35 Afterwards you have to `import de.aaschmid.sbtplugin.testnotifier.TestNotify` and add it
36 to the project class in `<your project directory>/project/Project.scala`, e.g.:
37
38 import sbt._
d777f0b @marvinthepa missing import of TestNotify in Build file
authored
39 import de.aaschmid.sbtplugin.testnotifier.TestNotify
40
2199030 adjusted readme
Andreas Schmid authored
41 class Project(info: ProjectInfo) extends DefaultProject(info) with TestNotify {
42 // ...
43 }
44
45
46 Customizations
47 --------------
48
49 There are a lot possible customizations that are described in this section.
50
51
52 ### Notification
53
54 The displaying of notifications is done by executing a shell command using a
55 `ProcessBuilder` and its method `!`. This is highly dependent on the operating
56 system such that you can configure it according to your operating system.
57 Currently it just works for Ubuntu with Gnome by using
58 [notify-send](http://manpages.ubuntu.com/manpages/maverick/man1/notify-send.1.html)
59 from the [libnotify-bin](https://launchpad.net/ubuntu/maverick/+package/libnotify-bin)
60 package. On Debian/Ubuntu this can be installed using
61 [apt-get](http://manpages.ubuntu.com/manpages/maverick/en/man8/apt-get.8.html).
62
63 sudo apt-get install libnotify-bin
64
65 If anyone does the customizations for a specific operating system with a certain
66 library, I would be glad to get your code to add it to the plugin. One has to
67 override
68
69 def notificationCommand: String
70
71 and
72
73 def notificationParams(worst: Severity, summary: String, body: String): List[String]
74
75 Furthermore the time how long a notification is shown can be set by
76 `def notificationTime: Int` using in milliseconds. But be aware that this will not work
77 if you use [notify-send](http://manpages.ubuntu.com/manpages/maverick/man1/notify-send.1.html)
78 from [libnotify-bin](https://launchpad.net/ubuntu/maverick/+package/libnotify-bin) which is
79 the default right now.
80
81
82 ### Message
83
84 The message header/summary can be adjusted by overriding, e.g.:
85
86 def summary(worst: Severity): String = "Test " + worst
87
88 The message body can be changed completely within
89 `def body(duration: Long, testResults: List[TestResult]): String` or by
90 changing the result of one of this methods:
91
92 * `def formatDuration(millies: Long): String`
93 * `def formatPassed(tests: List[TestResult]): String`
94 * `def formatSkipped(tests: List[TestResult]): String`
95 * `def formatFailed(tests: List[TestResult]): String`
96 * `def formatErrors(tests: List[TestResult]): String`
97
98 or the more generally
99 `def formatTestResults(prefix: String, tests: List[TestResult], showTestClasses: Boolean): String`.
100
101 ### Icons
102
103 The default images are copied from the `jar` package to the projects `target/`
104 directory on demand. The directory can e.g. set to the `/tmp/` by
105
106 override def imageTargetDir: File =
107 new File(System.getProperty("java.io.tmpdir"))
108
109 If you want to use your own icons you can just set them for every severity in method
110
111 def icon(s: Severity): File
112
113
114 ### Console
115
116 If you do not want to get the notification message also be printed on the console
117 you can set `def printNotification: Boolean` to `false`.
118
119
120 Contributors
121 ------------
122
a9f56d2 added Erics github account
Andreas Schmid authored
123 * [Eric Weikl](https://github.com/ericweikl)
b8a20f1 added git repo to contributors
Andreas Schmid authored
124 * [Andreas Schmid](https://github.com/aaschmid)
2199030 adjusted readme
Andreas Schmid authored
125
Something went wrong with that request. Please try again.