简体   繁体   English

如何加快rails开发?

[英]How to speed up rails development?

I'm running Jruby on Rails on Windows 7. Every time I make some changes in my code I have to restart the server (because I'm using the sidekiq gem for background job processing) and this is the procedure for doing that我在 Windows 7 上运行 Jruby on Rails。每次我对代码进行一些更改时,我都必须重新启动服务器(因为我使用 sidekiq gem 进行后台作业处理),这是执行此操作的过程

In the first CMD window在第一个 CMD 窗口中

First I need to kill all java processes(jruby on rails).首先,我需要杀死所有 java 进程(jruby on rails)。 Otherwise the server will complain that the address is already in use否则服务器会抱怨该地址已被使用

taskkill /im java.exe /im javaw.exe /f

remove the pid file删除pid文件

rm -vf tmp/pids/*

start the server启动服务器

rails server

In the second CMD window在第二个 CMD 窗口中

bundle exec sidekiq

This is starting to feel sluggish since I have to do this every time I change a code.这开始变得缓慢,因为我每次更改代码时都必须这样做。

I looked around and found this我环顾四周,发现了这个

find /your/application_directory -name=*.rb -exec ruby -c {} \;

What the above command does is loop through all files in the directory and check for syntax errors, but this doesn't seem to work in windows cmd even though I have the GNU find tool.上面命令的作用是遍历目录中的所有文件并检查语法错误,但这似乎在 windows cmd 中不起作用,即使我有 GNU find 工具。

Is there any way to make changes in code and view it in the application without all this rigmarole?有没有什么方法可以更改代码并在应用程序中查看它而不会出现所有这些繁琐的事情? Do all other developers follow the same routine?所有其他开发人员都遵循相同的程序吗?

After a bit of googling I've found this: https://github.com/mperham/sidekiq/issues/209#issuecomment-8352050经过一番谷歌搜索,我发现了这个: https : //github.com/mperham/sidekiq/issues/209#issuecomment-8352050

If you really want code reloading in development, you can just run sidekiq inline by adding this to development.rb如果你真的想在开发中重新加载代码,你可以通过将它添加到 development.rb 来内联运行 sidekiq

require 'sidekiq/testing/inline'

With that, you don't even need to run the sidekiq process.有了它,您甚至不需要运行 sidekiq 进程。

Which seems helpful (I also recommend reading the whole thread)这似乎很有帮助(我还建议阅读整个线程)

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

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