创建索引问题:为什么我的rake ts:index无法执行

为什么运行了git clone git://github.com/freelancing-god/thinking-sphinx.git vendor/plugins/thinking_sphinx安装了 thinking_sphinx还是无法执行ts:index呢
总是报:
quoteD:\zsb>rake thinking_sphinx:index INDEX_ONLY=true
(in D:/zsb)
rake aborted!
Could not find RubyGem rails (>= 0.0.0)
D:/zsb/rakefile:4
(See full trace by running task with --trace)[/quote]
我的rakefile文件如下
quote# Add your own tasks in files placed in lib/tasks ending in .rake,

for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'thinking_sphinx'
require 'thinking_sphinx/tasks'
require 'tasks/rails'[/quote]
我的参考文章为http://www.iteye.com/topic/431217
[b]问题补充:[/b]
太失败了 没装rails
装了之后执行 出现下面的问题
D:\zsb>rake thinking_sphinx:index (in D:/zsb)
rake aborted!
no such file to load -- thinking_sphinx
D:/zsb/rakefile:10
(See full trace by running task with --trace)

我已经吧thinking_sphinx安装到vendor\plugins了啊

[b]问题补充:[/b]
非常不错 要关门了 明天结贴啊 呵呵 :idea:
[b]问题补充:[/b]
非常感谢 再请教一个问题,好像是:config的问题

quoteD:\zsb>rake thinking_sphinx:index --trace
(in D:/zsb)
** Invoke thinking_sphinx:index (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
rake aborted!
can't convert Hash into String
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:300:in match'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:300:in
parse'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:238:in initialize'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:237:in
collect'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:237:in initialize'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:29:in
new'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:29:in initialize'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:234:in
new'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:234:in activate'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:76:in
active_gem_with_options'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:50:in gem'
D:/zsb/config/../config/environment.rb:69
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_re
quire'[/quote]

我的gem配置:
quote

Be sure to restart your web server when you modify this file.

Uncomment below to force Rails into production mode when

you don't control web/app server and can't set it the proper way

ENV['RAILS_ENV'] ||= 'production'

Specifies gem version of Rails to use when vendor/rails is not present

#RAILS_GEM_VERSION = '1.2.5' unless defined? RAILS_GEM_VERSION

Bootstrap the Rails environment, frameworks, and default configuration

require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here

# Skip frameworks you're not going to use (only works if using vendor/rails)
# config.frameworks -= [ :action_web_service, :action_mailer ]

# Only load the plugins named here, by default all plugins in vendor/plugins are loaded
# config.plugins = %W( exception_notification ssl_requirement )

# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )

# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
# config.log_level = :debug

# Use the database for sessions instead of the file system
# (create the session table with 'rake db:sessions:create')
# config.action_controller.session_store = :active_record_store
config.action_controller.perform_caching = true

# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql

# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector

# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc

# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

# See Rails::Configuration for more options

#确保一个汉字占一个字符
require 'jcode'
$KCODE = 'u'
end

Add new mime types for use in respond_to blocks:

Mime::Type.register "text/richtext", :rtf

Mime::Type.register "application/x-mobile", :mobile

Include your application configuration below

#Time::DATA_FORMATS[:due_time]="%B %d on %I:%M %P"
RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", "daily")

:config.gem(
'freelancing-god-thinking-sphinx',
:lib => 'thinking_sphinx',
:version => '1.2.0'
)
quote]
[b]问题补充:[/b]
thinking sphinx的gem已经安装了

下面这个是在environment.rb中的配置

'freelancing-god-thinking-sphinx',
:lib => 'thinking_sphinx',
:version => '1.2.0'
) [/quote]

在使用th:index的命令时候还是报错
can't convert Hash into String

查看全部
jiyanliang
jiyanliang
2009/11/27 21:12
  • rails
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

0个回复