0

I have created a ruby executable in windows using OCRA. i am using it for few years now and works well no complains with it.

but today when i created and distributed a exe that contain Include module in the code it failed at the include module line.

is there a better way to write the code or compile the exe ?

in the below code the error occurs at include Mongo location. if i remove include module then the code does not work

require 'all the libs including mongo'

###############################################################
#### to insert the program parameters and the data to mongodb
###############################################################
def writedatatomongodb(toinsert, sname, dname, collname, lfile)
#Sampele params to insert  {:command=>"get data", :servername=>"servname", :remotecommand=>"/user/home/somefile", :outputfile=>"filename123_YYYYMMDD.txt"}

include Mongo
@client = MongoClient.new(sname, 27017)
p "Copying parametrs to Mongodb"
#@client = MongoClient.new('myservername', 27017)
@db     = @client[dname] 
@coll   = @db[collname]

File.open(lfile, 'a'){ |f| f.puts "Copying params to Mongodb" }
id = @coll.insert(toinsert)
p "Copied parametrs to Mongodb"
rescue Exception => e 
File.open(lfile, 'a'){ |f| f.puts "Error occured: #{e}" }
end
user2300908
  • 165
  • 1
  • 1
  • 12
  • Does your application still run? Did you check if the problem is really the exe and not a change in the environment that broke your application. – knut May 23 '13 at 22:19
  • Is there an error or a stack trace you can share? Please explain what you mean by "failed". Also, what version of the mongo gem are you using? – Brandon Black Jun 18 '13 at 17:11

0 Answers0