guard-rspec 0.1.4 → 0.1.5

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
@@ -3,7 +3,7 @@
3
3
  RSpec guard allows to automatically & intelligently launch specs when files are modified.
4
4
 
5
5
  - Compatible with RSpec 1.3.x & RSpec 2.0.x
6
- - Tested on Ruby 1.8.7 & 1.9.2.
6
+ - Tested on Ruby 1.8.6, 1.8.7 & 1.9.2.
7
7
 
8
8
  == Install
9
9
 
@@ -57,6 +57,13 @@ RSpec guard should automatically detect RSpec version (via spec_helper syntax or
57
57
  guard 'rspec', :version => 2 do
58
58
  ...
59
59
  end
60
+
61
+ Other available options:
62
+
63
+ :color => false
64
+ :drb => true
65
+ :bundler => false # don't use "bundle exec"
66
+ :rvm => ['1.8.7', '1.9.2'] # directly run your specs on multiple ruby
60
67
 
61
68
  == Development
62
69
 
@@ -66,6 +73,10 @@ RSpec guard should automatically detect RSpec version (via spec_helper syntax or
66
73
  Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
67
74
  you make.
68
75
 
76
+ === Testing
77
+
78
+ Please run "rake spec:prepare_fixtures" once before launching specs.
79
+
69
80
  == Authors
70
81
 
71
82
  {Thibaud Guillaume-Gentil}[http://github.com/thibaudgg]
data/lib/guard/rspec.rb CHANGED
@@ -7,18 +7,19 @@ module Guard
7
7
  autoload :Runner, 'guard/rspec/runner'
8
8
  autoload :Inspector, 'guard/rspec/inspector'
9
9
 
10
- def start
10
+ def initialize(watchers = [], options = {})
11
+ super
11
12
  Runner.set_rspec_version(options)
12
13
  end
13
14
 
14
15
  def run_all
15
- Runner.run ["spec"], :message => "Running all specs"
16
+ Runner.run ["spec"], options.merge(:message => "Running all specs")
16
17
  end
17
18
 
18
19
  def run_on_change(paths)
19
20
  paths = Inspector.clean(paths)
20
- Runner.run(paths) unless paths.empty?
21
+ Runner.run(paths, options) unless paths.empty?
21
22
  end
22
23
 
23
24
  end
24
- end
25
+ end
@@ -3,22 +3,24 @@ module Guard
3
3
  module Runner
4
4
  class << self
5
5
  attr_reader :rspec_version
6
-
6
+
7
7
  def run(paths, options = {})
8
8
  message = options[:message] || "Running: #{paths.join(' ')}"
9
9
  UI.info message, :reset => true
10
- system(rspec_command(paths))
10
+ system(rspec_command(paths, options))
11
11
  end
12
-
12
+
13
13
  def set_rspec_version(options = {})
14
14
  @rspec_version = options[:version] || determine_rspec_version
15
15
  end
16
-
16
+
17
17
  private
18
-
19
- def rspec_command(paths)
18
+
19
+ def rspec_command(paths, options = {})
20
20
  cmd_parts = []
21
- cmd_parts << "bundle exec" if bundler?
21
+ cmd_parts << "rvm #{options[:rvm].join(',')} exec" if options[:rvm].is_a?(Array)
22
+ cmd_parts << "bundle exec" if bundler? && options[:bundler] != false
23
+
22
24
  case rspec_version
23
25
  when 1
24
26
  cmd_parts << "spec"
@@ -27,15 +29,18 @@ module Guard
27
29
  cmd_parts << "rspec"
28
30
  cmd_parts << "--require #{File.dirname(__FILE__)}/formatters/rspec_notify.rb --format RSpecNotify"
29
31
  end
30
- cmd_parts << "--color"
32
+
33
+ cmd_parts << "--drb" if options[:drb] == true
34
+ cmd_parts << "--color" if options[:color] != false
35
+
31
36
  cmd_parts << paths.join(' ')
32
37
  cmd_parts.join(" ")
33
38
  end
34
-
39
+
35
40
  def bundler?
36
41
  @bundler ||= File.exist?("#{Dir.pwd}/Gemfile")
37
42
  end
38
-
43
+
39
44
  def determine_rspec_version
40
45
  UI.info "Determine rspec_version... (can be forced with Guard::RSpec version option)"
41
46
  if File.exist?("#{Dir.pwd}/spec/spec_helper.rb")
@@ -48,8 +53,8 @@ module Guard
48
53
  2
49
54
  end
50
55
  end
51
-
56
+
52
57
  end
53
58
  end
54
59
  end
55
- end
60
+ end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RSpecVersion
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rspec
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thibaud Guillaume-Gentil
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-21 00:00:00 +02:00
18
+ date: 2010-11-05 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,12 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- hash: 19
45
+ hash: 17
46
46
  segments:
47
47
  - 1
48
48
  - 0
49
- - 2
50
- version: 1.0.2
49
+ - 3
50
+ version: 1.0.3
51
51
  type: :development
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
@@ -58,12 +58,12 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- hash: 15
61
+ hash: 13
62
62
  segments:
63
63
  - 2
64
64
  - 0
65
- - 0
66
- version: 2.0.0
65
+ - 1
66
+ version: 2.0.1
67
67
  type: :development
68
68
  version_requirements: *id003
69
69
  description: Guard::RSpec automatically run your specs (much like autotest)