autotest-tmux 1.1.0 → 1.2.0
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 +1 -0
- data/README.rdoc +1 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/autotest-tmux.gemspec +4 -4
- data/lib/autotest/tmux.rb +18 -18
- data/spec/autotest-tmux_spec.rb +27 -1
- metadata +5 -5
data/.gitignore
CHANGED
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -5,8 +5,8 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "autotest-tmux"
|
8
|
-
gem.summary = %Q{
|
9
|
-
gem.description = %Q{
|
8
|
+
gem.summary = %Q{displays autotest/autospec progress on tmux status-right.}
|
9
|
+
gem.description = %Q{displays autotest/autospec progress on tmux status-right.}
|
10
10
|
gem.email = "yoshuki@saikyoline.jp"
|
11
11
|
gem.homepage = "http://github.com/yoshuki/autotest-tmux"
|
12
12
|
gem.authors = ["MIKAMI Yoshiyuki"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/autotest-tmux.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{autotest-tmux}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["MIKAMI Yoshiyuki"]
|
12
|
-
s.date = %q{2010-10-
|
13
|
-
s.description = %q{
|
12
|
+
s.date = %q{2010-10-15}
|
13
|
+
s.description = %q{displays autotest/autospec progress on tmux status-right.}
|
14
14
|
s.email = %q{yoshuki@saikyoline.jp}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
34
34
|
s.require_paths = ["lib"]
|
35
35
|
s.rubygems_version = %q{1.3.7}
|
36
|
-
s.summary = %q{
|
36
|
+
s.summary = %q{displays autotest/autospec progress on tmux status-right.}
|
37
37
|
s.test_files = [
|
38
38
|
"spec/autotest-tmux_spec.rb",
|
39
39
|
"spec/spec_helper.rb"
|
data/lib/autotest/tmux.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'autotest'
|
3
3
|
|
4
4
|
##
|
5
|
-
# Autotest::Tmux
|
5
|
+
# Autotest::Tmux displays autotest/autospec progress on tmux status-right.
|
6
6
|
#
|
7
7
|
# == Features
|
8
8
|
# * Screenshots aren't available yet. (but, almost same as autotest_screen[http://f.hatena.ne.jp/yoshuki/autotest_screen/].)
|
@@ -26,8 +26,13 @@ class Autotest::Tmux
|
|
26
26
|
:red => ['white', 'red']
|
27
27
|
}
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
@last_result = {}
|
30
|
+
|
31
|
+
def self.message(msg=statusright, sc=:black)
|
32
|
+
msg ||= statusright # when nil given
|
33
|
+
sc ||= :black # when nil given
|
34
|
+
|
35
|
+
col = SCREEN_COLOR[sc]
|
31
36
|
msg = "#[fg=#{col[0]},bg=#{col[1]}] #{msg} #[default]" unless msg == statusright
|
32
37
|
send_cmd(msg)
|
33
38
|
end
|
@@ -37,8 +42,7 @@ class Autotest::Tmux
|
|
37
42
|
end
|
38
43
|
|
39
44
|
def self.run_tmux_session?
|
40
|
-
|
41
|
-
system cmd
|
45
|
+
system "#{tmux_cmd} has-session"
|
42
46
|
end
|
43
47
|
|
44
48
|
def self.execute?
|
@@ -52,13 +56,9 @@ class Autotest::Tmux
|
|
52
56
|
def self.tmux_cmd=(tc); @tmux_cmd = tc; end
|
53
57
|
|
54
58
|
def self.send_cmd(msg)
|
55
|
-
|
56
|
-
system cmd
|
57
|
-
nil
|
59
|
+
system "#{tmux_cmd} set status-right '#{msg.gsub("'", "\'")}'"
|
58
60
|
end
|
59
61
|
|
60
|
-
@last_message = {}
|
61
|
-
|
62
62
|
# All blocks return false, to execute each of following blocks defined in user's own ".autotest".
|
63
63
|
|
64
64
|
# Do nothing.
|
@@ -104,23 +104,23 @@ class Autotest::Tmux
|
|
104
104
|
num_failures, num_errors = results.map{|r| r.to_i}
|
105
105
|
|
106
106
|
if num_failures > 0 || num_errors > 0
|
107
|
-
@
|
107
|
+
@last_result = {:message => "Red F:#{num_failures} E:#{num_errors}", :color => :red}
|
108
108
|
else
|
109
|
-
@
|
109
|
+
@last_result = {:message => 'All Green', :color => :green}
|
110
110
|
end
|
111
|
-
when 'Autotest::Rspec', 'Autotest::Rspec2', 'Autotest::RailsRspec', 'Autotest::MerbRspec'
|
111
|
+
when 'Autotest::Rspec', 'Autotest::Rspec2', 'Autotest::RailsRspec', 'Autotest::RailsRspec2', 'Autotest::MerbRspec'
|
112
112
|
results = output.scan(/(\d+)\s*examples?,\s*(\d+)\s*failures?(?:,\s*(\d+)\s*pendings?)?/).first
|
113
113
|
num_examples, num_failures, num_pendings = results.map{|r| r.to_i}
|
114
114
|
|
115
115
|
if num_failures > 0
|
116
|
-
@
|
116
|
+
@last_result = {:message => "Fail F:#{num_failures} P:#{num_pendings}", :color => :red}
|
117
117
|
elsif num_pendings > 0
|
118
|
-
@
|
118
|
+
@last_result = {:message => "Pend F:#{num_failures} P:#{num_pendings}", :color => :yellow}
|
119
119
|
else
|
120
|
-
@
|
120
|
+
@last_result = {:message => 'All Green', :color => :green}
|
121
121
|
end
|
122
122
|
else
|
123
|
-
@
|
123
|
+
@last_result = {:message => "Unknown class. (#{class_name})"}
|
124
124
|
end
|
125
125
|
next false
|
126
126
|
end
|
@@ -147,7 +147,7 @@ class Autotest::Tmux
|
|
147
147
|
|
148
148
|
Autotest.add_hook :waiting do |at, *args|
|
149
149
|
sleep 0.5
|
150
|
-
message @
|
150
|
+
message @last_result[:message], @last_result[:color] if execute?
|
151
151
|
next false
|
152
152
|
end
|
153
153
|
end
|
data/spec/autotest-tmux_spec.rb
CHANGED
@@ -1,10 +1,36 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe Autotest::Tmux do
|
4
|
-
context '
|
4
|
+
context 'All added hooks should be called by autotest' do
|
5
5
|
Autotest::HOOKS.keys.each do |hook|
|
6
6
|
subject { Autotest::ALL_HOOKS }
|
7
7
|
it { should include(hook) }
|
8
8
|
end
|
9
9
|
end
|
10
|
+
|
11
|
+
describe 'When display message' do
|
12
|
+
context 'without params' do
|
13
|
+
it { Autotest::Tmux.message.should be_true }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with String as message' do
|
17
|
+
it { Autotest::Tmux.message('foo').should be_true }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with nil as message' do
|
21
|
+
it { Autotest::Tmux.message(nil).should be_true }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'with Symbol as color' do
|
25
|
+
it { Autotest::Tmux.message('foo', :black).should be_true }
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'with nil as color' do
|
29
|
+
it { Autotest::Tmux.message('foo', nil).should be_true }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
after(:all) do
|
34
|
+
Autotest::Tmux.clear
|
35
|
+
end
|
10
36
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- MIKAMI Yoshiyuki
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-15 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
version: "0"
|
61
61
|
type: :runtime
|
62
62
|
version_requirements: *id003
|
63
|
-
description:
|
63
|
+
description: displays autotest/autospec progress on tmux status-right.
|
64
64
|
email: yoshuki@saikyoline.jp
|
65
65
|
executables: []
|
66
66
|
|
@@ -112,7 +112,7 @@ rubyforge_project:
|
|
112
112
|
rubygems_version: 1.3.7
|
113
113
|
signing_key:
|
114
114
|
specification_version: 3
|
115
|
-
summary:
|
115
|
+
summary: displays autotest/autospec progress on tmux status-right.
|
116
116
|
test_files:
|
117
117
|
- spec/autotest-tmux_spec.rb
|
118
118
|
- spec/spec_helper.rb
|