growl-rspec 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in growl-rspec.gemspec
4
+ gemspec
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Jens Bissinger
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ # RSpec Integration with Growl
2
+
3
+ Provides a RSpec Formatter using the growl gem (and growlnotify)
4
+
5
+ ## Install
6
+
7
+ gem install growl-rspec
8
+
9
+ ## Configuration
10
+
11
+ Put the following in your spec/spec_helper.rb
12
+
13
+ RSpec.configure do |config|
14
+ config.formatter = 'Growl::RSpec::Formatter'
15
+ end
16
+
17
+ Further information have a look at lib/growl/rspec/formatter.rb
18
+
19
+ ## License
20
+
21
+ see MIT-LICENSE
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "growl/rspec/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "growl-rspec"
7
+ s.version = Growl::RSpec::VERSION
8
+ s.authors = ["dpree"]
9
+ s.email = ["whiterabbit.init@gmail.com"]
10
+ s.homepage = "https://github.com/dpree/growl-rspec"
11
+ s.summary = %q{Publishing RSpec results via Growl}
12
+ s.description = %q{Provides a new RSpec formatter that uses growlnotify}
13
+
14
+ s.rubyforge_project = "growl-rspec"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "rspec"
24
+ s.add_runtime_dependency "growl"
25
+ end
@@ -0,0 +1 @@
1
+ require 'growl/rspec'
@@ -0,0 +1,8 @@
1
+ require 'growl'
2
+
3
+ module Growl
4
+ module RSpec
5
+ require 'growl/rspec/version'
6
+ require 'growl/rspec/formatter'
7
+ end
8
+ end
@@ -0,0 +1,77 @@
1
+ require 'rspec/core/formatters/base_text_formatter'
2
+
3
+ module Growl::RSpec
4
+ # The Growl::RSpec::Formatter depens on the growl gem
5
+ # (and therefore, growlnotify bin must be installed)
6
+ #
7
+ # Use it by putting this in your spec_helper.rb
8
+ # RSpec.configure do |config|
9
+ # config.formatter = 'Growl::RSpec::Formatter'
10
+ # end
11
+ #
12
+ # You can switch off granular growls about each spec failure via:
13
+ # Growl::RSpec::Formatter.config = {
14
+ # :growl_failures => false
15
+ # }
16
+ #
17
+ # You can configure additional growlnotify options like:
18
+ # Growl::RSpec::Formatter.growlnotify_config = {
19
+ # :host => 'your.growl.host'
20
+ # }
21
+ #
22
+ class Formatter < RSpec::Core::Formatters::BaseTextFormatter
23
+
24
+ # the formatters default config hash
25
+ DEFAULT_CONFIG = {
26
+ :growl_failures => true
27
+ }.freeze
28
+
29
+ # read the formatters config hash
30
+ def self.config
31
+ @@config ||= DEFAULT_CONFIG
32
+ end
33
+
34
+ # set the formatters config hash
35
+ def self.config=(c)
36
+ @@config = DEFAULT_CONFIG.dup.merge(c)
37
+ end
38
+
39
+ # set the config hash that is passed to growlnotify gem
40
+ def self.growlnotify_config=(o)
41
+ @@_growlnotify_config = o
42
+ end
43
+
44
+ # get the config hash that is passed to growlnotify gem
45
+ def self.growlnotify_config
46
+ @@_growlnotify_config ||= {}
47
+ end
48
+
49
+ # hook when spec failed
50
+ def dump_failures
51
+ super
52
+ return if failed_examples.empty?
53
+ if self.class.config[:growl_failures]
54
+
55
+ msg = failed_examples.each_with_index.map do |example, idx|
56
+ ["#{idx+1}. it #{example.description}",
57
+ example.metadata[:execution_result][:exception]]
58
+ end.flatten.join("\n\n")
59
+
60
+ ::Growl.notify_warning msg, {
61
+ :title => "#{failed_examples.size} specs failed"
62
+ }.merge(self.class.growlnotify_config)
63
+ end
64
+ end
65
+
66
+ # hook when all specs ran
67
+ def dump_summary(duration, example_count, failure_count, pending_count)
68
+ super(duration, example_count, failure_count, pending_count)
69
+
70
+ msg = "#{example_count} specs in total (#{pending_count} pending). "\
71
+ "Consumed #{duration.round(1)}s"
72
+ ::Growl.notify_info msg, {
73
+ :title => "#{failure_count} specs failed!"
74
+ }.merge(self.class.growlnotify_config)
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,5 @@
1
+ module Growl
2
+ module RSpec
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: growl-rspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - dpree
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-25 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &70335085579380 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70335085579380
25
+ - !ruby/object:Gem::Dependency
26
+ name: growl
27
+ requirement: &70335085576660 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70335085576660
36
+ description: Provides a new RSpec formatter that uses growlnotify
37
+ email:
38
+ - whiterabbit.init@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - MIT-LICENSE
46
+ - README.md
47
+ - Rakefile
48
+ - growl-rspec.gemspec
49
+ - lib/growl-rspec.rb
50
+ - lib/growl/rspec.rb
51
+ - lib/growl/rspec/formatter.rb
52
+ - lib/growl/rspec/version.rb
53
+ homepage: https://github.com/dpree/growl-rspec
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project: growl-rspec
73
+ rubygems_version: 1.8.10
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Publishing RSpec results via Growl
77
+ test_files: []