rnotify 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +30 -0
- data/lib/adapters/logger.rb +14 -0
- data/lib/adapters/rspec.rb +24 -0
- data/lib/resources/warn.png +0 -0
- data/lib/rnotify.rb +8 -0
- metadata +103 -0
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
This small gem is supposed to be used on Ubuntu only (for now). It's actually work in progress. rnotify displays certain messages in NotifyOSD so you shouldn't distract to see what's going on in the console:
|
2
|
+
|
3
|
+
* Rails.logger messages (ones with severity >= WARN level)
|
4
|
+
|
5
|
+
* Results of running rspec/cucumber/test::unit test suits
|
6
|
+
|
7
|
+
In order to use it you need to make sure you have a 'notify-bin' package installed:
|
8
|
+
|
9
|
+
```sh
|
10
|
+
sudo apt-get install notify-bin
|
11
|
+
```
|
12
|
+
|
13
|
+
then just add this line to your Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'rnotify'
|
17
|
+
```
|
18
|
+
|
19
|
+
and run
|
20
|
+
|
21
|
+
```sh
|
22
|
+
bundle install
|
23
|
+
```
|
24
|
+
|
25
|
+
TODO:
|
26
|
+
|
27
|
+
* messages merging
|
28
|
+
* more icons
|
29
|
+
|
30
|
+
Copyright © 2011 Dmitrii Samoilov, released under the MIT license
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module ActiveSupport
|
2
|
+
class BufferedLogger
|
3
|
+
@@severity_reverse_hash = {0 => "DEBUG", 1 => "INFO", 2 => "WARN", 3 => "ERROR", 4 => "FATAL", 5 => "UNKNOWN"}
|
4
|
+
|
5
|
+
def add_with_notify(severity, message = nil, progname = nil, &block)
|
6
|
+
add_without_notify(severity, message, progname, &block)
|
7
|
+
if severity > Severity::INFO
|
8
|
+
`notify-send --icon="#{File.dirname(__FILE__)}/../resources/warn.png" "Rails logger #{@@severity_reverse_hash[severity]}", "#{message}"`
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
alias_method_chain :add, :notify
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class NotifyOSDReporter < RSpec::Core::Formatters::ProgressFormatter
|
2
|
+
def initialize(output)
|
3
|
+
super(output)
|
4
|
+
@failed_specs = 0
|
5
|
+
end
|
6
|
+
|
7
|
+
def example_failed(example)
|
8
|
+
super(example)
|
9
|
+
@failed_specs += 1
|
10
|
+
`notify-send "Rspec: #{example.full_description}", "#{example.execution_result[:exception].message.gsub(/"/, "'")}"`
|
11
|
+
end
|
12
|
+
|
13
|
+
def close
|
14
|
+
if @failed_specs == 0
|
15
|
+
`notify-send "Rspec: no failed specs", "No failed specs"`
|
16
|
+
else
|
17
|
+
`notify-send "Rspec: #{@failed_specs} failed specs", "#{@failed_specs} failed specs"`
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
RSpec.configure do |c|
|
23
|
+
c.add_formatter NotifyOSDReporter
|
24
|
+
end
|
Binary file
|
data/lib/rnotify.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
#require 'rubygems'
|
2
|
+
require 'active_support/core_ext/module/aliasing'
|
3
|
+
require 'rspec'
|
4
|
+
require 'rspec/core/formatters/base_formatter'
|
5
|
+
require 'rspec/core/formatters/progress_formatter'
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__), 'adapters', 'logger').to_s
|
8
|
+
require File.join(File.dirname(__FILE__), 'adapters', 'rspec').to_s
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rnotify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: "0.1"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Dmitrii Samoilov
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-12-22 00:00:00 Z
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
name: activesupport
|
21
|
+
prerelease: false
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 7
|
28
|
+
segments:
|
29
|
+
- 3
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
version: 3.0.0
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec-rails
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 19
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 7
|
47
|
+
- 0
|
48
|
+
version: 2.7.0
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
description: Using NotifyOSD system in Ubuntu to display Rails logger messages and TDD/BDD messages
|
52
|
+
email: germaninthetown@gmail.com
|
53
|
+
executables: []
|
54
|
+
|
55
|
+
extensions: []
|
56
|
+
|
57
|
+
extra_rdoc_files:
|
58
|
+
- README.md
|
59
|
+
- lib/rnotify.rb
|
60
|
+
- lib/adapters/logger.rb
|
61
|
+
- lib/adapters/rspec.rb
|
62
|
+
files:
|
63
|
+
- README.md
|
64
|
+
- lib/rnotify.rb
|
65
|
+
- lib/adapters/logger.rb
|
66
|
+
- lib/adapters/rspec.rb
|
67
|
+
- lib/resources/warn.png
|
68
|
+
homepage: https://github.com/german/rnotify
|
69
|
+
licenses: []
|
70
|
+
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 3
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
version: "0"
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 11
|
91
|
+
segments:
|
92
|
+
- 1
|
93
|
+
- 2
|
94
|
+
version: "1.2"
|
95
|
+
requirements: []
|
96
|
+
|
97
|
+
rubyforge_project: rnotify
|
98
|
+
rubygems_version: 1.8.6
|
99
|
+
signing_key:
|
100
|
+
specification_version: 3
|
101
|
+
summary: Using NotifyOSD system in Ubuntu to display Rails logger messages and TDD/BDD messages
|
102
|
+
test_files: []
|
103
|
+
|