testowl 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,10 +4,10 @@ TestOwl
4
4
  ![TestOwl](https://github.com/billhorsman/testowl/raw/master/images/testowl.png)
5
5
 
6
6
  Narrow Minded TestUnit/RSpec, Watchr and Growl Integration for Continuous Testing. TestOwl assumes you are running Rails and makes some guesses about what tests depend on what files. For instance, if you change model Foo then it looks for foo_test.rb and foos_controller_test.rb.
7
-
7
+
8
8
  At the very least, it will run each test every time you save it.
9
9
 
10
- Usage
10
+ Usage
11
11
  ==
12
12
 
13
13
  From Rails root:
@@ -23,13 +23,22 @@ Dependencies
23
23
 
24
24
  It uses [growlnotifiy](http://growl.info/extras.php) to send messages to Growl. If you don't have it installed then it will only write a message to your terminal. To get the full benefit of TestOwl you should definitely install growlnotify.
25
25
 
26
+ UPDATE: It now tries terminal-notifier first and uses that if it is present. The terminal-notifier gem will send messages to Mountain Lion's notification centre.
27
+
28
+ For example:
29
+
30
+ group :test do
31
+ gem 'terminal-notifier'
32
+ gem 'testowl'
33
+ end
34
+
26
35
  Bundler
27
36
  ==
28
37
 
29
38
  To install using Bundler:
30
39
 
31
40
  group :test do
32
- gem 'testowl', :git => "git@github.com:billhorsman/testowl.git"
41
+ gem 'testowl'
33
42
  end
34
43
 
35
44
  RSpec
@@ -2,17 +2,50 @@ module Testowl
2
2
  module Growl
3
3
 
4
4
  Growlnotify = "growlnotify"
5
+ TerminalNotifier = "terminal-notifier"
5
6
 
6
7
  def self.grr(title, message, seconds, status, files, suffix, identifier)
8
+ with_terminal_notifier(title, message, seconds, status, files, suffix, identifier) ||
9
+ with_growl(title, message, seconds, status, files, suffix, identifier)
10
+ end
11
+
12
+ def self.with_terminal_notifier(title, message, seconds, status, files, suffix, identifier)
13
+ project = File.expand_path(".").split("/").last
14
+ terminal_notifier = `which #{TerminalNotifier}`.chomp
15
+ if terminal_notifier == ''
16
+ if @tn_warning_done
17
+ puts "Skipping terminal notifier"
18
+ else
19
+ puts "If you install #{TerminalNotifier} you'll get notifications. Trying growl next. See the README."
20
+ @tn_warning_done = true
21
+ end
22
+ false
23
+ else
24
+ message_lines = [message.gsub("'", "`")]
25
+ message_lines << sprintf("(%0.1f seconds)", seconds) if seconds
26
+ message_lines << "#{files.map{|file| file.sub(/^spec\/[^\/]*\//, '').sub(/_test.rb$/, '')}.join("\n")}\n#{suffix}"
27
+ message_lines << identifier
28
+ options = []
29
+ options << "-message '#{message_lines.join("\n\n")}'"
30
+ options << "-group #{identifier}" # (used for coalescing)
31
+ options << "-title 'TestOwl #{title} (#{project})'"
32
+ system %(#{terminal_notifier} #{options.join(' ')} &)
33
+ puts message
34
+ true
35
+ end
36
+ end
37
+
38
+ def self.with_growl(title, message, seconds, status, files, suffix, identifier)
7
39
  project = File.expand_path(".").split("/").last
8
40
  growlnotify = `which #{Growlnotify}`.chomp
9
41
  if growlnotify == ''
10
- if @warning_done
42
+ if @g_warning_done
11
43
  puts "Skipping growl"
12
44
  else
13
45
  puts "If you install #{Growlnotify} you'll get growl notifications. See the README."
14
- @warning_done = true
46
+ @g_warning_done = true
15
47
  end
48
+ false
16
49
  else
17
50
  message_lines = [message.gsub("'", "`")]
18
51
  message_lines << sprintf("(%0.1f seconds)", seconds) if seconds
@@ -26,6 +59,7 @@ module Testowl
26
59
  title = "TestOwl #{title} (#{project})"
27
60
  system %(#{growlnotify} #{options.join(' ')} '#{title}' &)
28
61
  puts message
62
+ true
29
63
  end
30
64
  end
31
65
 
@@ -1,3 +1,3 @@
1
1
  module Testowl
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testowl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-02 00:00:00.000000000Z
12
+ date: 2012-08-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: watchr
16
- requirement: &70318555640140 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70318555640140
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rails
27
- requirement: &70318555639640 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70318555639640
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description: TestUnit/RSpec, Watchr and Growl Integration for Continuous Testing
37
47
  email:
38
48
  - bill@logicalcobwebs.com
@@ -70,21 +80,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
80
  - - ! '>='
71
81
  - !ruby/object:Gem::Version
72
82
  version: '0'
73
- segments:
74
- - 0
75
- hash: -4322040739528282819
76
83
  required_rubygems_version: !ruby/object:Gem::Requirement
77
84
  none: false
78
85
  requirements:
79
86
  - - ! '>='
80
87
  - !ruby/object:Gem::Version
81
88
  version: '0'
82
- segments:
83
- - 0
84
- hash: -4322040739528282819
85
89
  requirements: []
86
90
  rubyforge_project:
87
- rubygems_version: 1.8.10
91
+ rubygems_version: 1.8.23
88
92
  signing_key:
89
93
  specification_version: 3
90
94
  summary: TestUnit/RSpec, Watchr and Growl Integration for Continuous Testing