如何在Win7上调试Ruby程序

Python017

如何在Win7上调试Ruby程序,第1张

先安装rubyinstaller,下载并解压DevKit,注意,这两个版本要对应,网页上有说明(http://rubyinstaller.org/downloads/),解压DevKit后,打开目录,运行devkitvars.bat(是不是必须的不确定)。

打开cmd,进入DevKit的解压目录

ruby dk.rb

---

Configures an MSYS/MinGW based Development Kit (DevKit) for

each of the Ruby installations on your Windows system. The

DevKit enables you to build many of the available native

RubyGems that don't yet have a binary gem.

Usage: ruby dk.rb COMMAND [options]

where COMMAND is one of:

init prepare DevKit for installation

review review DevKit install plan

install install required DevKit executables

and 'install' [options] are:

-f, --force overwrite existing helper scripts

-------------

ruby dk.rb init

---

Initialization complete! Please review and modify the auto-generated

'config.yml' file to ensure it contains the root directories to all

of the installed Rubies you want enhanced by the DevKit.

--------------------------------

ruby dk.rb install

---

Invalid configuration or no Rubies listed. Please fix 'config.yml'

and rerun 'ruby dk.rb install'

如果出现的是这个,则需要修改config.yml

加入

- C:\Ruby200-x64

---

[INFO] Updating convenience notice gem override for 'C:/Ruby200-x64'

[INFO] Installing 'C:/Ruby200-x64/lib/ruby/site_ruby/devkit.rb'

这是对的

---------------------

gem install ruby-debug-ide

---

Temporarily enhancing PATH to include DevKit...

Building native extensions. This could take a while...

Successfully installed ruby-debug-ide-0.4.17

Parsing documentation for ruby-debug-ide-0.4.17

Installing ri documentation for ruby-debug-ide-0.4.17

1 gem installed

@钟超 提到了 Sublime Text 2,但没说到为什么。Sublime 目前有很多 packages 都很适合 Rails 开发,比如 SCSS、CoffeeScript、HAML 等,并且也有了一个整合的 Rails 相关 package,有相当丰富的 snippets,并且跨平台,保证了你跨平台仍可保留大部分的编码习惯。我用了 Vim 至少有 5 个年头了,最近都是用 Sublime 做 Rails 开发,Vim 虽然强大,但是对新生的语言、框架相应的插件很少,虽然 Vimer 是该折腾、调教,但是 Rails 讲求快,在没空折腾的情况下,Sublime 就是很好的工具,更何况并不比 Vim 差。另,Rails 开发并不太建议用 IDE,因为 IDE 有一个学习过程,并且太重,调试的话,官方提供的 console 也足够好了,Rails 内部做了很多工作,普通编辑器也能做好开发。

作者:Chris

链接:https://www.zhihu.com/question/19649470/answer/14230622

来源:知乎

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。