Redmine 插件 - 每次代码更改后都需要重新启动 [英] Redmine Plugin - requires restart after every code change

查看:43
本文介绍了Redmine 插件 - 每次代码更改后都需要重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 redmine(使用 Ruby on Rail 编写的项目管理 Web 应用程序)上开发一些插件.

I am working on some plugin on redmine (project management web application written using Ruby on Rail).

对于我对插件代码(比如 view.html.erb 文件)所做的每一次更改,我都必须重新启动 redmine(应用程序)服务器.这是因为,它默认在生产模式下运行.

For every change i make to the code of the plugin(say view.html.erb file), i have to restart the redmine(application) server. This is because, it runs on production mode by default.

在开发模式下运行应用程序会解决这个问题吗?

Will running the application on development mode, solve this problem?

如果是,我如何更改其运行模式或覆盖此行为,以便为每个请求加载类(是的,这将效率不高,但对开发有好处)并且对代码的更改反映而无需重新启动应用程序服务器(本例中为redmine)

If yes, how can i change its running mode or over-ride this behavior so that classes are loaded per every request (yes this will not be efficient but will be good for development) and changes to the code reflect without restarting the application application server(redmine in this case)

我尝试将此行添加到 environment.rb 文件

I tried adding this line to environment.rb file

ENV['RAILS_ENV'] ||= 'development'

也尝试了下面发布的答案/评论,但它们没有解决我的问题.

Also tried answers/comments posted below, but they did'nt solve my problem.

任何可行的解决方案都会有很大帮助.

Any working solution would be of great help.

谢谢.

其他相关信息:

它使用 Rails 2.3.14并使用 bitnami 堆栈安装

It uses Rails 2.3.14 and its installed using bitnami stack

推荐答案

对于 Rails 2.3 上的自动插件重新加载:

For automatic plugin reload on Rails 2.3:

在 config/environment.rb 上添加 config.reload_plugins = true.它必须在那里,由于 Rails 启动步骤,你不能把它放在 config/environments/development.rb 上.您可以添加 if RAILS_ENV = 'development' 代替.

Add config.reload_plugins = true on config/environment.rb. It has to be there, you can't put it on config/environments/development.rb due to the Rails start up steps. You may add if RAILS_ENV = 'development' instead.

配置/环境.rb

config.reload_plugins = true  

在插件的 init.rb 中,添加以下行:init.rb

On the plugin's init.rb, add the following line: init.rb

ActiveSupport::Dependencies.explicitly_unloadable_constants = 'YourPluginModuleName' 

仅此而已.完成后不要忘记将其删除.

That's all. Don't forget to remove it when you're done.

这篇关于Redmine 插件 - 每次代码更改后都需要重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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