Rawr with ruby gem

Need help. I am trying to build little jruby application require
activerecord to connect to oracle.
when I use
jruby -S rake rawr:jar and got a package folder. I can test it with
java -jar [jar.jar]

but when deploy those folder to target machine without ruby it’ error no
file to load on every require line.

This is my code

++++++++ src/main.rb
require ‘rubygems’
gem ‘activerecord’, “= 2.3.8”
require ‘activerecord’

Load DB configuration - yml file in same directory

conf = YAML::load_file(‘database.yml’)

ActiveRecord::Base.establish_connection(conf)

class LwSuitFolder < ActiveRecord::Base
end

print "Enter Your N. : "
name = STDIN.gets
puts
puts “Hello #{name}”
puts “I will try fetching data from oracle db server and save it to file
out.txt”

suit_folders = LwSuitFolder.all(:limit => 20)
File.open(‘out.txt’, ‘w’) do |file|
file.puts “Hello #{name}”
suit_folders.each do |sf|
puts “#{sf.suit_no} #{sf.lg_type_const} #{sf.active_flag}”
file.puts “#{sf.suit_no} #{sf.lg_type_const} #{sf.active_flag}”
end
end

+++++++++++++++ build_configuration.rb +++++++++++++++
configuration do |c|

The name for your resulting application file (e.g., if the

project_name is ‘foo’ then you’ll get foo.jar, foo.exe, etc.)

default value: “rawr”

c.project_name = “jr”

Undocumented option ‘output_dir’

default value: “package”

c.output_dir = “package”

The main ruby file to invoke, minus the .rb extension

default value: “main”

c.main_ruby_file = “main”

The fully-qualified name of the main Java file used to initiate the

application.

default value: “org.rubyforge.rawr.Main”

c.main_java_file = “org.rubyforge.rawr.Main”

A list of directories where source files reside

default value: [“src”]

c.source_dirs = [“src”]

c.source_dirs = [‘src’, ‘lib/ruby’]

A list of regexps of files to exclude

default value: []

#c.source_exclude_filter = []

Whether Ruby source files should be compiled into .class files

default value: true

#c.compile_ruby_files = true

A list of individual Java library files to include.

default value: []

#c.java_lib_files = []

A list of directories for rawr to include . All files in the given

directories get bundled up.

default value: [“lib/java”]

c.java_lib_dirs = [“lib/java”]

c.java_lib_dirs = [“lib/java”, “lib/ruby”]

Undocumented option ‘files_to_copy’

default value: []

#c.files_to_copy = []

Undocumented option ‘target_jvm_version’

default value: 1.6

c.target_jvm_version = 1.5

Undocumented option ‘jvm_arguments’

default value: “”

#c.jvm_arguments = “”

Undocumented option ‘java_library_path’

default value: “”

#c.java_library_path = “”

Undocumented option ‘extra_user_jars’

default value: {}

#c.extra_user_jars[:data] = { :directory => ‘data/images/png’,

:location_in_jar => ‘images’,

:exclude => /*.bak$/ }

Undocumented option ‘mac_do_not_generate_plist’

default value: nil

#c.mac_do_not_generate_plist = nil

Undocumented option ‘mac_icon_path’

default value: nil

#c.mac_icon_path = nil

Undocumented option ‘windows_icon_path’

default value: nil

#c.windows_icon_path = nil

end

====== in lib folder ========
lib
java
jruby-complete.jar
ojdbc5.jar
ruby
activerecord-2.3.8
activerecord-jdbc-adapter-1.0.0.beta1-java
activesupport-2.3.8

I use jruby -S gem unpack to get those in lib/ruby


Please suggest

Pinit A. wrote:

++++++++ src/main.rb
require ‘rubygems’
gem ‘activerecord’, “= 2.3.8”
require ‘activerecord’

How is your packaged application finding rubygems in order to require
it?

More to the point, if you’ve unpacked all the gems you’re needing to
get bundle the files you need with your application, then you no longer
need rubygems to locate and load them.

James

Neurogami - Smart application development

http://www.neurogami.com

[email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Thank you very much

James B. wrote:

Pinit A. wrote:

++++++++ src/main.rb
require ‘rubygems’
gem ‘activerecord’, “= 2.3.8”
require ‘activerecord’

How is your packaged application finding rubygems in order to require
it?

More to the point, if you’ve unpacked all the gems you’re needing to
get bundle the files you need with your application, then you no longer
need rubygems to locate and load them.

That new knowledge to me. I have try remove rubygems still errer 

even
I replace the to require ‘lib/ruby/activerecord’

Is that all about LOAD_PATH or something I have to tell jruby

James

Neurogami - Smart application development

http://www.neurogami.com

[email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs