简体   繁体   English

在Netbeans 6.9.1中运行Ruby Koans

[英]Running Ruby Koans in Netbeans 6.9.1

I'm very new to Ruby, and currently running through the Ruby Koans to get a better feel for the language. 我是Ruby的新手 ,并且目前正在运行Ruby Koans ,以更好地理解该语言。 My IDE is NetBeans 6.9.1. 我的IDE是NetBeans 6.9.1。

I have created a new Ruby project from existing source, and pointed it to where I installed my Ruby Koan files (C:\\rubykoans\\koans) 我从现有资源创建了一个新的Ruby项目,并将其指向我安装Ruby Koan文件(C:\\ ruby​​koans \\ koans)的位置。

I can successfully run the Koans from the command prompt with the command: 我可以使用以下命令从命令提示符成功运行Koans:

ruby path_to_enlightenment.rb

I have set my project properties in NetBeans to have the following parameters: 我已在NetBeans中将项目属性设置为具有以下参数:

Main Script:  path_to_enlightenment.rb
Working Directory:  C:\rubykoans\koans
(All other options are blank)

When I attempt to run the application, I receive the following error: 当我尝试运行该应用程序时,出现以下错误:

path_to_enlightenment.rb class wasn't found in RubyProject1 project.

Below this is a dialog to select the main script, which just says 在此下方是一个用于选择主脚本的对话框,该脚本仅显示

<No Ruby files found>

My goal is to be able to run the koans from NetBeans, and look at the output window vs. having to work on the projects in NetBeans, and keep a separate command window open and run the project from there. 我的目标是能够从NetBeans运行koans,并查看输出窗口,而不必在NetBeans中处理项目,并保持单独的命令窗口打开并从那里运行项目。

Any assistance would be greatly appreciated! 任何帮助将不胜感激!

I have it running. 我正在运行。 I set the main script to 我将主脚本设置为

path_to_enlightenment.rb

I also took the Koans and created an project from existing sources. 我还采用了Koans,并根据现有资源创建了一个项目。 I had to do nothing else and it ran. 我什么也没做,它就跑了。

Congrats, koans would be a nice way to learn the ins and outs of the language. 恭喜,koans将是学习语言来龙去脉的好方法。

the path_to_enlightenment.rb file is just a list of require statements (at least when I cloned the project). path_to_enlightenment.rb文件只是require语句的列表(至少在我克隆项目时)。 NetBeans is probably doing some weird IDE stuff assuming a class with the same name as your project. 假设类与您的项目同名,NetBeans可能正在做一些奇怪的IDE事情。 you could try running the rake task as suggested to do in the README file (last I looked there was a menu option somewhere to run rake tasks within the selected project, maybe a right click on the project folder..?), or put this under all the require statements 您可以尝试按照建议在README文件中进行操作来运行rake任务(最后,我查看了某个菜单选项,可以在所选项目中运行rake任务,或者右键单击项目文件夹。在所有require语句下

class RubyProject1
end

opinion: In keeping with enlightenment, ruby culture, and simplicity (aims of the project), you don't need much more than a terminal and vim or notepad++ to work with the koans project. 观点:与启蒙,红宝石文化和简单性(项目的目标)保持一致,与koans项目一起使用,您不需要终端和vim或notepad ++。 NetBeans may end up being more of a burden than a help. NetBeans最终可能比帮助更重。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM