ruby - Create plugins or gems for Rails 3? -
I have to be portable between my own Rail applications.
I wonder if I should create a gem or a plugin for every feature that I want to be portable (fast).
They are for rail (now) because they include CSS, HTML, JS and image files.
But I was thinking, things provided with plugins can be provided with gem, but not the opposite? So it is better to know how to make gems, because then you do not have to learn how to make both gems and plugs?
But then, what I can understand is that a gem is shared between all the Rail app in the OS. So that means that I can not do it right for every rail app? In that case, maybe creating a plugin is a good reason because it should be allowed to customize each feature (editing it CSS, JS etc.) and it must be stored inside the Rail app and at the OS level No.
Some advice would be appreciated!
Update:
So does Gems work with CSS, HTML, JS and image files? In a plugin I think you can be an MVC, your own model, idea and controller. "Store your model, view, controller, helper and other plugins in your plug-ins" quoted from the trains "Is it also possible in a gem? for example. I want to add an extension which gives me a good shopping cart (manually with Migration, MVC, Asset files) which will be installed in the current train app. Is this possible as a gem or just as a plugin?
You are right that the plugins offered slightly more than gems. Version and dependence on other gems are main for me.
Using a ruby does not have to share a gem in everything. You can install several versions of a gem and specify in your environment.rb
that a gem requires a specific version. E.g.
config.gem 'my-gem' ,: version = & gt; '1.2.3'
In addition, you can freeze gems in your rail application so that you know that you are working with a specific version.
Which makes your own gems easier to build?
UPDATE
To incorporate CSS, Javascript etc. I think that you will need to create a rail engine which can then be bundled as a plugin or a gem . I have not done this but there is some coverage.
Comments
Post a Comment