Home  >  Q&A  >  body text

ruby-on-rails - ruby on rails 的gem包如何制作

查看了一点关于制作gem包的,但是都是那种简单的打包。
我想要弄明白这个问题:如何制作一个Gem包,然后bundle install后能在rails程序内加入一个controller以及几个相应的页面。

ringa_leeringa_lee2761 days ago747

reply all(1)I'll reply

  • 黄舟

    黄舟2017-04-22 08:58:28

    Your requirement needs to be called Rails::Generator,想想看 rails generateIsn’t this how the command works?

    In fact, there are many ready-made Gems that you can use as a reference. Most of them bundle install 完了之后还要运行命令,比如说 rake xxx:install 或者 rake xxx:generate will do this.

    Recommend one to you: https://github.com/ryanb/nifty-generators, pay attention to the libgenerators below.

    In addition, if you are not very urgent to open source, for example, you only need to do it on a small scale, you can do it without Gem. Just take a look at Creating and Customizing Rails Generators & Templates in Rails Guides. Of course, this is also the same for writing Gem. helpful.

    reply
    0
  • Cancelreply