rjb-loader 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +56 -0
- data/Rakefile +1 -0
- data/lib/rjb-loader.rb +76 -0
- data/lib/rjb-loader/version.rb +4 -0
- data/rjb-loader.gemspec +26 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA512:
|
3
|
+
data.tar.gz: 4b39a5510ce897bd45c0eb733b3156abe65d7f6e0f9423b6400bb4d2416e076978002e88880547bc48482830763b553575ec8d45901a2bb1c11bd3998b1aceab
|
4
|
+
metadata.gz: 8dfe27cd2d8fab9c47b9fbd86009b8f9c7bdabad5c1b80309e9bc03b469d0b83ff181303053640b5ec66d42ebcc892fd070ebad6864a461b21f41f3c01211ea0
|
5
|
+
SHA1:
|
6
|
+
data.tar.gz: 64954ec39a32bf6453f062ed6fb525e55cf19910
|
7
|
+
metadata.gz: d0685b571738a602df3f7b988bce4475d4dc22ed
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
Copyright (C) 2013 Marlus Saraiva
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# rjb-loader
|
2
|
+
|
3
|
+
Rjb (Ruby Java Bridge) loader with before_load and after_load hooks
|
4
|
+
|
5
|
+
# Description
|
6
|
+
When working with multiple gems or several rails initializer files that use Rjb,
|
7
|
+
you need to make sure that java dependencies of each implementation
|
8
|
+
get all set up before running Rjb::load. This is necessary because Rjb can only be loaded once.
|
9
|
+
|
10
|
+
You can use rjb-loader to change classpath and java options, by adding 'before_load' to your gem or rails initializer.
|
11
|
+
|
12
|
+
The 'after_load' hook can be used when your code needs an already loaded Rjb.
|
13
|
+
For instance, when you need to import and use the java classes.
|
14
|
+
|
15
|
+
## Install
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install rjb-loader
|
19
|
+
```
|
20
|
+
|
21
|
+
## Configure
|
22
|
+
|
23
|
+
Add `rjb-loader` to your Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem "rjb-loader"
|
27
|
+
```
|
28
|
+
|
29
|
+
For any issues related to the java/ruby integration, please check out: [http://rjb.rubyforge.org/](http://rjb.rubyforge.org/). You will find here plenty tips that might help you to solve your problem.
|
30
|
+
|
31
|
+
## Using rjb-loader
|
32
|
+
|
33
|
+
TODO
|
34
|
+
|
35
|
+
## LICENSE
|
36
|
+
|
37
|
+
Copyright (C) 2013 Marlus Saraiva
|
38
|
+
|
39
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
40
|
+
a copy of this software and associated documentation files (the
|
41
|
+
"Software"), to deal in the Software without restriction, including
|
42
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
43
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
44
|
+
permit persons to whom the Software is furnished to do so, subject to
|
45
|
+
the following conditions:
|
46
|
+
|
47
|
+
The above copyright notice and this permission notice shall be
|
48
|
+
included in all copies or substantial portions of the Software.
|
49
|
+
|
50
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
51
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
52
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
53
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
54
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
55
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
56
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/rjb-loader.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2013 Marlus Saraiva
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
require "rjb-loader/version"
|
24
|
+
require "rjb"
|
25
|
+
require "rails"
|
26
|
+
|
27
|
+
module RjbLoader
|
28
|
+
|
29
|
+
class Config
|
30
|
+
attr_accessor :classpath
|
31
|
+
attr_accessor :java_options
|
32
|
+
end
|
33
|
+
|
34
|
+
class << self
|
35
|
+
attr_accessor :before_load_blocks
|
36
|
+
attr_accessor :after_load_blocks
|
37
|
+
attr_accessor :config
|
38
|
+
end
|
39
|
+
|
40
|
+
self.before_load_blocks = []
|
41
|
+
self.after_load_blocks = []
|
42
|
+
self.config = Config.new
|
43
|
+
self.config.classpath = '.'
|
44
|
+
self.config.java_options = ['-Djava.awt.headless=true','-Xms128M', '-Xmx256M']
|
45
|
+
|
46
|
+
def self.before_load &block
|
47
|
+
self.before_load_blocks << block
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.after_load &block
|
51
|
+
self.after_load_blocks << block
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.init
|
55
|
+
before_load_blocks.each do |block|
|
56
|
+
block.call(config)
|
57
|
+
end
|
58
|
+
|
59
|
+
if Rjb.loaded?
|
60
|
+
::Rails.logger.error "Rjb already loaded! RjbLoader configuration options like 'config.classpath' and 'config.java_options' will not apply."
|
61
|
+
else
|
62
|
+
Rjb::load( config.classpath, config.java_options )
|
63
|
+
end
|
64
|
+
|
65
|
+
after_load_blocks.each do |block|
|
66
|
+
block.call(config)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class Railtie < Rails::Railtie
|
71
|
+
config.after_initialize do
|
72
|
+
RjbLoader.init
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
data/rjb-loader.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "rjb-loader/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rjb-loader"
|
7
|
+
s.version = RjbLoader::VERSION
|
8
|
+
s.authors = ["Marlus Saraiva"]
|
9
|
+
s.summary = %q{Rjb loader with before_load and after_load hooks}
|
10
|
+
s.description = %q{When working with multiple gems or several rails initializer files that use Rjb,
|
11
|
+
you need to make sure that all java dependencies of each implementation
|
12
|
+
gets set up before running Rjb::load. This is necessary because Rjb can be loaded only once.
|
13
|
+
You can use rjb-loader to change classpath and java options, by adding 'before_load' to your gem or rails initializer.
|
14
|
+
The 'after_load' hook can be used when your code needs an already loaded Rjb.
|
15
|
+
For instance, when you need to import and use java classes.}
|
16
|
+
s.email = "marlussaraiva@grupofortes.com.br"
|
17
|
+
s.homepage = "https://github.com/fortesinformatica/rjb-loader"
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
|
24
|
+
s.add_dependency('rjb', '1.4.3')
|
25
|
+
s.add_dependency('rails', '>= 3.2')
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rjb-loader
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marlus Saraiva
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2013-07-05 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rjb
|
16
|
+
prerelease: false
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.4.3
|
22
|
+
type: :runtime
|
23
|
+
version_requirements: *id001
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: rails
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: "3.2"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id002
|
34
|
+
description: |-
|
35
|
+
When working with multiple gems or several rails initializer files that use Rjb,
|
36
|
+
you need to make sure that all java dependencies of each implementation
|
37
|
+
gets set up before running Rjb::load. This is necessary because Rjb can be loaded only once.
|
38
|
+
You can use rjb-loader to change classpath and java options, by adding 'before_load' to your gem or rails initializer.
|
39
|
+
The 'after_load' hook can be used when your code needs an already loaded Rjb.
|
40
|
+
For instance, when you need to import and use java classes.
|
41
|
+
email: marlussaraiva@grupofortes.com.br
|
42
|
+
executables: []
|
43
|
+
|
44
|
+
extensions: []
|
45
|
+
|
46
|
+
extra_rdoc_files: []
|
47
|
+
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/rjb-loader.rb
|
55
|
+
- lib/rjb-loader/version.rb
|
56
|
+
- rjb-loader.gemspec
|
57
|
+
homepage: https://github.com/fortesinformatica/rjb-loader
|
58
|
+
licenses: []
|
59
|
+
|
60
|
+
metadata: {}
|
61
|
+
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- &id003
|
70
|
+
- ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- *id003
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Rjb loader with before_load and after_load hooks
|
83
|
+
test_files: []
|
84
|
+
|