2012-04-14 45 views
1

我在Rails 3.2和Spree 1.1上。当运行初始rake test_app --trace我得到:当使用Spree 1.1.0运行`rake test_app`时,'系统找不到指定的路径'

** Invoke test_app (first_time) 
** Execute test_app 
** Invoke common:test_app (first_time) 
** Execute common:test_app 
Generating dummy Rails application... 
Setting up dummy database... 
The system cannot find the path specified. 

我从spree\core运行rake test_app。据我所知,spree\core\lib\generators\spree\dummy\templates\rails\database.yml,施普雷正在寻找db\spree_test.sqlite3。我尝试手动创建这个数据库,但没有运气。

此外,我在Windows 7上,如果这是有帮助的,因为它可能是某种环境设置。

+1

请告诉我们你用得到这一点的步骤。我们很难调试这个问题,因为我们不知道你在哪里运行'rake test_app'。 – 2012-04-15 14:36:04

+0

同样的错误,从本教程开始:http://guides.spreecommerce.com/creating_extensions.html – Dmitry 2012-07-05 16:26:45

回答

3

好像在施普雷生成一个小错误:

puts "Setting up dummy database..." 
cmd = "bundle exec rake db:drop db:create db:migrate db:test:prepare" 

if RUBY_PLATFORM =~ /mswin/ #windows 
    cmd += " >nul" 
else 
    cmd += " >/dev/null" 
end 

system(cmd) 

在我的情况RUBY_PLATFORM是“I386-的mingw32”和其他模块将增加“>的/ dev/null的”,这是有效的消声器,用于Linux,但给人在Windows中的错误。

那么简单的解决办法可能是:

if RUBY_PLATFORM =~ /mswin|mingw/ 

,我可以从帖子hereherehere没有可靠的方法来确定运行OS看到的,但有一些启发式代码。

代码是从大礼包\核心\ lib中采取\大礼包\ testing_support \ common_rake.rb

否则,你可以运行:

bundle exec rake db:drop db:create db:migrate db:test:prepare 
+0

现在(2017-01),检查平台是否可以使用'Gem.win_platform?'cf [ruby doc:方法:Gem.win_platform?](http://www.rubydoc.info/github/rubygems/rubygems/Gem.win_platform%3F) – yaitloutou 2017-01-21 17:34:10

相关问题