From af91fbee05397b82874d5889f3783cbc28da3048 Mon Sep 17 00:00:00 2001 From: rautenberg Date: Fri, 17 Oct 2014 09:53:14 +0200 Subject: remove fixed roo version and update code to new roo API --- dataset.gemspec | 3 ++- helper.rb | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dataset.gemspec b/dataset.gemspec index b31fa25..33e0e5d 100644 --- a/dataset.gemspec +++ b/dataset.gemspec @@ -18,7 +18,8 @@ Gem::Specification.new do |s| # specify any dependencies here; for example: s.add_runtime_dependency "opentox-server" - s.add_runtime_dependency "roo", "=1.10.1" # 1.10.2 is defunct + s.add_runtime_dependency "roo" + #, "=1.10.1" # 1.10.2 is defunct s.add_runtime_dependency "spreadsheet", "=0.9.0" s.add_runtime_dependency "rubyzip", "=0.9.9" # roo 1.10.1 do not work with rubyzip 1.0.0 s.add_runtime_dependency "openbabel"#, "~>2.3.1.5" diff --git a/helper.rb b/helper.rb index 4648c46..dcf3f75 100644 --- a/helper.rb +++ b/helper.rb @@ -19,7 +19,7 @@ module OpenTox end def from_spreadsheet spreadsheet - extensions = { Excel => ".xls", Excelx => ".xlsx", Openoffice => ".ods" } + extensions = { Roo::Excel => ".xls", Roo::Excelx => ".xlsx", Roo::Openoffice => ".ods" } input = params[:file][:tempfile].path + ".xls" csv_file = params[:file][:tempfile].path + ".csv" File.rename params[:file][:tempfile].path, input # roo needs "correct" extensions @@ -257,11 +257,11 @@ module OpenTox @body = from_csv @body @content_type = "text/plain" when "application/vnd.ms-excel", "application/excel" - from_spreadsheet Excel + from_spreadsheet Roo::Excel when "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - from_spreadsheet Excelx + from_spreadsheet Roo::Excelx when "application/vnd.oasis.opendocument.spreadsheet" - from_spreadsheet Openoffice + from_spreadsheet Roo::Openoffice # when "chemical/x-mdl-sdfile" # @body = parse_sdf @body # @content_type = "text/plain" -- cgit v1.2.3