armin-joellenbeck-smilies 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -3
- data/lib/smilies/helper.rb +8 -0
- data/lib/smilies/server.rb +6 -4
- data/smilies.gemspec +1 -1
- data/spec/smilies/helper_spec.rb +9 -0
- metadata +1 -1
data/README
CHANGED
@@ -25,8 +25,8 @@ Then run the binary *smile* with a command line as parameter, for example:
|
|
25
25
|
$ smile rake
|
26
26
|
|
27
27
|
You get a notification if the command line has passed or failed with the
|
28
|
-
last line of its output (stdout and stderr together).
|
29
|
-
|
28
|
+
last line of its output (stdout and stderr together).
|
29
|
+
The full output is appended to the file <b>/tmp/<user>.smilies.output</b>.
|
30
30
|
|
31
31
|
For writing a client for the *smilies* notification server see the binary
|
32
32
|
*smile*:
|
@@ -35,7 +35,8 @@ For writing a client for the *smilies* notification server see the binary
|
|
35
35
|
|
36
36
|
=Support
|
37
37
|
|
38
|
-
The project home is at
|
38
|
+
The project home is at
|
39
|
+
GitHub[http://github.com/armin-joellenbeck/smilies/tree/master]:
|
39
40
|
http://github.com/armin-joellenbeck/smilies/tree/master
|
40
41
|
|
41
42
|
Feel free to send:
|
data/lib/smilies/helper.rb
CHANGED
@@ -2,6 +2,14 @@ module Smilies
|
|
2
2
|
|
3
3
|
module Helper
|
4
4
|
|
5
|
+
def self.seperator_line
|
6
|
+
"=" * 24 + ' ' + Time.now.to_s + ' ' + "=" * 24
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.output_file
|
10
|
+
"/tmp/#{ENV['USER']}_smilies.output"
|
11
|
+
end
|
12
|
+
|
5
13
|
def self.smilies_directory
|
6
14
|
File.dirname(__FILE__) + '/../../icons'
|
7
15
|
end
|
data/lib/smilies/server.rb
CHANGED
@@ -32,12 +32,11 @@ module Smilies
|
|
32
32
|
@red_smiley = read_icon(Helper.red_smiley_path)
|
33
33
|
Notify.init('Smilies')
|
34
34
|
@tray_icon = Gtk::StatusIcon.new
|
35
|
-
@tray_icon.pixbuf = @
|
35
|
+
@tray_icon.pixbuf = @green_smiley
|
36
36
|
@tray_icon.tooltip = 'Started'
|
37
37
|
@notification = Notify::Notification.new('Start',nil,nil,@tray_icon)
|
38
38
|
@notification.urgency = Notify::Notification::URGENCY_LOW
|
39
|
-
@notification.timeout =
|
40
|
-
@notification.add_action('details', 'Details') { |action| send(action) }
|
39
|
+
@notification.timeout = 5000
|
41
40
|
end
|
42
41
|
|
43
42
|
def details
|
@@ -64,11 +63,14 @@ module Smilies
|
|
64
63
|
|
65
64
|
def message(icon, summary=nil, message=nil)
|
66
65
|
@tray_icon.pixbuf = icon
|
67
|
-
@message = message
|
68
66
|
if summary
|
69
67
|
@tray_icon.tooltip = summary
|
70
68
|
end
|
71
69
|
if message
|
70
|
+
File.open(Helper.output_file, 'a') do |file|
|
71
|
+
file.puts Helper.seperator_line
|
72
|
+
file.puts message
|
73
|
+
end
|
72
74
|
tail = message.split("\n")[-1]
|
73
75
|
@notification.update(summary, tail, nil)
|
74
76
|
@notification.pixbuf_icon = icon
|
data/smilies.gemspec
CHANGED
data/spec/smilies/helper_spec.rb
CHANGED
@@ -5,6 +5,15 @@ module Smilies
|
|
5
5
|
|
6
6
|
describe Helper do
|
7
7
|
|
8
|
+
it 'should give a seperator line of length 80' do
|
9
|
+
Helper.seperator_line.length.should == 80
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should give the output file' do
|
13
|
+
ENV.stub!(:[]).with('USER').and_return('user')
|
14
|
+
Helper.output_file.should == '/tmp/user_smilies.output'
|
15
|
+
end
|
16
|
+
|
8
17
|
it 'should give the smilies directory' do
|
9
18
|
path = Helper.smilies_directory
|
10
19
|
File.directory?(path).should be_true
|