autotest-tmux 1.2.3 → 1.3.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/README.rdoc CHANGED
@@ -15,6 +15,7 @@ Autotest::Tmux displays autotest/autospec progress on tmux status-right.
15
15
  $HOME/.autotest
16
16
  require 'autotest/tmux'
17
17
  # Autotest::Tmux.statusright = '"#22T" %H:%M %d-%b-%y (your statusright)'
18
+ # Autotest::Tmux.rspec_classes = ['Autotest::Rspec', 'Autotest::RailsRspec']
18
19
 
19
20
  * To prevent server information (like "set option: status-right -> ..."), you should start tmux server with -q option first.
20
21
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{autotest-tmux}
8
- s.version = "1.2.3"
8
+ s.version = "1.3.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{2011-07-22}
12
+ s.date = %q{2011-07-23}
13
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 = [
data/lib/autotest/tmux.rb CHANGED
@@ -18,6 +18,11 @@ require 'autotest'
18
18
  class Autotest::Tmux
19
19
  DEFAULT_STATUSRIGHT = '"#22T" %H:%M %d-%b-%y'
20
20
  DEFAULT_TMUX_CMD = 'tmux'
21
+ DEFAULT_UTEST_CLASSES = ['Autotest', 'Autotest::Rails']
22
+ DEFAULT_RSPEC_CLASSES = ['Autotest::Rspec', 'Autotest::Rspec2',
23
+ 'Autotest::RailsRspec', 'Autotest::RailsRspec2',
24
+ 'Autotest::MerbRspec',
25
+ 'Autotest::CucumberRspec2']
21
26
 
22
27
  SCREEN_COLOR = {
23
28
  :black => ['white', 'black'],
@@ -28,6 +33,20 @@ class Autotest::Tmux
28
33
 
29
34
  @last_result = {}
30
35
 
36
+ @statusright = @tmux_cmd = @utest_classes = @rspec_classes = nil
37
+ def self.statusright; @statusright || DEFAULT_STATUSRIGHT.dup; end
38
+ def self.statusright=(s); @statusright = s; end
39
+ def self.tmux_cmd; @tmux_cmd || DEFAULT_TMUX_CMD.dup; end
40
+ def self.tmux_cmd=(tc); @tmux_cmd = tc; end
41
+ def self.utest_classes; @utest_classes || DEFAULT_UTEST_CLASSES.dup; end
42
+ def self.utest_classes=(uc); @utest_classes = uc; end
43
+ def self.rspec_classes; @rspec_classes || DEFAULT_RSPEC_CLASSES.dup; end
44
+ def self.rspec_classes=(rc); @rspec_classes = rc; end
45
+
46
+ def self.send_cmd(msg)
47
+ system "#{tmux_cmd} set status-right '#{msg.gsub("'", "\'")}'"
48
+ end
49
+
31
50
  def self.message(msg=statusright, sc=:black)
32
51
  msg ||= statusright # when nil given
33
52
  sc ||= :black # when nil given
@@ -49,14 +68,30 @@ class Autotest::Tmux
49
68
  !($TESTING || !run_tmux_session?)
50
69
  end
51
70
 
52
- @statusright = @tmux_cmd = nil
53
- def self.statusright; @statusright || DEFAULT_STATUSRIGHT.dup; end
54
- def self.statusright=(s); @statusright = s; end
55
- def self.tmux_cmd; @tmux_cmd || DEFAULT_TMUX_CMD.dup; end
56
- def self.tmux_cmd=(tc); @tmux_cmd = tc; end
71
+ def self.parse_output(output, class_name)
72
+ case class_name
73
+ when *utest_classes
74
+ results = output.scan(/(\d+)\s*failures?,\s*(\d+)\s*errors?/).first
75
+ num_failures, num_errors = results.map{|r| r.to_i}
57
76
 
58
- def self.send_cmd(msg)
59
- system "#{tmux_cmd} set status-right '#{msg.gsub("'", "\'")}'"
77
+ if num_failures > 0 || num_errors > 0
78
+ result = {:message => "Red F:#{num_failures} E:#{num_errors}", :color => :red}
79
+ else
80
+ result = {:message => 'All Green', :color => :green}
81
+ end
82
+ when *rspec_classes
83
+ results = output.scan(/(\d+)\s*examples?,\s*(\d+)\s*failures?(?:,\s*(\d+)\s*pendings?)?/).first
84
+ num_examples, num_failures, num_pendings = results.map{|r| r.to_i}
85
+
86
+ if num_failures > 0
87
+ result = {:message => "Fail F:#{num_failures} P:#{num_pendings}", :color => :red}
88
+ elsif num_pendings > 0
89
+ result = {:message => "Pend F:#{num_failures} P:#{num_pendings}", :color => :yellow}
90
+ else
91
+ result = {:message => 'All Green', :color => :green}
92
+ end
93
+ end
94
+ result || {:message => "Unknown class. (#{class_name})"}
60
95
  end
61
96
 
62
97
  # All blocks return false, to execute each of following blocks defined in user's own ".autotest".
@@ -92,32 +127,6 @@ class Autotest::Tmux
92
127
  next false
93
128
  end
94
129
 
95
- def self.parse_output(output, class_name)
96
- case class_name
97
- when 'Autotest', 'Autotest::Rails'
98
- results = output.scan(/(\d+)\s*failures?,\s*(\d+)\s*errors?/).first
99
- num_failures, num_errors = results.map{|r| r.to_i}
100
-
101
- if num_failures > 0 || num_errors > 0
102
- result = {:message => "Red F:#{num_failures} E:#{num_errors}", :color => :red}
103
- else
104
- result = {:message => 'All Green', :color => :green}
105
- end
106
- when 'Autotest::Rspec', 'Autotest::Rspec2', 'Autotest::RailsRspec', 'Autotest::RailsRspec2', 'Autotest::MerbRspec', 'Autotest::CucumberRspec2'
107
- results = output.scan(/(\d+)\s*examples?,\s*(\d+)\s*failures?(?:,\s*(\d+)\s*pendings?)?/).first
108
- num_examples, num_failures, num_pendings = results.map{|r| r.to_i}
109
-
110
- if num_failures > 0
111
- result = {:message => "Fail F:#{num_failures} P:#{num_pendings}", :color => :red}
112
- elsif num_pendings > 0
113
- result = {:message => "Pend F:#{num_failures} P:#{num_pendings}", :color => :yellow}
114
- else
115
- result = {:message => 'All Green', :color => :green}
116
- end
117
- end
118
- result || {:message => "Unknown class. (#{class_name})"}
119
- end
120
-
121
130
  Autotest.add_hook :ran_command do |at, *args|
122
131
  next false unless execute?
123
132
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: autotest-tmux
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.3
5
+ version: 1.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - MIKAMI Yoshiyuki
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-07-22 00:00:00 Z
13
+ date: 2011-07-23 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: autotest