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