Rails 有关 Rails Engine 的几个问题?

jhjguxin · April 19, 2012 · Last by googya replied at February 22, 2014 · 5168 hits

How about the '--mountable' and '--full' beside in the Rails 3.x Engines ,and also 'rails new'?

rails plugin new--mountable and --full有什么区别呢,以及rails new

Has any defferent between the 'dependency' in '*.gemspec' file and the 'gem "gemname"' in 'Gemfile'?

*.gemspecdependency 添加 gem?它和 Gemfilegem "gemname" 有什么不同之处吗?或者说是联系?

the rails application created by'rails plugin new myengine --full',how to use the 'dummy' app and real app?

对于使用 rails plugin new myengine --full 创建的项目该怎么使用 dummy app 和真实的 app?

在做 engine demo 过程中遇到了 几个问题 请教一下?我也再找找资料 然后 我再整理一下 就是经验了 嘿嘿?

*.gemspec 加 dependency 是要求使用这个 Gem 的人必须得安装这些 dependency 的 gem 并且得按照版本要求来。而 Gemfile 只是正对你这个 Engine 开发或测试的时候用的。

经过摸索,和大多数网络上到一样,dummy 放在 spec/dummy 下最好。 最好加上 mountable

--full 不知道有什么用,--mountable 是关键

Mountable 使用单独的命名空间。

@hunter @fredwu 我翻译了一部分 guide 里面的 engine 了 今天放出来 这里我 说一下 --full 的 东东 guide 里面 也有提到的

  • —full 选项告诉 plugin 创建器你想创建一个 engine(它是一个可挂载的 plugin,因为选项的名字),创建 engine 基本的目录结构提供了这些如基础的 app 文件夹,以及 config/routes.rb 文件。这个创建器也提供了一个在 lib/blorgh/engine.rb 的文件它是与应用程序的 config/application.rb 文件的功能是一致的。
  • —mountable 选项告诉创建器去 挂载 engine 到在 engine 中的 test/dummy 的模拟(dummy)测试程序。它通过在 dummy 应用程序的 config/routes.rb文件中置入下面内容,文件在 engine 的 test/dummy/config/routes.rb 中

NOTE: 感觉 —full 实际上 也是一个用于挂载的 engine,刚开始的时候 误区了,以为这是一个被挂载的对象,哎!demo 要重做了~~~

You need to Sign in before reply, if you don't have an account, please Sign up first.