Reputation: 2505
I'm not exactly sure if I can ask this question, but I definitely need an answer for this. I'm working on a Rails project- a forum- and I want to know how I can implement 'plugins' in it.
Basically, I want someone who doesn't know a lot about programming or ruby on rails to be able to add functionality to my forums (assuming they cloned my forum onto their server). The general ideas are
plugins
, and would be separated in this directory by the plugin name.rake forum:plugins:install some-url
that would download and install the plugin for themWhen starting the project, I had the idea in my head that I could just apply a patch or two that would install plugins, but that would be terrible when the user would have to upgrade the forums.
So, my questions are:
Again, I'm not sure if these questions are allowed, but I guess I'll find out.
Just to clarify, I'm looking for a system akin to SMF's package feature (which allows you to import and install plugins/packages on the forum software itself). I'm not looking for plugins for rails itself, but rather the application running on rails (the forums).
TL;DR: I'm looking for a way to make a modification to a rails app without modifying the source code. I am NOT looking for rails 2 plugins, or rubygems.
Upvotes: 4
Views: 684
Reputation: 10856
Feature Flags can help you let you users turn features on and off, though the code need to be in the app on deploy.
Upvotes: 0
Reputation: 2505
Ok, since the time I asked the question, a friend pointed me in a direction. As a plugin, I wanted it to be able to put code into the forums, but as a separate codebase; as in, none of it goes into the actual code. My friend pointed me to Rails::Engine
, which at first didn't seem like what I needed.
With the Rails::Engine
, I could create a separate directory, populate it with my 'addons' or 'plugins', and the Application wouldn't be affected by each separate one. It would also make creating addons or plugins easy.
Upvotes: 1
Reputation: 3376
Rewritten answer:
After reading your request again I have a better answer. Why not just use github for your app where you have a master repository and accept patches to it? If people are tech savvy enough to be editing models, controllers, views, they should be savvy enough to create a patch request through github. That way you can approve them easily too.
Upvotes: 0
Reputation: 14740
In Rails, most plugins are usually implemented as gems.
From the above link:
A gem is a packaged Ruby application or library. It has a name (e.g. rake) and a version (e.g. 0.4.16).
I would do that instead. Gems are by far the most common way of creating functionality that you'd want to exist in multiple applications.
Also: How to make your own gem
Upvotes: 2