luna-rspec-formatters 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +13 -0
- data/lib/luna/rspec/formatters/base.rb +64 -0
- data/lib/luna/rspec/formatters/checks.rb +4 -5
- data/lib/luna/rspec/formatters/doc2.rb +18 -12
- data/lib/luna/rspec/formatters/version.rb +1 -1
- metadata +24 -24
- data/lib/luna/rspec/formatters/shared/base.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35ebb065aa6aeef90f916998e5c1098aeebf9448
|
4
|
+
data.tar.gz: 654be4f22e072c744017e274c5dd3ccfd061580b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 978eed8786986a2dbc7559e2f2879e4aea8434ec8dd0a281a10b81332e3a7a353497a7b032674d95ddb6a0f85f9903b7a5d8d9e3e4ba88ff6fd3f04bb7746bfc
|
7
|
+
data.tar.gz: 706335ead38fc5d7d9ef244ec8b008165b65bea1f2e45c5cb0b5d199e52231b4e3b1919d835eac6971e7e0cd17149cf79c6bd80042d457c4c6b548126fcfc293
|
data/Gemfile
CHANGED
@@ -1,2 +1,15 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
gemspec
|
3
|
+
|
4
|
+
group :development do
|
5
|
+
|
6
|
+
unless ENV['CI']
|
7
|
+
gem 'pry'
|
8
|
+
end
|
9
|
+
|
10
|
+
# --------------------------------------------------------------------------
|
11
|
+
# Dependencies for people who use bundler.
|
12
|
+
# --------------------------------------------------------------------------
|
13
|
+
|
14
|
+
gem 'rake'
|
15
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rspec/core/formatters/base_text_formatter'
|
2
|
+
require 'term/ansicolor'
|
3
|
+
require 'coderay'
|
4
|
+
require 'libnotify'
|
5
|
+
|
6
|
+
# ----------------------------------------------------------------------------
|
7
|
+
# For backwards compatibility.
|
8
|
+
# ----------------------------------------------------------------------------
|
9
|
+
|
10
|
+
class String
|
11
|
+
include Term::ANSIColor
|
12
|
+
end
|
13
|
+
|
14
|
+
# ----------------------------------------------------------------------------
|
15
|
+
# My RSpec formatters.
|
16
|
+
# ----------------------------------------------------------------------------
|
17
|
+
|
18
|
+
module Luna
|
19
|
+
module RSpec
|
20
|
+
module Formatters
|
21
|
+
MethodMap = {
|
22
|
+
:passed => ["\u2713", :green],
|
23
|
+
:failed => ["\u2718", :red],
|
24
|
+
:pending => ["\u203D", :yellow]
|
25
|
+
}
|
26
|
+
|
27
|
+
class Base < ::RSpec::Core::Formatters::BaseTextFormatter
|
28
|
+
|
29
|
+
# --------------------------------------------------------------------
|
30
|
+
# Outputs a blank line at the beginning of the marks.
|
31
|
+
# --------------------------------------------------------------------
|
32
|
+
|
33
|
+
def start(*args)
|
34
|
+
super
|
35
|
+
output.puts
|
36
|
+
end
|
37
|
+
|
38
|
+
# --------------------------------------------------------------------
|
39
|
+
# Outputs a blank line at the end of the marks.
|
40
|
+
# --------------------------------------------------------------------
|
41
|
+
|
42
|
+
def start_dump
|
43
|
+
super
|
44
|
+
output.puts
|
45
|
+
end
|
46
|
+
|
47
|
+
# --------------------------------------------------------------------
|
48
|
+
# Passes to super and then libnotify.
|
49
|
+
# --------------------------------------------------------------------
|
50
|
+
|
51
|
+
def dump_summary(duration, total, failures, pending)
|
52
|
+
super; Libnotify.new do |notify|
|
53
|
+
notify.summary = "RSpec Results"
|
54
|
+
notify.urgency = :critical
|
55
|
+
notify.timeout = 1
|
56
|
+
notify.append = false
|
57
|
+
notify.transient = true
|
58
|
+
notify.body = "Passed: #{total - failures}, Failed: #{failures}"
|
59
|
+
end.show!
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,18 +1,17 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative 'base'
|
2
2
|
|
3
3
|
module Luna
|
4
4
|
module RSpec
|
5
5
|
module Formatters
|
6
|
-
class Checks <
|
6
|
+
class Checks < Base
|
7
7
|
|
8
|
-
|
8
|
+
# --------------------------------------------------------------------
|
9
9
|
# Checkmark, x and ?! with the colors green, red and yellow.
|
10
|
-
#
|
10
|
+
# --------------------------------------------------------------------
|
11
11
|
|
12
12
|
MethodMap.each do |m, u|
|
13
13
|
define_method("example_#{m}") do |e|
|
14
14
|
super(e)
|
15
|
-
blank_line?
|
16
15
|
output.print " #{u.first}".send(u.last)
|
17
16
|
end
|
18
17
|
end
|
@@ -3,7 +3,12 @@ require_relative "shared/base"
|
|
3
3
|
module Luna
|
4
4
|
module RSpec
|
5
5
|
module Formatters
|
6
|
-
class Doc2 <
|
6
|
+
class Doc2 < Base
|
7
|
+
|
8
|
+
# --------------------------------------------------------------------
|
9
|
+
# example_passed, example_pending, example_failed.
|
10
|
+
# --------------------------------------------------------------------
|
11
|
+
|
7
12
|
MethodMap.each do |m, u|
|
8
13
|
define_method("example_#{m}") do |e|
|
9
14
|
super(e)
|
@@ -13,34 +18,35 @@ module Luna
|
|
13
18
|
end
|
14
19
|
end
|
15
20
|
|
16
|
-
|
21
|
+
# --------------------------------------------------------------------
|
17
22
|
# A simple wrapper for CodeRay and syntax highlighting.
|
18
|
-
#
|
23
|
+
# --------------------------------------------------------------------
|
19
24
|
|
20
25
|
def syntax_highlight(text)
|
21
26
|
CodeRay.scan(text, :ruby).term
|
22
27
|
end
|
23
28
|
|
24
|
-
|
25
|
-
# Searches for `` inside of "it" and
|
26
|
-
#
|
29
|
+
# --------------------------------------------------------------------
|
30
|
+
# Searches for `` inside of "it" and and highlights it with CodeRay.
|
31
|
+
# --------------------------------------------------------------------
|
27
32
|
|
28
33
|
def highlight_graves(text)
|
29
34
|
text.gsub(/`([^`]+)`/) { syntax_highlight($1) }
|
30
35
|
end
|
31
36
|
|
32
|
-
|
37
|
+
# --------------------------------------------------------------------
|
33
38
|
# Searches for anything that starts with \. or # and colors it.
|
34
|
-
#
|
39
|
+
# --------------------------------------------------------------------
|
35
40
|
|
36
41
|
def highlight_methods(text)
|
37
42
|
text.gsub(/(#|\.)([a-z0-9_]+)/) { $1.white + $2.magenta }
|
38
43
|
end
|
39
44
|
|
40
|
-
|
41
|
-
# Strips apart the full_description to attempt to gather information
|
42
|
-
# method and then highlights and outputs
|
43
|
-
#
|
45
|
+
# --------------------------------------------------------------------
|
46
|
+
# Strips apart the full_description to attempt to gather information
|
47
|
+
# on the constant and method and then highlights and outputs
|
48
|
+
# everything.
|
49
|
+
# --------------------------------------------------------------------
|
44
50
|
|
45
51
|
def print_description(example)
|
46
52
|
constant = example.full_description.chomp(example.description)
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luna-rspec-formatters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordon Bedwell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: libnotify
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.8.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: coderay
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.0.9
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.0.9
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.13.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.13.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: term-ansicolor
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
type: :
|
61
|
+
version: 1.2.2
|
62
|
+
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.2.2
|
69
69
|
description: A couple of RSpec formatters.
|
70
70
|
email:
|
71
71
|
- envygeeks@gmail.com
|
@@ -73,10 +73,10 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- lib/luna/rspec/formatters/doc2.rb
|
77
76
|
- lib/luna/rspec/formatters/checks.rb
|
78
77
|
- lib/luna/rspec/formatters/version.rb
|
79
|
-
- lib/luna/rspec/formatters/
|
78
|
+
- lib/luna/rspec/formatters/base.rb
|
79
|
+
- lib/luna/rspec/formatters/doc2.rb
|
80
80
|
- License
|
81
81
|
- Readme.md
|
82
82
|
- Gemfile
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require "rspec/core/formatters/base_text_formatter"
|
2
|
-
require "colorize"
|
3
|
-
require "coderay"
|
4
|
-
|
5
|
-
module Luna
|
6
|
-
module RSpec
|
7
|
-
module Formatters
|
8
|
-
MethodMap = {
|
9
|
-
:passed => ["\u2713", :green],
|
10
|
-
:failed => ["\u2718", :red],
|
11
|
-
:pending => ["\u203D", :yellow]
|
12
|
-
}
|
13
|
-
|
14
|
-
module Shared
|
15
|
-
class Base < ::RSpec::Core::Formatters::BaseTextFormatter
|
16
|
-
def initialize(*args)
|
17
|
-
super(*args)
|
18
|
-
@lunas_first_output = true
|
19
|
-
end
|
20
|
-
|
21
|
-
def start_dump
|
22
|
-
super
|
23
|
-
output.puts
|
24
|
-
end
|
25
|
-
|
26
|
-
def blank_line?
|
27
|
-
if @lunas_first_output
|
28
|
-
output.puts
|
29
|
-
@lunas_first_output = false
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|