2011-12-09 58 views
1

*在繼續學習之前,我將更好地學習Rails 3.1。感謝您的幫助,每個人:我學到了很多東西! *RoR 3.0:rake db:創建語法錯誤

我想創建一個基於Gullery的在線投資組合,但我一開始就陷入了困境:我無法創建數據庫。當我運行「耙分貝:創建」,我得到以下錯誤:

rake aborted!

C:\Sites\gullery/RakeFile:14: syntax error, unexpected $end, expecting keyword_end

當我運行一個完整的痕跡,我得到這個:

C:\Sites\gullery>rake db:create --trace

rake aborted!

C:/Sites/gullery/Rakefile:14: syntax error, unexpected $end, expecting keyword_e nd

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_ module.rb:25:in `load'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_ module.rb:25:in `load_rakefile'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:501:in `raw_load_rakefile'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:82:in `block in load_rakefile'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:133:in `standard_exception_handling'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:81:in `load_rakefile'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:65:in `block in run'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:133:in `standard_exception_handling'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:63:in `run'

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `'

C:/RailsInstaller/Ruby1.9.2/bin/rake:19:in `load'

C:/RailsInstaller/Ruby1.9.2/bin/rake:19:in `'

當我搜索「語法錯誤,意外$ end,期待keyword_end「,答案表明我錯過了某個地方的結局。不幸的是,我沒有經驗知道哪個文件丟失了。這甚至是正確的問題嗎?如果是這樣,我應該在哪裏看?如果不是,實際上發生了什麼?

我正在使用Ruby on Rails 3.0,Ruby 1.9.2和mySQL。

在此先感謝!

編輯:C的內容:\網站\ gullery \ Rake文件:

         
 
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/switchtower.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rdoc/task' RDoc::Task.new do |rdoc| require 'tasks/rails' # Fail if unit tests fail task :default => [:test_units, :test_functional]

編輯2:添加一個「結束」的Rake文件消除了語法錯誤,但我該數據庫仍然無法工作。

新的Rakefile:

         
 
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/switchtower.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rdoc/task' RDoc::Task.new do |rdoc| end require 'tasks/rails' # Fail if unit tests fail task :default => [:test_units, :test_functional]

而且新的錯誤/跟蹤:

         
 
C:\Sites\gullery>rake db:create --trace WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/tas k' (in RDoc 2.4.2+)' instead. at C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rak e/rdoctask.rb C:/RailsInstaller/Ruby1.9.2/lib/ruby/1.9.1/rdoc/task.rb:30: warning: already ini tialized constant Task rake aborted! Don't know how to build task 'db:create' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task_ manager.rb:49:in `[]' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:115:in `invoke_task' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:94:in `block (2 levels) in top_level' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:94:in `each' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:94:in `block in top_level' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:133:in `standard_exception_handling' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:88:in `top_level' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:66:in `block in run' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:133:in `standard_exception_handling' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:63:in `run' C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `' C:/RailsInstaller/Ruby1.9.2/bin/rake:19:in `load' C:/RailsInstaller/Ruby1.9.2/bin/rake:19:in `'
+0

你一定要向我們展示'C:\ Sites \ gullery/RakeFile'的內容,或者自己檢查第14行的破解內容。 – jibiel

+0

這是14的意思嗎?這有助於知道!我將添加上面的RakeFile的內容。 –

回答

0

我運行的Rails 3.1和我的Rake文件看起來像這樣:

#!/usr/bin/env rake 
# 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.expand_path('../config/application', __FILE__) 

V0100::Application.load_tasks 

V0100是我的應用程序名稱,對應於您的「溝壑」。

+0

這就是我的另一個應用程序的rakefile。我敢打賭,這是一個線索,但我想我會放棄這個特定的項目。在嘗試找出早期版本之前,我需要正確學習Rails 3.1。 :) –