trying to build a pptx to scorm converter. I get an error NoMethodError Undefined method `+' for NilClass. I guess it may be due to a defined method. any idea on how i can remove this error ?
dir = ARGV.shift dest = ARGV.shift pptx = dir + "/presentation.pptx" lis = []`enter code here` STDERR.puts "Copy template => #{dest}" FileUtils.cp_r "template", dest Dir["#{dir}/*.PNG"].each do |file| STDERR.puts "Copy #{file} => #{dest}/img" FileUtils.cp file, "#{dest}/img/" STDERR.puts "Creating thumb #{file} => #{dest}/img/thumb" name = file.split(///).last system "/usr/bin/convert", "-scale", "200x", file, "#{dest}/img/thumb/#{name}" lis.push name end ordered = lis.sort_by { |x| x[/d+/].to_i }
If you debug your code as follows:
puts dir.nil? # true
So, in order to run this code you must provide the ruby shell with 2 arguments, as follows:
ruby test.rb DIRECTORY_NAME DESTINATION_NAME
1.4m articles
1.4m replys
5 comments
57.0k users