guard-jruby-rspec 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +22 -5
- data/lib/guard/jruby-rspec.rb +8 -4
- data/lib/guard/jruby-rspec/formatters/notification_rspec.rb +10 -1
- data/lib/guard/jruby-rspec/version.rb +1 -1
- metadata +19 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b6b698bb9f82ddf55e1ee2a703fcd649115d144b
|
4
|
+
data.tar.gz: ddaa9a0bce6cf934da24237d3a2eece728c995bb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ce8afe9313afd0b490f0e3542ca321b3e3283a11561fd424752d623505c841f8677368f4200e7d0484d3feb2d48126ead850ac1f56168ac76347b1ced7d214d7
|
7
|
+
data.tar.gz: f0e2fddf53c88adb152d4044ca954f3f1db0bc7a8b96d1ca5a6a5b550bd69b9da03c15cd6bd93082d7f5467bfa52d76ec6cbd7a414547ffc7ac86b07bb1835f5
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
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
|
-
Most of the config options available to `guard-rspec` work with this extension too.
|
5
|
+
Most of the config options available to `guard-rspec` work with this extension too.
|
6
6
|
|
7
7
|
## How to Use On-Demand mode
|
8
8
|
|
@@ -25,16 +25,16 @@ Then run `guard` like this (probably with Bundler):
|
|
25
25
|
7 examples, 0 failures
|
26
26
|
>
|
27
27
|
|
28
|
-
The first time guard starts up, it will run all of your specs in order to bootstrap the runtime. This first run will be as slow as any other run on JRuby.
|
28
|
+
The first time guard starts up, it will run all of your specs in order to bootstrap the runtime. This first run will be as slow as any other run on JRuby.
|
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
|
+
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.
|
31
31
|
|
32
32
|
## How to Use Autorun mode
|
33
33
|
|
34
34
|
Add something like this to your guard file (alternatives are in the template file):
|
35
35
|
|
36
36
|
interactor :simple
|
37
|
-
guard 'jruby-rspec' do
|
37
|
+
guard 'jruby-rspec' do
|
38
38
|
watch(%r{^spec/.+_spec\.rb$})
|
39
39
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
40
40
|
watch('spec/spec_helper.rb') { "spec" }
|
@@ -42,6 +42,23 @@ Add something like this to your guard file (alternatives are in the template fil
|
|
42
42
|
|
43
43
|
Proceed as in on-demand mode.
|
44
44
|
|
45
|
+
## Code Reloading
|
46
|
+
|
47
|
+
Since JRuby cannot fork, guard-jruby-rspec reloads code with `load` on each changed path, which can potentially cause weird side side effects or errors.
|
48
|
+
|
49
|
+
Rails 3.2+ projects also use the Rails reloader to unload classes on each run.
|
50
|
+
|
51
|
+
Loading classes more than once does not work if the class definition is not idempotent.
|
52
|
+
When using this gem on a non Rails 3.2+ project, you may want to unload these classes manually if you get new errors on the 2nd run:
|
53
|
+
|
54
|
+
Pass in custom reloaders as an option:
|
55
|
+
|
56
|
+
unload_my_class = lambda { |changed_paths| Object.send :remove_const, 'MyClass' }
|
57
|
+
reload_factory_girl = lambda { |changed_paths| FactoryGirl.reload } # Already included by default when FactoryGirl is loaded
|
58
|
+
guard 'jruby-rspec', :custom_reloaders => [unload_my_class, reload_factory_girl] do
|
59
|
+
...
|
60
|
+
end
|
61
|
+
|
45
62
|
## Using CLI Options
|
46
63
|
|
47
64
|
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:
|
@@ -67,4 +84,4 @@ Thank you to the authors of `guard-rspec`. I'm piggybacking off of the hard wor
|
|
67
84
|
|
68
85
|
## Author
|
69
86
|
|
70
|
-
[@codefinger](http://twitter.com/#!/codefinger)
|
87
|
+
[@codefinger](http://twitter.com/#!/codefinger)
|
data/lib/guard/jruby-rspec.rb
CHANGED
@@ -13,7 +13,7 @@ module Guard
|
|
13
13
|
:all_after_pass => true,
|
14
14
|
:all_on_start => true,
|
15
15
|
:keep_failed => true,
|
16
|
-
:spec_paths => ["spec"],
|
16
|
+
:spec_paths => ["spec"],
|
17
17
|
:spec_file_suffix => "_spec.rb",
|
18
18
|
:run_all => {},
|
19
19
|
:monitor_file => ".guard-jruby-rspec",
|
@@ -84,9 +84,13 @@ module Guard
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
def reload_factory_girl(*)
|
88
|
+
FactoryGirl.reload if defined? ::FactoryGirl
|
89
|
+
end
|
90
|
+
|
87
91
|
def reload_paths(paths)
|
88
|
-
paths.reject {|p| p.end_with?(@options[:spec_file_suffix])}.each do |p|
|
89
|
-
if File.exists?(p)
|
92
|
+
paths.reject {|p| p.end_with?(@options[:spec_file_suffix])}.each do |p|
|
93
|
+
if File.exists?(p)
|
90
94
|
if p == @options[:monitor_file]
|
91
95
|
# begin
|
92
96
|
# pidfile = open(@options[:monitor_file], "r+")
|
@@ -112,7 +116,7 @@ module Guard
|
|
112
116
|
|
113
117
|
def set_up_reloaders(options)
|
114
118
|
reloaders = Reloaders.new
|
115
|
-
reloader_methods = [:reload_rails, :reload_paths]
|
119
|
+
reloader_methods = [:reload_rails, :reload_paths, :reload_factory_girl]
|
116
120
|
reloader_procs = reloader_methods.map { |name| method(name) }
|
117
121
|
reloader_procs += options[:custom_reloaders]
|
118
122
|
reloader_procs.each { |reloader| reloaders.register &reloader }
|
@@ -1,6 +1,15 @@
|
|
1
1
|
require "guard/rspec/formatter"
|
2
2
|
|
3
|
-
|
3
|
+
superclass = if Guard::RSpec::Formatter.instance_of? Module # guard-rspec-1.x
|
4
|
+
Object
|
5
|
+
elsif Guard::RSpec::Formatter.instance_of? Class # guard-rspec-2.x
|
6
|
+
Guard::RSpec::Formatter
|
7
|
+
else
|
8
|
+
fail 'Guard::RSpec::Formatter is neither class nor module'
|
9
|
+
end
|
10
|
+
|
11
|
+
class Guard::JRubyRSpec::Formatter::NotificationRSpec < superclass
|
12
|
+
include Guard::RSpec::Formatter if Guard::RSpec::Formatter.instance_of? Module
|
4
13
|
|
5
14
|
def dump_summary(duration, total, failures, pending)
|
6
15
|
message = guard_message(total, failures, pending, duration)
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-jruby-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Joe Kutner
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: guard
|
@@ -18,13 +17,17 @@ dependencies:
|
|
18
17
|
- - '>='
|
19
18
|
- !ruby/object:Gem::Version
|
20
19
|
version: 0.10.0
|
21
|
-
|
20
|
+
- - <
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.0.0
|
22
23
|
requirement: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - '>='
|
25
26
|
- !ruby/object:Gem::Version
|
26
27
|
version: 0.10.0
|
27
|
-
|
28
|
+
- - <
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 2.0.0
|
28
31
|
prerelease: false
|
29
32
|
type: :runtime
|
30
33
|
- !ruby/object:Gem::Dependency
|
@@ -34,13 +37,17 @@ dependencies:
|
|
34
37
|
- - '>='
|
35
38
|
- !ruby/object:Gem::Version
|
36
39
|
version: 0.7.3
|
37
|
-
|
40
|
+
- - <
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 4.0.0
|
38
43
|
requirement: !ruby/object:Gem::Requirement
|
39
44
|
requirements:
|
40
45
|
- - '>='
|
41
46
|
- !ruby/object:Gem::Version
|
42
47
|
version: 0.7.3
|
43
|
-
|
48
|
+
- - <
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 4.0.0
|
44
51
|
prerelease: false
|
45
52
|
type: :runtime
|
46
53
|
- !ruby/object:Gem::Dependency
|
@@ -50,13 +57,11 @@ dependencies:
|
|
50
57
|
- - ~>
|
51
58
|
- !ruby/object:Gem::Version
|
52
59
|
version: '2.7'
|
53
|
-
none: false
|
54
60
|
requirement: !ruby/object:Gem::Requirement
|
55
61
|
requirements:
|
56
62
|
- - ~>
|
57
63
|
- !ruby/object:Gem::Version
|
58
64
|
version: '2.7'
|
59
|
-
none: false
|
60
65
|
prerelease: false
|
61
66
|
type: :development
|
62
67
|
description: Guard::JRubyRSpec keeps a warmed up JVM ready to run your specs.
|
@@ -78,7 +83,9 @@ files:
|
|
78
83
|
- LICENSE
|
79
84
|
- README.md
|
80
85
|
homepage: http://rubygems.org/gems/guard-jruby-rspec
|
81
|
-
licenses:
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
82
89
|
post_install_message:
|
83
90
|
rdoc_options: []
|
84
91
|
require_paths:
|
@@ -88,17 +95,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
95
|
- - '>='
|
89
96
|
- !ruby/object:Gem::Version
|
90
97
|
version: '0'
|
91
|
-
none: false
|
92
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
100
|
- - '>='
|
95
101
|
- !ruby/object:Gem::Version
|
96
102
|
version: 1.3.6
|
97
|
-
none: false
|
98
103
|
requirements: []
|
99
104
|
rubyforge_project: guard-jruby-rspec
|
100
|
-
rubygems_version: 1.
|
105
|
+
rubygems_version: 2.1.9
|
101
106
|
signing_key:
|
102
|
-
specification_version:
|
107
|
+
specification_version: 4
|
103
108
|
summary: Guard gem for JRuby RSpec
|
104
109
|
test_files: []
|