Rails plugin require issues -
I have a problem creating a Rail Plugin, call it maplag. The plugin is very a rake work, but with a library that uses rack work.
Problem files are required to say that this rack is functional:
namespace: emplog function: mpllog :: indexer to create New End End
This will not recognize continuous mapping, so I thought I needed it.
'mplug' namespace is required: mplugs work: to create mpllog :: indexer. New End End
But then I get this message.
No such file to load - mplug
So, okay. Then try to give the path to the plugin.
'vendor / plugins / mplug / lib / mplug' namespace is required: applying task: mpllog :: indexer to create New End And Although it works really, except that I think that's a bad way to do this, now I need to have files in my plugin like I like Rail The root was in the example: The 'emplug / indexer' is required for the module empling end
now it should be:
module module end in the 'vendor / plugins / maplug / lib / empl / indexer' Shayakata happens.
Which I definitely do not have to do.
Is there a well-organized way to solve this?
Thank you!
The easiest solution to this problem would be to register the rack work using Rail :: RailTime API. In lib / mplug.rb
, define your secularity
:
module module class relativity & lt; :: Rails :: Railtie rake_tasks "mplug / rails.rake" end end
Then, in lib / mplug / rails.rake
: Gemfile
namespace: mplug do task: create do mplug :: indexer.new end end
/ Code>. If your plug-in is in seller / plugins
, then add this line to your Gemfile
:
gem "mplug",: path = & Gt; "Vendor / plugins / mplug"
If you press the plug-in in a GIT repo, then use : git
.
Now, rake maplag: make
will be available! If you want to show it in rake -T
, make sure you add a description:
Namespace: Maple do Dar "Building a Magoglog" Task: Create Mplug :: Indexer.new End and
Comments
Post a Comment