shindo 0.1.12 → 0.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/Gemfile.lock CHANGED
@@ -1,21 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shindo (0.1.9)
4
+ shindo (0.1.12)
5
5
  formatador (>= 0.0.16)
6
- gestalt (>= 0.0.11)
7
6
 
8
7
  GEM
9
8
  remote: http://rubygems.org/
10
9
  specs:
11
10
  formatador (0.0.16)
12
- gestalt (0.0.11)
13
- formatador (>= 0.0.12)
14
11
 
15
12
  PLATFORMS
16
13
  ruby
17
14
 
18
15
  DEPENDENCIES
19
16
  formatador (>= 0.0.16)
20
- gestalt (>= 0.0.11)
21
17
  shindo!
data/lib/shindo.rb CHANGED
@@ -1,11 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'formatador'
3
- require 'gestalt'
4
3
 
5
4
  module Shindo
6
5
 
7
6
  unless const_defined?(:VERSION)
8
- VERSION = '0.1.12'
7
+ VERSION = '0.2.0'
9
8
  end
10
9
 
11
10
  def self.tests(description = nil, tags = [], &block)
@@ -118,9 +117,14 @@ module Shindo
118
117
  end
119
118
  value, success = case type
120
119
  when :raises
121
- raises?(expectation, &block)
120
+ value = begin
121
+ instance_eval(&block)
122
+ rescue => error
123
+ error
124
+ end
125
+ [value, value.is_a?(expectation)]
122
126
  when :returns
123
- returns?(expectation, &block)
127
+ [value = instance_eval(&block), value == expectation]
124
128
  end
125
129
  for after in @afters.flatten.compact
126
130
  after.call
@@ -161,7 +165,7 @@ module Shindo
161
165
 
162
166
  def prompt(description, &block)
163
167
  return if Thread.main[:exit] || Thread.current[:reload]
164
- Formatador.display("Action? [c,e,i,q,r,t,?]? ")
168
+ Formatador.display("Action? [c,q,r,?]? ")
165
169
  choice = STDIN.gets.strip
166
170
  continue = false
167
171
  Formatador.display_line
@@ -169,54 +173,17 @@ module Shindo
169
173
  case choice
170
174
  when 'c', 'continue'
171
175
  continue = true
172
- when /^e .*/, /^eval .*/
173
- begin
174
- value = eval(choice[2..-1], @gestalt.bindings.last)
175
- if value.nil?
176
- value = 'nil'
177
- end
178
- Formatador.display_line(value)
179
- rescue => error
180
- display_error(error)
181
- end
182
- when 'i', 'interactive', 'irb'
183
- Formatador.display_line('Starting interactive session...')
184
- if @irb.nil?
185
- require 'irb'
186
- ARGV.clear # Avoid passing args to IRB
187
- IRB.setup(nil)
188
- @irb = IRB::Irb.new(nil)
189
- IRB.conf[:MAIN_CONTEXT] = @irb.context
190
- IRB.conf[:PROMPT][:SHINDO] = {}
191
- end
192
- for key, value in IRB.conf[:PROMPT][:SIMPLE]
193
- IRB.conf[:PROMPT][:SHINDO][key] = "#{Formatador.indentation}#{value}"
194
- end
195
- @irb.context.prompt_mode = :SHINDO
196
- @irb.context.workspace = IRB::WorkSpace.new(@gestalt.bindings.last)
197
- begin
198
- @irb.eval_input
199
- rescue SystemExit
200
- end
201
176
  when 'q', 'quit', 'exit'
202
177
  Formatador.display_line("Exiting...")
203
178
  Thread.main[:exit] = true
204
179
  when 'r', 'reload'
205
180
  Formatador.display_line("Reloading...")
206
181
  Thread.current[:reload] = true
207
- when 't', 'backtrace', 'trace'
208
- if @gestalt.calls.empty?
209
- Formatador.display_line("[red]No methods were called, so no backtrace was captured.[/]")
210
- else
211
- @gestalt.display_calls
212
- end
213
182
  when '?', 'help'
214
183
  Formatador.display_lines([
215
184
  'c - ignore this error and continue',
216
- 'i - interactive mode',
217
185
  'q - quit Shindo',
218
186
  'r - reload and run the tests again',
219
- 't - display backtrace',
220
187
  '? - display help'
221
188
  ])
222
189
  else
@@ -47,18 +47,5 @@ module Shindo
47
47
  print Formatador.parse("[green]+[/]")
48
48
  end
49
49
 
50
- def raises?(expectation, &block)
51
- value = begin
52
- instance_eval(&block)
53
- rescue => error
54
- error
55
- end
56
- [value, value.is_a?(expectation)]
57
- end
58
-
59
- def returns?(expectation, &block)
60
- [value = instance_eval(&block), value == expectation]
61
- end
62
-
63
50
  end
64
51
  end
@@ -31,15 +31,5 @@ module Shindo
31
31
  Formatador.display_line("[green]+ #{description}[/]")
32
32
  end
33
33
 
34
- def raises?(expectation, &block)
35
- @gestalt = Gestalt.new({'formatador' => Formatador})
36
- [value = @gestalt.run(&block), value.is_a?(expectation)]
37
- end
38
-
39
- def returns?(expectation, &block)
40
- @gestalt = Gestalt.new({'formatador' => Formatador})
41
- [value = @gestalt.run(&block), value == expectation]
42
- end
43
-
44
34
  end
45
35
  end
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.12'
17
- s.date = '2011-01-03'
16
+ s.version = '0.2.0'
17
+ s.date = '2011-01-24'
18
18
  s.rubyforge_project = 'shindo'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -49,7 +49,6 @@ Gem::Specification.new do |s|
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
51
  s.add_dependency('formatador', '>=0.0.16')
52
- s.add_dependency('gestalt', '>=0.0.11')
53
52
 
54
53
  ## List your development dependencies here. Development dependencies are
55
54
  ## those that are only needed during development
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shindo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 12
10
- version: 0.1.12
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - geemus (Wesley Beary)
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-03 00:00:00 -08:00
18
+ date: 2011-01-24 00:00:00 -08:00
19
19
  default_executable: shindo
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,22 +34,6 @@ dependencies:
34
34
  version: 0.0.16
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: gestalt
39
- prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 9
46
- segments:
47
- - 0
48
- - 0
49
- - 11
50
- version: 0.0.11
51
- type: :runtime
52
- version_requirements: *id002
53
37
  description: Work with your tests, not against them.
54
38
  email: geemus@gmail.com
55
39
  executables: