Ruby DevKit不适用于WindowsXP上的RedCloth和其他gem

我是RoR的新手,没有太多的Web开发经验。 我现在常常放弃,但我需要一个RoR开发环境来完成一项工作,我不能选择该网站创建者的大脑,因为他是公司以外的人,并明确表示他完全不熟悉Windows(他开发在Mac上,我开始明白为什么……)。 这是我第一次发帖,所以要善待……

目标:能够在本地计算机上查看基于RoR的站点,最好使用预先存在的XAMMP服务器,但使用rails服务器也可以。


环境: Windows XP Xammp 1.7.3 Ruby 9.1.2 DevKit 4.5.0。

我尝试过的:我开始按照本教程中的说明进行操作(在Windows机器上安装Xampp和Rails http://www.grapethinking.com/getting-rails-to-work-on-a-windows-machine- running-xampp )。 我成功完成了所有步骤,并能够创建一个rails应用程序并查看“Welcome Aboard”页面。

我从heroku( http://heroku.com/ )获得了该网站的本地副本,这是他们使用的ror托管服务。 我修改了apache配置文件以指向站点的公用文件夹,如Xampp和Rails教程的步骤5中所述。 此时,我转到localhost:3000时收到以下消息

Access forbidden! You don't have permission to access the requested directory. There is either no index document or the directory is read-protected. If you think this is a server error, please contact the webmaster. Error 403 localhost 11/4/2010 2:19:12 PM Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 

我不知道如何更改Windows机器上的权限,或者这甚至是问题。 我试过运行“rails s”抱怨:

 Could not find RedCloth-4.2.3 in any of the sources, Try running 'bundle install'. 

所以我发现这篇文章描述了我的情况( http://www.ruby-forum.com/topic/204455 ),这导致我下载了DevKit。 此时我卸载了ruby并使用正确的安装程序重新安装了它。 我按照他们网站上的说明安装了devkit( https://github.com/oneclick/rubyinstaller/wiki/Development-Kit )。

DevKit无法正常工作。 config.yml文件自动拥有我安装ruby的位置(在…… xampp / ruby​​ / Ruby192中)并且它没有抱怨地运行,除了在步骤5中你测试它是否实际上与命令“gem install”一起工作rdiscount –platform = ruby​​“产生了以下错误:

 C:\RubyDevKit>gem install rdiscount --platform=ruby Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing rdiscount: ERROR: Failed to build gem native extension. "C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/XAMPP_Install /xampp/ruby/Ruby192/bin/ruby.exe" extconf.rb checking for random()... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010 /XAMPP_Install/xampp/ruby/Ruby192/bin/ruby --with-rdiscount-dir --without-rdiscount-dir --with-rdiscount-include --without-rdiscount-include=${rdiscount-dir}/include --with-rdiscount-lib --without-rdiscount-lib=${rdiscount-dir}/lib C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/XAMPP_Install/ xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed t o generate an executable file. (RuntimeError) You have to install development tools first. from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:435:in `try_link0' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:440:in `try_link' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:552:in `try_func' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:797:in `block in have_fun c' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking _for' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone ' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:254:in `open' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:276:in `postpone' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for' from C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2010/X AMPP_Install/xampp/ruby/Ruby192/lib/ruby/1.9.1/mkmf.rb:796:in `have_func' from extconf.rb:5:in `' Gem files will remain installed in C:/Documents and Settings/Lyla/My Documents/n ew/XAMPP_Server_2010/XAMPP_Install/xampp/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/r discount-1.6.5 for inspection. Results logged to C:/Documents and Settings/Lyla/My Documents/new/XAMPP_Server_2 010/XAMPP_Install/xampp/ruby/Ruby192/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.5/ex t/gem_make.out 

所以它确实有“暂时增强PATH以包括DevKit ……”但没有其他工作。 尝试安装RedCloth时发生类似的错误。

我发现这篇文章看起来非常相关,但它是为了获得dbd-odbc gem,无论是什么,工作和解决方案似乎有点特定: 我无法让ruby开发工具包适用于Windows XP

我不确定他正在谈论修改fstab文件…也许这会对我有所帮助? 不幸的是我找不到fstab文件,我的devkit根文件夹中没有msys文件夹。 我在ruby安装的bin文件夹或devkit中的各个bin文件夹中找不到gcc.bat,make.bat或sh.bat。

还有这篇文章( http://www.ruby-forum.com/topic/186191 ),它提出了一些我无法真正遵循的内容……它也都是从2009年开始的,所以我认为它可能已经过时了。

帮助,谢谢!

说实话,我真的不愿意在Windows上进行设置。 它可能完全无法管理,有时甚至令人沮丧(我从经验中知道这一点)。 有一个原因是有一个非常小的Rails开发人员社区使用Windows。 大多数人都使用OS X或Linux。

创建一个类似VirtualBox (免费)的Ubuntu虚拟机,并在那里设置Rails堆栈。 这是一个更加无痛苦的环境,你不会回头看。 或者,如果您不想自己完成所有设置,请使用BitNami RubyStack 。 这是一个预配置的Ruby / Rails环境,您既可以将其用作虚拟机,也可以安装在您的计算机上(我会选择前者)。

希望有所帮助!

以下是我为可能感兴趣的人所做的事情:

平台:Windows 7 Rails 4 Ruby 1.9.2p0

  1. 通过rubyinstaller.org安装Ruby
  2. 下载了DevKit
  3. 从Ruby增强的CMD提示符“ruby dk.rb init”,然后是“ruby dk.rb install”
  4. 从这里下载SQLLite DLL文件: sqlite.org ,将它们复制到C:\ Windows目录中
  5. 从Ruby增强的CMD提示符,“Gem install RedCloth”
  6. 在gemfile中添加了“Gem RedCloth”
  7. “捆绑安装”

这些步骤对我有用! 我不明白为什么人们在Windows上使用Ruby会遇到这么困难。 这就是我开发的所有内容并且工作正常。