我在irb工作,并试图清理我下载的一些代码。Rails - 错误找不到文件
我正在此:
require '/Users/alexgenadinik/projects/cmply/cmply-app/lib/app/social/linkedin/linkedin.rb'
,它工作正常。该文件包含此:
require File.join(File.expand_path("../",__FILE__),"init")
require 'oauth'
module LinkedIn
puts "helllllooooo"
class << self
#logger.debug "....teeest"
attr_accessor :token, :secret, :default_profile_fields
# config/initializers/linkedin.rb (for instance)
#
# LinkedIn.configure do |config|
# config.token = 'consumer_token'
# config.secret = 'consumer_secret'
# config.default_profile_fields = ['education', 'positions']
# end
#
# elsewhere
#
# client = LinkedIn::Client.new
def configure
yield self
true
end
end
#root_path = File.expand_path("../../../../../",__FILE__)
autoload :Api, File.join(LINKED_IN_LOAD_PATH,"linked_in/api.rb") #"linked_in/api"
autoload :Client, File.join(LINKED_IN_LOAD_PATH,"linked_in/client.rb") #"linked_in/client"
autoload :Mash, File.join(LINKED_IN_LOAD_PATH,"linked_in/mash.rb") #"linked_in/mash"
autoload :Errors, File.join(LINKED_IN_LOAD_PATH,"linked_in/errors.rb") #"linked_in/errors"
autoload :Helpers, File.join(LINKED_IN_LOAD_PATH,"linked_in/helpers.rb") #"linked_in/helpers"
autoload :Search, File.join(LINKED_IN_LOAD_PATH,"linked_in/search.rb") #"linked_in/search"
end
但是当我尝试运行如下命令:
client = LinkedIn::Client.new('key', 'key')
我得到这个错误:
LoadError: no such file to load -- linked_in/helpers/authorization
from /Users/alexgenadinik/projects/cmply/cmply-app/lib/app/social/linkedin/linked_in/helpers/authorization.rb:4
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
from /Users/alexgenadinik/projects/cmply/cmply-app/lib/app/social/linkedin/linked_in/client.rb:2
from (irb):2
,使其指向行客户端的2 .rb它是这样开始的:
require 'cgi'
require File.join(LINKED_IN_LOAD_PATH, "linked_in","helpers/authorization")
和4号线authorization.rb的这开始是这样的:
module LinkedIn
module Helpers
module Authorization
顺便说一句,我应该从顶部阅读错误信息,或者我应该开始从底部读出,看看那里的错误出现第一?
非常感谢。我不确定它为什么会给出错误。
尝试更改所有的自动加载,只需要查看它是否未被拾取的依赖关系,不确定自动加载是否可以工作,如果有需要的client.rb,有点猜测。 – RadBrad