|
本帖最后由 fengzhulin 于 2012-12-3 16:38 编辑
ruby和watir我都已经安装成功了,通过命令行程序执行如下代码是ok的
但是安装了freeride后,执行下面这个代码就会报错- require ‘rubygems’
- require ‘watir’
- ie=Watir::IE.new
复制代码 报错内容如下:
d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- watir/loader (LoadError)
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from d:/ruby/lib/ruby/gems/1.8/gems/commonwatir-4.0.0/lib/watir.rb:1
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from D:/untitled1.rb:2
这是为何呢?请各位大侠指导一下。另外每次执行我新建的rb文件,都会自动执行附件图所示的文件并有报错,是不是跟这个文件有关系?是什么错误呢
custom_require.rb文件的代码如下。- #--
- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
- # All rights reserved.
- # See LICENSE.txt for permissions.
- #++
- require 'rubygems'
- module Kernel
- ##
- # The Kernel#require from before RubyGems was loaded.
- alias gem_original_require require
- ##
- # When RubyGems is required, Kernel#require is replaced with our own which
- # is capable of loading gems on demand.
- #
- # When you call <tt>require 'x'</tt>, this is what happens:
- # * If the file can be loaded from the existing Ruby loadpath, it
- # is.
- # * Otherwise, installed gems are searched for a file that matches.
- # If it's found in gem 'y', that gem is activated (added to the
- # loadpath).
- #
- # The normal <tt>require</tt> functionality of returning false if
- # that file has already been loaded is preserved.
- def require(path) # :doc:
- gem_original_require path
- rescue LoadError => load_error
- if load_error.message =~ /#{Regexp.escape path}\z/ and
- spec = Gem.searcher.find(path) then
- Gem.activate(spec.name, "= #{spec.version}")
- gem_original_require path
- else
- raise load_error
- end
- end
- private :require
- private :gem_original_require
- end
复制代码 还有一个问题:
为什么freeride里面我把1个文件关闭了,点击run之后,又会把我关闭了的那个文件执行一次呢。 |
|