guard-rspec-jruby 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/LICENCE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2012 Garrett Heaver
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ require 'guard/rspec-jruby'
@@ -0,0 +1,66 @@
1
+ require 'java'
2
+ require 'guard'
3
+ require 'guard/guard'
4
+ require 'guard/rspec'
5
+ require 'thread'
6
+
7
+ import org.jruby.Ruby
8
+ import org.jruby.embed.ScriptingContainer
9
+ import org.jruby.embed.LocalContextScope
10
+
11
+ module Guard
12
+
13
+ class RSpecJRuby < ::Guard::RSpec
14
+ def initialize(watchers = [], options = {})
15
+ super
16
+ @runner = RSpecJRubyRunner.new(options)
17
+ end
18
+ end
19
+
20
+ class RSpecJRubyRunner < ::Guard::RSpec::Runner
21
+
22
+ def run_via_shell(paths, options)
23
+ success = 1
24
+
25
+ with_container do |ct|
26
+ ct.put('arguments', paths)
27
+ success = ct.runScriptlet("RSpec::Core::Runner.run(arguments)")
28
+ end
29
+
30
+ success == 0
31
+ end
32
+
33
+ private
34
+
35
+ def with_container
36
+ begin
37
+ yield @container ||= make
38
+ rescue Exception => e
39
+ UI.error(e.message)
40
+ ensure
41
+ reset!(@container)
42
+ end
43
+ end
44
+
45
+ def make
46
+ container = ScriptingContainer.new(LocalContextScope::SINGLETHREAD)
47
+ container.setCompatVersion(Ruby.getGlobalRuntime.getInstanceConfig.getCompatVersion)
48
+ warmup(container)
49
+ container
50
+ end
51
+
52
+ def warmup(container)
53
+ script = ["require 'rubygems'"]
54
+ script << "require 'bundler/setup'" if bundler?
55
+ script << "require 'rspec'"
56
+ container.runScriptlet(script.join("\n"))
57
+ end
58
+
59
+ def reset!(container)
60
+ container.terminate
61
+ warmup(container)
62
+ end
63
+
64
+ end
65
+
66
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-rspec-jruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Garrett Heaver
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: guard
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: guard-rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: A Guard::RSpec extension to improve performance on JRuby
63
+ email:
64
+ - garrett@iterationfour.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - lib/guard/rspec-jruby.rb
70
+ - lib/guard-rspec-jruby.rb
71
+ - LICENCE
72
+ homepage: http://github.com/garrettheaver/guard-rspec-jruby
73
+ licenses: []
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 1.8.24
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: Guard::RSpec JRuby extension
96
+ test_files: []