在 Windows 上为 Ruby 安装 SQLite3 - 当前最简单的路线是什么? [英] Installing SQLite3 for Ruby on Windows - what's the current easiest route?

查看:41
本文介绍了在 Windows 上为 Ruby 安装 SQLite3 - 当前最简单的路线是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Ruby 的新手,希望让 Redmine 在 WinServer08 sp1 上运行

Am brand new to Ruby looking to get Redmine to run on WinServer08 sp1

我在这里阅读了一些主题,详细介绍了让 Ruby 和 SQLite 相互配合所需的步骤和解决方法.

I've read a few threads here detailing the steps and workarounds required to get Ruby and SQLite to play nice with each other.

Ruby 将运行...sqlite3 的 .dll 和 api 位于指定目录...我已经重新启动但 rake -test 失败.

Ruby will run...sqlite3's .dll and api are in the specified directories...i've rebooted but rake -test fails.

我想知道是否有一个明确的分步指南,可以汇总所涉及的各种软件包的先前变通方法.- 非常感谢!

I'd like to find out if there's a definitive step-by-step that rolls up previous workarounds of the various packages involved. - thx much!

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

推荐答案

Windows 版本的 Ruby on Rails 未附带 Sqlite3 数据库,即使 database.yaml 配置文件已预先配置为使用 Sqlite.

The Windows version of Ruby on Rails does not ship with the Sqlite3 database, even though the database.yaml configuration file is preconfigured to use Sqlite.

这是如何在 Windows PC 上安装 Sqlite3 的指南.本文假设您的 PC 上已经安装了 Ruby 和 Ruby on Rails.

This is a how to guide on how to install Sqlite3 on your Windows PC. This article assumes that you already have Ruby and Ruby on Rails installed on your PC.

首先,您需要从 Sqlite 网站下载两个文件 http://www.sqlite.org/download.html:

First you will need to download two files from the Sqlite web site 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.

第一个文件是用于修改Sqlite数据库的Sqlite命令行程序.您可能会也可能不会使用它.

The first file is the Sqlite command line program used for modifing the Sqlite database. You may or may not use this.

第二个文件是 Windows DLL 库文件,当 Rails 调用 Sqlite 数据库时,Ruby 会使用它.

The second file is the Windows DLL library file and Ruby uses this when Rails makes Sqlite database calls.

解压这两个 ZIP 文件后,您应该拥有以下文件:

When both these ZIP files have been extracted you should have the following files:

  • sqlite3.exe
  • sqlite3.def
  • sqlite3.dll

将这些文件复制到您的 Ruby 安装的 bin 目录中,如果您遵循默认的 Ruby 安装,它将位于此处:

Copy these file to the bin directory of your Ruby installation, if you followed the default Ruby installation it will be located here:

C:\ruby\bin

现在您已经安装了 Sqlite3 文件,您需要告诉 Ruby 如何使用它们.为此,您需要下载 Sqlite3 的 Ruby 绑定.幸运的是,这很容易做到,使用 Ruby gems.只需在命令提示符下键入以下命令:

Now that you have the Sqlite3 files installed you need to tell Ruby how to use them. To do this you need to download the Ruby bindings for Sqlite3. Fortunately this is easy to do, using Ruby gems. Simply at the command prompt type the following command:

gem install sqlite3-ruby

您现在需要告诉 Gems 您需要哪个版本,因为您将看到以下输出:

You will now need to tell Gems which version you need as you will be presented with the following output:

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
>_

请选择选项 1,sqlite3-ruby 1.2.2 (mswin32).一切都成功了,你会得到一些这样的输出:

Please select option 1, sqlite3-ruby 1.2.2 (mswin32). All being successful you will get some output like this:

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...

如果您使用的是 Rails 2+,您应该能够从您的 Rails 应用程序目录运行以下 rake 任务.例如,假设您在此处创建了一个 Rails 应用程序:C:\MyApp,您应该可以执行:

If you are using Rails 2+ you should be able to run the following rake tasks from your Rails application directory. For example say you created a Rails application located here: C:\MyApp you should be able to execute:

C:\MyApp>rake db:create
or
C:\MyApp>rake db:migrate

祝你好运!

(这是从 http://blog.emson.co.uk/2008/06/installing-sqlite3-on-windows-for-rails/)

这篇关于在 Windows 上为 Ruby 安装 SQLite3 - 当前最简单的路线是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆