jus*_*eve 3 sqlite ruby-on-rails windows-server-2008
我是Ruby的新手,希望让Redmine在WinServer08 sp1上运行
我在这里阅读了一些线程,详细介绍了让Ruby和SQLite相互配合所需的步骤和变通方法.
Ruby会运行... sqlite3的.dll和api都在指定的目录中......我重新启动但是rake -test失败了.
我想知道是否有一个明确的循序渐进,汇总了所涉及的各种包的先前解决方法. - 太多了!
C:\Ruby>rake -test --trace
rake aborted!
undefined local variable or method `st' for #<Rake::Application:0x4351638>
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2217:in `standard_rake_opt
ions'
C:/Ruby/lib/ruby/1.8/optparse.rb:1291:in `eval'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2217:in `standard_rake_opt
ions'
C:/Ruby/lib/ruby/1.8/optparse.rb:1291:in `call'
C:/Ruby/lib/ruby/1.8/optparse.rb:1291:in `parse_in_order'
C:/Ruby/lib/ruby/1.8/optparse.rb:1247:in `catch'
C:/Ruby/lib/ruby/1.8/optparse.rb:1247:in `parse_in_order'
C:/Ruby/lib/ruby/1.8/optparse.rb:1241:in `order!'
C:/Ruby/lib/ruby/1.8/optparse.rb:1332:in `permute!'
C:/Ruby/lib/ruby/1.8/optparse.rb:1353:in `parse!'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2313:in `handle_options'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2009:in `init'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exceptio
n_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2007:in `init'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1999:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exceptio
n_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby/bin/rake:19:in `load'
C:/Ruby/bin/rake:19
Run Code Online (Sandbox Code Playgroud)
即使database.yaml配置文件已预先配置为使用Sqlite,但Windows版本的Ruby on Rails不随Sqlite3数据库一起提供.
这是如何指导如何在Windows PC上安装Sqlite3.本文假设您已经在PC上安装了Ruby和Ruby on Rails.
首先,您需要从Sqlite网站http://www.sqlite.org/download.html下载两个文件:
sqlite-3_5_9.zip (214.32 KiB)
A command-line program for accessing and modifing SQLite databases.
See the documentation for additional information.
sqlitedll-3_5_9.zip (213.17 KiB)
This is a DLL of the SQLite library without the TCL bindings.
The only external dependency is MSVCRT.DLL.
Run Code Online (Sandbox Code Playgroud)
第一个文件是用于修改Sqlite数据库的Sqlite命令行程序.您可能会也可能不会使用此功能.
第二个文件是Windows DLL库文件,当Rails进行Sqlite数据库调用时,Ruby使用它.
解压缩这两个ZIP文件后,您应该拥有以下文件:
将这些文件复制到Ruby安装的bin目录中,如果您遵循默认的Ruby安装,它将位于此处:
C:\ruby\bin
Run Code Online (Sandbox Code Playgroud)
现在您已经安装了Sqlite3文件,您需要告诉Ruby如何使用它们.为此,您需要下载Sqlite3的Ruby绑定.幸运的是,使用Ruby宝石很容易做到这一点.只需在命令提示符下键入以下命令:
gem install sqlite3-ruby
Run Code Online (Sandbox Code Playgroud)
您现在需要告诉Gems您需要哪个版本,因为您将看到以下输出:
Bulk updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (i386-mswin32)
1. sqlite3-ruby 1.2.2 (mswin32)
2. sqlite3-ruby 1.2.2 (ruby)
3. sqlite3-ruby 1.2.1 (mswin32)
4. sqlite3-ruby 1.2.1 (ruby)
5. Skip this gem
6. Cancel installation
>_
Run Code Online (Sandbox Code Playgroud)
请选择选项1,sqlite3-ruby 1.2.2(mswin32).一切都成功,你会得到一些这样的输出:
Successfully installed sqlite3-ruby-1.2.2-mswin32
Installing ri documentation for sqlite3-ruby-1.2.2-mswin32...
Installing RDoc documentation for sqlite3-ruby-1.2.2-mswin32...
Run Code Online (Sandbox Code Playgroud)
如果您使用的是Rails 2+,则应该可以从Rails应用程序目录运行以下rake任务.例如,假设您创建了一个位于此处的Rails应用程序:C:\ MyApp您应该能够执行:
C:\MyApp>rake db:create
or
C:\MyApp>rake db:migrate
Run Code Online (Sandbox Code Playgroud)
祝好运 !
(这是从http://blog.emson.co.uk/2008/06/installing-sqlite3-on-windows-for-rails/逐字逐句采取的)
| 归档时间: |
|
| 查看次数: |
8357 次 |
| 最近记录: |