我把红宝石从1.9.3升级到2.0.0
升级后,我不能再运行我的脚本,因为有太多的错误。
UPDATE我更新了脚本的开头部分。
误差
Bareword found where operator expected at D:\ex\report.rb line 12, near "$0
def"
(Missing operator before def?)
Bareword found where operator expected at D:\ex\report.rb line 18, near "usage"
(Missing semicolon on previous line?)
Semicolon seems to be missing at D:\ex\report.rb line 19.
syntax error at D:\ex\report.rb line 5, near "Encoding::UTF_8 require "
Execution of D:\jenkins_lab_a\asap.ex\asap-report-apps.rb aborted due to compilation errors.脚本
# coding: utf-8
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
require './lib/utils'
require './lib/klocwork'
require './lib/td'
require 'fileutils'
require 'logger'
if __FILE__ == $0
def usage
warn 'usage: report.rb [a] [b] [c]'
warn "ex) report.rb a b c"
exit
end
puts "report.rb start"
usage if ARGV.size < 3
end我可以在脚本中看到这样的错误。但是我从来没有修改过我的脚本,而且它在上一个版本中运行得很好。
所以我想我错过了任何环境设置
你能告诉我怎样才能解决这个问题吗?
发布于 2014-08-28 11:37:09
这些不是Ruby错误消息。您没有使用Ruby解释器运行Ruby文件。Ruby中没有“裸字”的概念,分号完全是可选的,所以它也不会报道它们。
https://stackoverflow.com/questions/25546611
复制相似问题