guard-jruby-rspec 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # guard-jruby-rspec
2
2
 
3
- This guard extention allows you to run all of your specs on JRuby without the initial start up cost. *It does not run a subset of your specs like guard-rspec* and it does not trigger a run when a file changes.
3
+ This guard extention allows you to run all of your specs on JRuby without the initial start up cost. It loads all of your application files in advance, and reloads any that change. That way, when you run RSpec, the JVM is already running, and your files have already been required.
4
4
 
5
- Instead, this extension loads all of your application files in advance, and reloads any that change. That way, when you run RSpec, the JVM is already running, and your files have already been required.
5
+ Most of the config options available to `guard-rspec` work with this extension too. Notably missing (but coming soon) is `:cli`.
6
6
 
7
- ## How to Use
7
+ ## How to Use On-Demand mode
8
8
 
9
9
  Just add this to your guard file:
10
10
 
11
+ interactor :simple
11
12
  guard 'jruby-rspec', :spec_paths => ["spec"]
12
13
 
13
14
  Then run `guard` like this (probably with Bundler):
@@ -28,11 +29,27 @@ The first time guard starts up, it will run all of your specs in order to bootst
28
29
 
29
30
  Once you change some files, and press return at the guard prompt to rerun your specs. You'll notice it's a lot faster than running `rspec` from the command line.
30
31
 
31
- NOTE: sometime you have to hit return twice because stdin is flaky on JRuby. You probably see this message a lot, but it's okay:
32
+ ## How to Use Autorun mode
32
33
 
33
- stty: stdin isn't a terminal
34
+ Add something like this to your guard file (alternatives are in the template file):
34
35
 
35
- This will be improved.
36
+ interactor :simple
37
+ guard 'jruby-rspec' do
38
+ watch(%r{^spec/.+_spec\.rb$})
39
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
40
+ watch('spec/spec_helper.rb') { "spec" }
41
+ end
42
+
43
+ Proceed as in on-demand mode.
44
+
45
+ # Using CLI Options
46
+
47
+ The format that `guard-jruby-rspec` expects CLI options to be in is a little different than what `guard-rspec` exepcts. Here is an example:
48
+
49
+ interactor :simple
50
+ guard "jruby-rspec", :cli => ["-c", "-t~slow"]
51
+
52
+ The CLI options should be an Array containing a number of strings. Each string should be a flag and an option value with no space between the flag and the value.
36
53
 
37
54
  ## TODO
38
55
 
@@ -44,6 +61,10 @@ This will be improved.
44
61
 
45
62
  + Work out the kinks in gj-rspec script so that specs can be run in main terminal.
46
63
 
64
+ ## Thank You
65
+
66
+ Thank you to the authors of `guard-rspec`. I'm piggybacking off of the hard work done by [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) and others!
67
+
47
68
  ## Author
48
69
 
49
70
  [@codefinger](http://twitter.com/#!/codefinger)
@@ -1,14 +1,13 @@
1
1
  require 'rspec'
2
2
  require 'guard/jruby-rspec/formatters/notification_rspec'
3
- #require 'guard/rspec/runner'
4
3
 
5
4
  module Guard
6
5
  class JRubyRSpec
7
- class Runner #< ::Guard::RSpec::Runner
6
+ class Runner
8
7
 
9
8
  def initialize(options = {})
10
9
  @options = {
11
- :cli => nil,
10
+ :cli => [],
12
11
  :notification => true
13
12
  }.merge(options)
14
13
 
@@ -53,7 +52,7 @@ module Guard
53
52
  file_name = "#{Dir.pwd}/.rspec"
54
53
  parsed_formatter = if File.exist?(file_name)
55
54
  formatters = File.read(file_name).scan(formatter_regex).flatten
56
- formatters.map { |formatter| "-f #{formatter}" }.join(' ')
55
+ formatters.map { |formatter| "-f#{formatter}" }.join(' ')
57
56
  end
58
57
 
59
58
  parsed_formatter.nil? || parsed_formatter.empty? ? '-fprogress' : parsed_formatter
@@ -64,13 +63,11 @@ module Guard
64
63
 
65
64
  def rspec_arguments(paths, options)
66
65
  arg_parts = []
67
- # arg_parts << options[:cli]
66
+ arg_parts.concat(options[:cli]) if options[:cli]
68
67
  if @options[:notification]
69
68
  arg_parts << parsed_or_default_formatter unless options[:cli] =~ formatter_regex
70
- # arg_parts << "-r #{File.dirname(__FILE__)}/formatters/notification_rspec.rb"
71
69
  arg_parts << "-fGuard::JRubyRSpec::Formatter::NotificationRSpec"
72
70
  arg_parts << "-o/dev/null"
73
- arg_parts << "-c"
74
71
  end
75
72
  #arg_parts << "--failure-exit-code #{FAILURE_EXIT_CODE}" if failure_exit_code_supported?
76
73
  arg_parts.concat(paths)
@@ -1,3 +1,6 @@
1
+ # This eliminates the stty warning.
2
+ interactor :simple
3
+
1
4
  guard 'jruby-rspec', :spec_paths => ["spec"] do
2
5
  # You can leave this empty and jruby-rspec will not autorun,
3
6
  # but it will run all specs in :spec_paths on demand
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module JRubyRSpecVersion
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: guard-jruby-rspec
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Joe Kutner
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-05-30 00:00:00 Z
13
+ date: 2012-05-31 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: guard