rgrmux 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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +1 -0
- data/lib/rgrmux/rspec.rb +49 -0
- data/lib/rgrmux/version.rb +3 -0
- data/lib/rgrmux.rb +16 -0
- data/rgrmux.gemspec +19 -0
- metadata +55 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Matt Rohrer
|
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,26 @@
|
|
1
|
+
# Rgrmux
|
2
|
+
|
3
|
+
An additional formatter for RSpec that sends messages to Tmux.
|
4
|
+
|
5
|
+
This is not original work and there's all sorts of hardcoded ugliness.
|
6
|
+
|
7
|
+
Credits:
|
8
|
+
- @thedelchop - https://gist.github.com/4195788
|
9
|
+
- https://github.com/guard/guard/blob/master/lib/guard/notifiers/tmux.rb
|
10
|
+
- https://github.com/tpope/fivemat
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Clone the repo, build the gem, and install it.
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
This formatter is meant to be used in addition to another formatter.
|
19
|
+
|
20
|
+
E.g. add the following to `~/.rspec`:
|
21
|
+
|
22
|
+
--format progress
|
23
|
+
--format Rgrmux
|
24
|
+
|
25
|
+
## TODO
|
26
|
+
- add formatters for Minitest & Cucumber
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/rgrmux/rspec.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rspec/core/formatters/progress_formatter'
|
2
|
+
|
3
|
+
module Rgrmux
|
4
|
+
# Credits:
|
5
|
+
# @thedelchop - https://gist.github.com/4195788
|
6
|
+
# https://github.com/guard/guard/blob/master/lib/guard/notifiers/tmux.rb
|
7
|
+
#
|
8
|
+
class RSpec < ::RSpec::Core::Formatters::ProgressFormatter
|
9
|
+
|
10
|
+
def initialize(output)
|
11
|
+
@tmux_color = ""
|
12
|
+
@tmux_message = ""
|
13
|
+
if ENV['TMUX']
|
14
|
+
@write_to_tmux = true
|
15
|
+
system "tmux set quiet on"
|
16
|
+
end
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
21
|
+
return super unless @write_to_tmux
|
22
|
+
|
23
|
+
summary = pluralize(example_count, "example")
|
24
|
+
summary << ", " << pluralize(failure_count, "failure")
|
25
|
+
summary << ", #{pending_count} pending" if pending_count > 0
|
26
|
+
|
27
|
+
if pending_count > 0
|
28
|
+
@tmux_color = "yellow"
|
29
|
+
elsif failure_count > 0
|
30
|
+
@tmux_color = "red"
|
31
|
+
else
|
32
|
+
@tmux_color = "green"
|
33
|
+
end
|
34
|
+
|
35
|
+
@tmux_message = summary + @tmux_message
|
36
|
+
end
|
37
|
+
|
38
|
+
def close
|
39
|
+
if @write_to_tmux
|
40
|
+
system "tmux set status-left-bg #{@tmux_color}"
|
41
|
+
system "tmux set message-bg #{@tmux_color}"
|
42
|
+
system "tmux set display-time 3000"
|
43
|
+
system "tmux display-message '#{@tmux_message.gsub('`','').gsub("'",'')}'"
|
44
|
+
system "tmux set quiet off"
|
45
|
+
end
|
46
|
+
super
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/rgrmux.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# require "rgrmux/version"
|
2
|
+
|
3
|
+
module Rgrmux
|
4
|
+
autoload :RSpec, "rgrmux/rspec"
|
5
|
+
|
6
|
+
def self.new(*args)
|
7
|
+
case args.size
|
8
|
+
when 0 then MiniTest::Unit
|
9
|
+
when 1 then RSpec
|
10
|
+
when 2 then Spec
|
11
|
+
when 3 then Cucumber
|
12
|
+
else
|
13
|
+
raise ArgumentError
|
14
|
+
end.new(*args)
|
15
|
+
end
|
16
|
+
end
|
data/rgrmux.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# lib = File.expand_path('../lib', __FILE__)
|
3
|
+
# $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
# require 'rgrmux/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "rgrmux"
|
8
|
+
gem.authors = ["Matt Rohrer"]
|
9
|
+
gem.email = ["matt@prognostikos.com"]
|
10
|
+
gem.description = %q{Red Green Refactor (t)mux}
|
11
|
+
gem.summary = %q{An RSpec/Cucumber/Minitest formater for tmux}
|
12
|
+
gem.homepage = ""
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($/)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
gem.version = '0.0.1'
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rgrmux
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Matt Rohrer
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Red Green Refactor (t)mux
|
15
|
+
email:
|
16
|
+
- matt@prognostikos.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/rgrmux.rb
|
27
|
+
- lib/rgrmux/rspec.rb
|
28
|
+
- lib/rgrmux/version.rb
|
29
|
+
- rgrmux.gemspec
|
30
|
+
homepage: ''
|
31
|
+
licenses: []
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.8.24
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: An RSpec/Cucumber/Minitest formater for tmux
|
54
|
+
test_files: []
|
55
|
+
has_rdoc:
|