poltergeist-suppressor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +95 -0
- data/Rakefile +1 -0
- data/lib/poltergeist/suppressor.rb +37 -0
- data/lib/poltergeist/suppressor/redirect_stderr.rb +25 -0
- data/lib/poltergeist/suppressor/version.rb +5 -0
- data/poltergeist-suppressor.gemspec +26 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bb19711f51e73c81221700c130dcc719a39fc083
|
4
|
+
data.tar.gz: 0a003ad6b1f17f1c31d2f1a09d60e8fadcc969fe
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c5a14d108468937b604d1680474c53dbeb40f796b5c8ea8581ce4f66e94d67d747ac4457ce9edaff785fc86d6692b35db3b63fb50dd0af1ebc7888e5cfd51628
|
7
|
+
data.tar.gz: b735f3adea2e2d0dcb329cc983f52aeffa242b841d6e936cfa296c495ba15cdf0e0dba04a25b3219963cab62f89ac6719bc3a9e9fbb0ab955ad14acd550dadf0
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Kazato Sugimoto
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Poltergeist::Suppressor
|
2
|
+
|
3
|
+
A noisy warnings suppressor for capybara/poltergeist.
|
4
|
+
|
5
|
+
This gem silences noisy phantomjs warnings such as 'CoreText performance note...'.
|
6
|
+
|
7
|
+
Example before using:
|
8
|
+
|
9
|
+
```
|
10
|
+
% rspec ./spec/example_spec.rb
|
11
|
+
2014-05-01 05:26:27.380 phantomjs[92529:507] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
|
12
|
+
2014-05-01 05:26:27.927 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Helvetica Neue" and got font with PostScript name "HelveticaNeue". For best performance, only use PostScript names when calling this API.
|
13
|
+
2014-05-01 05:26:27.927 phantomjs[92529:507] CoreText performance note: Set a breakpoint on CTFontLogSuboptimalRequest to debug.
|
14
|
+
2014-05-01 05:26:27.931 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
|
15
|
+
2014-05-01 05:26:27.932 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
|
16
|
+
2014-05-01 05:26:27.934 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
|
17
|
+
2014-05-01 05:26:27.934 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
|
18
|
+
2014-05-01 05:26:27.935 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
|
19
|
+
2014-05-01 05:26:28.184 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
|
20
|
+
2014-05-01 05:26:28.184 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
|
21
|
+
2014-05-01 05:26:28.184 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Lucida Grande" and got font with PostScript name "LucidaGrande". For best performance, only use PostScript names when calling this API.
|
22
|
+
2014-05-01 05:26:28.470 phantomjs[92529:507] CoreText performance note: Client called CTFontCreateWithName() using name "Helvetica Neue" and got font with PostScript name "HelveticaNeue". For best performance, only use PostScript names when calling this API.
|
23
|
+
.
|
24
|
+
|
25
|
+
Finished in 3.7 seconds
|
26
|
+
1 example, 0 failures
|
27
|
+
|
28
|
+
```
|
29
|
+
|
30
|
+
|
31
|
+
After:
|
32
|
+
|
33
|
+
```
|
34
|
+
% rspec ./spec/example_spec.rb
|
35
|
+
.
|
36
|
+
|
37
|
+
Finished in 3.7 seconds
|
38
|
+
1 example, 0 failures
|
39
|
+
|
40
|
+
```
|
41
|
+
|
42
|
+
|
43
|
+
## Installation
|
44
|
+
|
45
|
+
Add this line to your application's Gemfile:
|
46
|
+
|
47
|
+
gem 'poltergeist-suppressor'
|
48
|
+
|
49
|
+
And then execute:
|
50
|
+
|
51
|
+
$ bundle
|
52
|
+
|
53
|
+
Or install it yourself as:
|
54
|
+
|
55
|
+
$ gem install poltergeist-suppressor
|
56
|
+
|
57
|
+
## Usage
|
58
|
+
|
59
|
+
Add these lines to spec_helper.rb:
|
60
|
+
``` ruby
|
61
|
+
require 'capybara/poltergeist'
|
62
|
+
require 'poltergeist/suppressor'
|
63
|
+
```
|
64
|
+
|
65
|
+
This gem automatically set a suppressed driver to `:poltergeist`.
|
66
|
+
|
67
|
+
You can manually add a suppressor to your driver.
|
68
|
+
``` ruby
|
69
|
+
Capybara.register_driver :poltergeist do |app|
|
70
|
+
Capybara::Poltergeist::Driver.new(app,
|
71
|
+
phantomjs_logger: Capybara::Poltergeist::Suppressor.new
|
72
|
+
)
|
73
|
+
end
|
74
|
+
```
|
75
|
+
|
76
|
+
And you can specify ignore patterns in regexp.
|
77
|
+
|
78
|
+
``` ruby
|
79
|
+
suppressor = Capybara::Poltergeist::Suppressor.new(patterns: [
|
80
|
+
/spam spam spam spam/,
|
81
|
+
/spamspamspamspam/
|
82
|
+
])
|
83
|
+
|
84
|
+
Capybara.register_driver :poltergeist do |app|
|
85
|
+
Capybara::Poltergeist::Driver.new(app, phantomjs_logger: suppressor)
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
## Contributing
|
90
|
+
|
91
|
+
1. Fork it
|
92
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
93
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
94
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
95
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'capybara/poltergeist'
|
2
|
+
require "poltergeist/suppressor/version"
|
3
|
+
require "poltergeist/suppressor/redirect_stderr"
|
4
|
+
|
5
|
+
module Capybara::Poltergeist
|
6
|
+
class Suppressor
|
7
|
+
DEFAULT_PATTERNS = [
|
8
|
+
/QFont::setPixelSize: Pixel size <= 0/,
|
9
|
+
/CoreText performance note:/,
|
10
|
+
/WARNING: Method userSpaceScaleFactor/
|
11
|
+
]
|
12
|
+
|
13
|
+
def initialize(args = {})
|
14
|
+
@patterns = args[:patterns] || DEFAULT_PATTERNS
|
15
|
+
end
|
16
|
+
|
17
|
+
def write(message)
|
18
|
+
if ignore_message?(message)
|
19
|
+
0
|
20
|
+
else
|
21
|
+
puts(message)
|
22
|
+
1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def ignore_message?(message)
|
28
|
+
@patterns.any? {|regexp| message =~ regexp }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Capybara.register_driver :poltergeist do |app|
|
34
|
+
Capybara::Poltergeist::Driver.new(app,
|
35
|
+
phantomjs_logger: Capybara::Poltergeist::Suppressor.new
|
36
|
+
)
|
37
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Capybara::Poltergeist
|
2
|
+
class Client
|
3
|
+
private
|
4
|
+
def redirect_stderr
|
5
|
+
prev = STDERR.dup
|
6
|
+
prev.autoclose = false
|
7
|
+
$stderr = @write_io
|
8
|
+
STDERR.reopen(@write_io)
|
9
|
+
|
10
|
+
yield
|
11
|
+
ensure
|
12
|
+
STDERR.reopen(prev)
|
13
|
+
$stderr = STDERR
|
14
|
+
end
|
15
|
+
|
16
|
+
def redirect_stdout_with_stderr(&block)
|
17
|
+
redirect_stderr do
|
18
|
+
redirect_stdout_without_stderr(&block)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method :redirect_stdout_without_stderr, :redirect_stdout
|
23
|
+
alias_method :redirect_stdout, :redirect_stdout_with_stderr
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'poltergeist/suppressor/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "poltergeist-suppressor"
|
8
|
+
spec.version = Poltergeist::Suppressor::VERSION
|
9
|
+
spec.authors = ["Kazato Sugimoto"]
|
10
|
+
spec.email = ["uiureo@gmail.com"]
|
11
|
+
spec.description = %q{A noisy warnings suppressor for capybara/poltergeist. This gem silences noisy phantomjs warnings such as 'CoreText performance note...'.}
|
12
|
+
spec.summary = %q{A noisy warnings suppressor for poltergeist.}
|
13
|
+
spec.homepage = "https://github.com/uiureo/poltergeist-suppressor"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'capybara'
|
22
|
+
spec.add_dependency 'poltergeist'
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: poltergeist-suppressor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kazato Sugimoto
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capybara
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: poltergeist
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A noisy warnings suppressor for capybara/poltergeist. This gem silences
|
70
|
+
noisy phantomjs warnings such as 'CoreText performance note...'.
|
71
|
+
email:
|
72
|
+
- uiureo@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/poltergeist/suppressor.rb
|
83
|
+
- lib/poltergeist/suppressor/redirect_stderr.rb
|
84
|
+
- lib/poltergeist/suppressor/version.rb
|
85
|
+
- poltergeist-suppressor.gemspec
|
86
|
+
homepage: https://github.com/uiureo/poltergeist-suppressor
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.0.3
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: A noisy warnings suppressor for poltergeist.
|
110
|
+
test_files: []
|