shindo 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -2
- data/Gemfile.lock +20 -17
- data/lib/shindo.rb +18 -19
- data/lib/shindo/bin.rb +9 -12
- data/lib/shindo/taciturn.rb +11 -12
- data/lib/shindo/verbose.rb +9 -9
- data/shindo.gemspec +3 -3
- metadata +5 -5
data/Gemfile
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
gestalt:
|
8
|
-
group:
|
9
|
-
- :default
|
10
|
-
version: ">= 0.0.11"
|
11
|
-
specs:
|
12
|
-
- formatador:
|
13
|
-
version: 0.0.14
|
14
|
-
- gestalt:
|
15
|
-
version: 0.0.11
|
16
|
-
hash: 5c2e77551db0a4772439a57b49e0ecc967e4dfe3
|
17
|
-
sources: []
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
shindo (0.1.9)
|
5
|
+
formatador (>= 0.0.16)
|
6
|
+
gestalt (>= 0.0.11)
|
18
7
|
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
formatador (0.0.16)
|
12
|
+
gestalt (0.0.11)
|
13
|
+
formatador (>= 0.0.12)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
formatador (>= 0.0.16)
|
20
|
+
gestalt (>= 0.0.11)
|
21
|
+
shindo!
|
data/lib/shindo.rb
CHANGED
@@ -5,7 +5,7 @@ require 'gestalt'
|
|
5
5
|
module Shindo
|
6
6
|
|
7
7
|
unless const_defined?(:VERSION)
|
8
|
-
VERSION = '0.1.
|
8
|
+
VERSION = '0.1.10'
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.tests(description = nil, tags = [], &block)
|
@@ -20,7 +20,6 @@ module Shindo
|
|
20
20
|
@befores = []
|
21
21
|
@description_stack = []
|
22
22
|
@tag_stack = []
|
23
|
-
Thread.current[:formatador] = Formatador.new
|
24
23
|
Thread.current[:reload] = false
|
25
24
|
Thread.current[:tags] ||= []
|
26
25
|
Thread.current[:totals] ||= { :failed => 0, :pending => 0, :skipped => 0, :succeeded => 0 }
|
@@ -34,7 +33,7 @@ module Shindo
|
|
34
33
|
@unless_tagged << tag[1..-1]
|
35
34
|
end
|
36
35
|
end
|
37
|
-
|
36
|
+
Formatador.display_line
|
38
37
|
tests(description, tags, &block)
|
39
38
|
end
|
40
39
|
|
@@ -75,7 +74,7 @@ module Shindo
|
|
75
74
|
if block_given?
|
76
75
|
begin
|
77
76
|
display_description(description)
|
78
|
-
|
77
|
+
Formatador.indent { instance_eval(&block) }
|
79
78
|
rescue => error
|
80
79
|
display_error(error)
|
81
80
|
end
|
@@ -145,8 +144,8 @@ module Shindo
|
|
145
144
|
"expected => #{expectation.inspect}",
|
146
145
|
"returned => #{value.inspect}"
|
147
146
|
]
|
148
|
-
|
149
|
-
|
147
|
+
Formatador.indent do
|
148
|
+
Formatador.display_lines([*@message].map {|message| "[red]#{message}[/]"})
|
150
149
|
end
|
151
150
|
@message = nil
|
152
151
|
end
|
@@ -162,11 +161,11 @@ module Shindo
|
|
162
161
|
|
163
162
|
def prompt(description, &block)
|
164
163
|
return if Thread.main[:exit] || Thread.current[:reload]
|
165
|
-
|
164
|
+
Formatador.display("Action? [c,e,i,q,r,t,?]? ")
|
166
165
|
choice = STDIN.gets.strip
|
167
166
|
continue = false
|
168
|
-
|
169
|
-
|
167
|
+
Formatador.display_line
|
168
|
+
Formatador.indent do
|
170
169
|
case choice
|
171
170
|
when 'c', 'continue'
|
172
171
|
continue = true
|
@@ -176,12 +175,12 @@ module Shindo
|
|
176
175
|
if value.nil?
|
177
176
|
value = 'nil'
|
178
177
|
end
|
179
|
-
|
178
|
+
Formatador.display_line(value)
|
180
179
|
rescue => error
|
181
180
|
display_error(error)
|
182
181
|
end
|
183
182
|
when 'i', 'interactive', 'irb'
|
184
|
-
|
183
|
+
Formatador.display_line('Starting interactive session...')
|
185
184
|
if @irb.nil?
|
186
185
|
require 'irb'
|
187
186
|
ARGV.clear # Avoid passing args to IRB
|
@@ -191,7 +190,7 @@ module Shindo
|
|
191
190
|
IRB.conf[:PROMPT][:SHINDO] = {}
|
192
191
|
end
|
193
192
|
for key, value in IRB.conf[:PROMPT][:SIMPLE]
|
194
|
-
IRB.conf[:PROMPT][:SHINDO][key] = "#{
|
193
|
+
IRB.conf[:PROMPT][:SHINDO][key] = "#{Formatador.indentation}#{value}"
|
195
194
|
end
|
196
195
|
@irb.context.prompt_mode = :SHINDO
|
197
196
|
@irb.context.workspace = IRB::WorkSpace.new(@gestalt.bindings.last)
|
@@ -200,19 +199,19 @@ module Shindo
|
|
200
199
|
rescue SystemExit
|
201
200
|
end
|
202
201
|
when 'q', 'quit', 'exit'
|
203
|
-
|
202
|
+
Formatador.display_line("Exiting...")
|
204
203
|
Thread.main[:exit] = true
|
205
204
|
when 'r', 'reload'
|
206
|
-
|
205
|
+
Formatador.display_line("Reloading...")
|
207
206
|
Thread.current[:reload] = true
|
208
207
|
when 't', 'backtrace', 'trace'
|
209
208
|
if @gestalt.calls.empty?
|
210
|
-
|
209
|
+
Formatador.display_line("[red]No methods were called, so no backtrace was captured.[/]")
|
211
210
|
else
|
212
211
|
@gestalt.display_calls
|
213
212
|
end
|
214
213
|
when '?', 'help'
|
215
|
-
|
214
|
+
Formatador.display_lines([
|
216
215
|
'c - ignore this error and continue',
|
217
216
|
'i - interactive mode',
|
218
217
|
'q - quit Shindo',
|
@@ -221,12 +220,12 @@ module Shindo
|
|
221
220
|
'? - display help'
|
222
221
|
])
|
223
222
|
else
|
224
|
-
|
223
|
+
Formatador.display_line("[red]#{choice} is not a valid choice, please try again.[/]")
|
225
224
|
end
|
226
|
-
|
225
|
+
Formatador.display_line
|
227
226
|
end
|
228
227
|
unless continue || Thread.main[:exit]
|
229
|
-
|
228
|
+
Formatador.display_line("[red]- #{description}[/]")
|
230
229
|
prompt(description, &block)
|
231
230
|
end
|
232
231
|
end
|
data/lib/shindo/bin.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'shindo')
|
2
2
|
|
3
3
|
@interrupt = lambda do
|
4
|
-
formatador = Thread.current[:formatador] || Formatador
|
5
4
|
unless Thread.main[:exit]
|
6
|
-
|
5
|
+
Formatador.display_line('Gracefully Exiting... (ctrl-c to force)')
|
7
6
|
Thread.main[:exit] = true
|
8
7
|
else
|
9
|
-
|
8
|
+
Formatador.display_line('Exiting...')
|
10
9
|
Thread.exit
|
11
10
|
end
|
12
11
|
end
|
@@ -66,15 +65,13 @@ run_in_thread(helpers, tests, @thread_locals.merge({:tags => tags}))
|
|
66
65
|
|
67
66
|
@totals ||= { :failed => 0, :pending => 0, :succeeded => 0 }
|
68
67
|
@success = @totals[:failed] == 0
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
Formatador.
|
76
|
-
Formatador.display_line(lines.join(' '))
|
77
|
-
Formatador.display_line
|
68
|
+
status = []
|
69
|
+
status << "[red]#{@totals[:failed]} failed[/]," if @totals[:failed] > 0
|
70
|
+
status << "[yellow]#{@totals[:pending]} pending[/]," if @totals[:pending] > 0
|
71
|
+
status << "[green]#{@totals[:succeeded]} succeeded[/]"
|
72
|
+
status = status[0...-2].join(', ') << ' and ' << status[-1] if status.length > 3
|
73
|
+
status << "in [bold]#{Time.now - @started_at}[/] seconds"
|
74
|
+
Formatador.display_lines(['', status.join(' '), ''])
|
78
75
|
|
79
76
|
if @success
|
80
77
|
Kernel.exit(0)
|
data/lib/shindo/taciturn.rb
CHANGED
@@ -4,10 +4,10 @@ module Shindo
|
|
4
4
|
private
|
5
5
|
|
6
6
|
def display_description_stack
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
Formatador.indent do
|
8
|
+
@description_stack.length.times do
|
9
|
+
Formatador.display_line(@description_stack.pop)
|
10
|
+
end
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -20,22 +20,21 @@ module Shindo
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def display_error(error)
|
23
|
+
Formatador.display_lines(['', Thread.current[:file]])
|
23
24
|
display_description_stack
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
Thread.current[:formatador].display_lines(error.backtrace.map {|line| "[red]#{line}[/]"})
|
29
|
-
end
|
25
|
+
Formatador.display_line("[red]#{error.message} (#{error.class})[/]")
|
26
|
+
unless error.backtrace.empty?
|
27
|
+
Formatador.indent do
|
28
|
+
Formatador.display_lines(error.backtrace.map {|line| "[red]#{line}[/]"})
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
33
|
def display_failure(description)
|
35
34
|
Thread.current[:totals][:failed] += 1
|
36
|
-
Thread.current[:
|
35
|
+
Formatador.display_lines(['', Thread.current[:file]])
|
37
36
|
display_description_stack
|
38
|
-
|
37
|
+
Formatador.display_line("[red]- #{description}[/]")
|
39
38
|
end
|
40
39
|
|
41
40
|
def display_pending(description)
|
data/lib/shindo/verbose.rb
CHANGED
@@ -4,40 +4,40 @@ module Shindo
|
|
4
4
|
private
|
5
5
|
|
6
6
|
def display_description(description)
|
7
|
-
|
7
|
+
Formatador.display_line(description)
|
8
8
|
end
|
9
9
|
|
10
10
|
def display_error(error)
|
11
|
-
|
11
|
+
Formatador.display_line("[red]#{error.message} (#{error.class})[/]")
|
12
12
|
unless error.backtrace.empty?
|
13
|
-
|
14
|
-
|
13
|
+
Formatador.indent do
|
14
|
+
Formatador.display_lines(error.backtrace.map {|line| "[red]#{line}[/]"})
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def display_failure(description)
|
20
20
|
Thread.current[:totals][:failed] += 1
|
21
|
-
|
21
|
+
Formatador.display_line("[red]- #{description}[/]")
|
22
22
|
end
|
23
23
|
|
24
24
|
def display_pending(description)
|
25
25
|
Thread.current[:totals][:pending] += 1
|
26
|
-
|
26
|
+
Formatador.display_line("[yellow]# #{description}[/]")
|
27
27
|
end
|
28
28
|
|
29
29
|
def display_success(description)
|
30
30
|
Thread.current[:totals][:succeeded] += 1
|
31
|
-
|
31
|
+
Formatador.display_line("[green]+ #{description}[/]")
|
32
32
|
end
|
33
33
|
|
34
34
|
def raises?(expectation, &block)
|
35
|
-
@gestalt = Gestalt.new({'formatador' =>
|
35
|
+
@gestalt = Gestalt.new({'formatador' => Formatador})
|
36
36
|
[value = @gestalt.run(&block), value.is_a?(expectation)]
|
37
37
|
end
|
38
38
|
|
39
39
|
def returns?(expectation, &block)
|
40
|
-
@gestalt = Gestalt.new({'formatador' =>
|
40
|
+
@gestalt = Gestalt.new({'formatador' => Formatador})
|
41
41
|
[value = @gestalt.run(&block), value == expectation]
|
42
42
|
end
|
43
43
|
|
data/shindo.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'shindo'
|
16
|
-
s.version = '0.1.
|
17
|
-
s.date = '2010-11-
|
16
|
+
s.version = '0.1.10'
|
17
|
+
s.date = '2010-11-18'
|
18
18
|
s.rubyforge_project = 'shindo'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
|
|
48
48
|
|
49
49
|
## List your runtime dependencies here. Runtime dependencies are those
|
50
50
|
## that are needed for an end user to actually USE your code.
|
51
|
-
s.add_dependency('formatador', '>=0.0.
|
51
|
+
s.add_dependency('formatador', '>=0.0.16')
|
52
52
|
s.add_dependency('gestalt', '>=0.0.11')
|
53
53
|
|
54
54
|
## List your development dependencies here. Development dependencies are
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 10
|
9
|
+
version: 0.1.10
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-18 00:00:00 -08:00
|
18
18
|
default_executable: shindo
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 0
|
29
29
|
- 0
|
30
|
-
-
|
31
|
-
version: 0.0.
|
30
|
+
- 16
|
31
|
+
version: 0.0.16
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|