guillaumegentil-rspactor 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('rspactor', '0.2.4') do |p|
5
+ Echoe.new('rspactor', '0.2.5') do |p|
6
6
  p.description = "RSpactor is a little command line tool to automatically run your changed specs (much like autotest)."
7
7
  p.url = "http://github.com/guillaumegentil/rspactor/"
8
8
  p.author = "Andreas Wolff"
data/bin/rspactor CHANGED
@@ -10,9 +10,12 @@ module RSpactor extend OptiFlagSet
10
10
  optional_switch_flag "drb" do
11
11
  description "use spec_server"
12
12
  end
13
+ optional_switch_flag "clear" do
14
+ description "clear shell before each spec execution"
15
+ end
13
16
 
14
17
  and_process!
15
18
  end
16
19
 
17
20
 
18
- Runner.load(ARGV.flags.drb?)
21
+ Runner.load(:drb => ARGV.flags.drb?, :clear => ARGV.flags.clear?)
data/lib/interactor.rb CHANGED
@@ -2,13 +2,15 @@ require 'timeout'
2
2
 
3
3
  class Interactor
4
4
 
5
- def initialize
5
+ def initialize(options = {})
6
+ @options = options
6
7
  ticker
7
8
  end
8
9
 
9
- def wait_for_enter_key(msg, seconds_to_wait)
10
+ def wait_for_enter_key(msg, seconds_to_wait, clear = false)
10
11
  begin
11
12
  Timeout::timeout(seconds_to_wait) do
13
+ system("clear;") if clear
12
14
  ticker(:start => true, :msg => msg)
13
15
  $stdin.gets
14
16
  return true
@@ -26,7 +28,7 @@ class Interactor
26
28
  loop do
27
29
  sleep 0.5
28
30
  if $stdin.gets
29
- if wait_for_enter_key("** Running all specs.. Hit <enter> again to exit RSpactor", 3)
31
+ if wait_for_enter_key("** Running all specs.. Hit <enter> again to exit RSpactor", 3, @options[:clear])
30
32
  @main_thread.exit
31
33
  exit
32
34
  end
data/lib/runner.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  class Runner
2
2
 
3
- def self.load(drb = false)
3
+ def self.load(options = {})
4
+ @options = options
4
5
  @inspector = Inspector.new
5
- @interactor = Interactor.new
6
- @drb = drb
6
+ @interactor = Interactor.new(@options)
7
7
 
8
- puts "** RSpactor is now watching at '#{Dir.pwd}'#{' and using spec_server' if @drb}"
8
+ puts "** RSpactor is now watching at '#{Dir.pwd}'#{' and using spec_server' if @options[:drb]}"
9
9
 
10
10
  if initial_spec_run_abort
11
11
  @interactor.start_termination_handler
@@ -27,12 +27,13 @@ class Runner
27
27
  files_to_spec = []
28
28
  files.each do |file|
29
29
  spec_file = @inspector.find_spec_file(file)
30
- if spec_file && !files_to_spec.include?(spec_file)
31
- puts spec_file
32
- files_to_spec << spec_file
33
- end
30
+ files_to_spec << spec_file if spec_file && !files_to_spec.include?(spec_file)
31
+ end
32
+ unless files_to_spec.empty?
33
+ system("clear;") if @options[:clear]
34
+ files_to_spec.each { |spec_file| puts spec_file }
35
+ run_spec_command(files_to_spec)
34
36
  end
35
- run_spec_command(files_to_spec) unless files_to_spec.empty?
36
37
  end
37
38
 
38
39
  def self.run_spec_command(locations)
@@ -43,7 +44,7 @@ class Runner
43
44
  cmd = "RAILS_ENV=test; "
44
45
  cmd << "#{spec_runner_bin} "
45
46
  cmd << "#{locations} #{spec_opts(base_spec_root)} "
46
- cmd << "--drb " if @drb
47
+ cmd << "--drb " if @options[:drb]
47
48
  cmd << "-r #{File.dirname(__FILE__)}/../lib/resulting.rb -f RSpactorFormatter:STDOUT"
48
49
  # puts cmd
49
50
  system(cmd)
@@ -67,11 +68,12 @@ class Runner
67
68
  end
68
69
 
69
70
  def self.script_runner(file)
70
- root = file[0..file.index("spec") - 1]
71
- if File.exist?(root + "script/spec")
72
- return root + "script/spec"
73
- else
74
- "spec"
75
- end
71
+ # root = file[0..file.index("spec") - 1]
72
+ # if File.exist?(root + "script/spec")
73
+ # return root + "script/spec"
74
+ # else
75
+ # "spec"
76
+ # end
77
+ "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby /Library/Ruby/Gems/1.8/gems/rspec-1.1.99.10/bin/spec"
76
78
  end
77
79
  end
data/rspactor.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rspactor}
5
- s.version = "0.2.4"
5
+ s.version = "0.2.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Andreas Wolff"]
9
- s.date = %q{2009-02-03}
9
+ s.date = %q{2009-03-13}
10
10
  s.default_executable = %q{rspactor}
11
11
  s.description = %q{RSpactor is a little command line tool to automatically run your changed specs (much like autotest).}
12
12
  s.email = %q{treas@dynamicdudes.com}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guillaumegentil-rspactor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Wolff
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-03 00:00:00 -08:00
12
+ date: 2009-03-13 00:00:00 -07:00
13
13
  default_executable: rspactor
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: optiflag
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements: