PluginsAnatomy: Difference between revisions

From SoylentNews
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[CssWork]] parent
[[CssWork]] parent


When first setting up the site, you run slash/bin/install-slashsite script which lists the plugins and asks you which one you want to use.
There is a script in slash/bin to just install a new plugin.


<h2>HOWTO-plugins from Slash docs</h2>
<h2>HOWTO-plugins from Slash docs</h2>
Line 82: Line 85:
</pre>
</pre>


 
[[Category:Development]]
 
 
 
 
 
<hr>
 
 
<div name="index">
<p><a name="__index__"></a></p>
 
<ul>
 
        <li><a href="#name">NAME</a></li>
        <li><a href="#questions">QUESTIONS</a></li>
        <ul>
 
                <li><a href="#what_is_a_plugin">What is a plugin?</a></li>
                <li><a href="#how_do_i_get_my_plugin_into_the_install_system">How do I get m
y plugin into the install system?</a></li>
                <li><a href="#what_does_my_plugin_need_to_make_it_work_with_the_install">Wha
t does my plugin need to make it work with the install?</a></li>
                <li><a href="#how_do_i_install_a_plugin_once_my_site_is_installed">How do I
install a plugin once my site is installed?</a></li>
                <li><a href="#do_install_plugin_and_install_slashsite_use_the_same_logic">Do
install-plugin and install-slashsite use the same logic?</a></li>
                <li><a href="#i_have_a_really_cool_plugin_and_i_would_like_to_see_it_added_t
o_the_slash_distribution__will_you_distribute_mine">I have a really cool plugin and I would
like to see it added to the Slash distribution. Will you distribute mine?</a></li>
        </ul>
        <li><a href="#version">VERSION</a></li>
</ul>
 
<hr name="index" />
</div>
<!-- INDEX END -->
 
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>HOWTO-Plugins - How to write and use Slash plugins</p>
<p>
</p>
<hr />
<h1><a name="questions">QUESTIONS</a></h1>
<p>
</p>
<h2><a name="what_is_a_plugin">What is a plugin?</a></h2>
<p>A plugin is an extension to the Slash system
that adds some sort of functionality to
the site. It should inherit its basic look
and feel from the currently running theme
(for example, background/foreground colors, calling
header and footer components, etc. will be handled
by the installed theme).</p>
<p>
</p>
<h2><a name="how_do_i_get_my_plugin_into_the_install_system">How do I get my plugin into the
install system?</a></h2>
<p>There are two ways to do this. First, you can put it in the
plugins directory with the distribution. During the install it
will be copied to the plugins directory in (by default,
<em class="file">/usr/local/slash/plugins/</em>. The second option is to copy it in
there yourself and make sure that your library files (perl modules)
are installed. If you decide to go the first route you
may want to consider adding your libraries to the list
of plugins that get installed, in the main Slash Makefile.</p>
<p>
</p>
<h2><a name="what_does_my_plugin_need_to_make_it_work_with_the_install">What does my plugin
need to make it work with the install?</a></h2>
<p>If you look at the plugins that come with Slash you will find a
file called PLUGIN. This handles how the plugin installer will
see your plugin.  In the file, each keyword appears on a line
by itself with a '=' seperating it and the directive.  For example:</p>
<pre>
        htdoc=search.pl</pre>
<p>The following are the keywords it knows:</p>
<dl>
<dt><strong><a name="description" class="item">description</a></strong></dt>
 
<dd>
<p>What will be displayed during the install for the user,
describing what the plugin does</p>
</dd>
<dt><strong><a name="mysql_schema" class="item">mysql_schema</a></strong></dt>
 
<dd>
<p>Schema for MySQL</p>
</dd>
<dt><strong><a name="mysql_dump" class="item">mysql_dump</a></strong></dt>
 
<dd>
<p>Dump for MySQL</p>
</dd>
<dt><strong><a name="pg_schema" class="item">pg_schema</a></strong></dt>
 
<dd>
<p>Schema for PostgreSQL</p>
</dd>
<dt><strong><a name="pg_dump" class="item">pg_dump</a></strong></dt>
 
<dd>
<p>Dump for PostgreSQL</p>
</dd>
<dt><strong><a name="htdoc" class="item">htdoc</a></strong></dt>
 
<dd>
<p>A document to be installed in the htdocs directory for the Slash site</p>
</dd>
<dt><strong><a name="template" class="item">template</a></strong></dt>
 
<dd>
<p>A template to be installed in the database</p>
</dd>
<dt><strong><a name="image" class="item">image</a></strong></dt>
 
<dd>
<p>An image to be installed in the image directory</p>
</dd>
<dt><strong><a name="note" class="item">note</a></strong></dt>
 
<dd>
<p>A note to show the user when the install is over.
Good place to put notes about aditional libraries
needed, or other dependencies.</p>
</dd>
</dl>
<p>
</p>
<h2><a name="how_do_i_install_a_plugin_once_my_site_is_installed">How do I install a plugin
once my site is installed?</a></h2>
<p>Use the install-plugin tool. If run with the <code>-h</code> option,
it will describe the tool's usage.  If can list available
plugins and you can then select which plugins you want to
install (just like with install-slashsite).</p>
<p>
</p>
<h2><a name="do_install_plugin_and_install_slashsite_use_the_same_logic">Do install-plugin a
nd install-slashsite use the same logic?</a></h2>
<p>Yes, you can find it in the Slash::Install library.</p>
<p>
</p>
<h2><a name="i_have_a_really_cool_plugin_and_i_would_like_to_see_it_added_to_the_slash_distr
ibution__will_you_distribute_mine">I have a really cool plugin and I would like to see it ad
ded to the Slash distribution. Will you distribute mine?</a></h2>
<p>Maybe. We don't have any rules concerning this at the moment, so it will be
on a case by case basis. At some point in the future we will come up
with a much better answer.</p>
<p>
</p>
<hr />

Latest revision as of 15:41, 15 March 2014

CssWork parent

When first setting up the site, you run slash/bin/install-slashsite script which lists the plugins and asks you which one you want to use.

There is a script in slash/bin to just install a new plugin.

HOWTO-plugins from Slash docs

NAME
    HOWTO-Plugins - How to write and use Slash plugins

QUESTIONS
  What is a plugin?
    A plugin is an extension to the Slash system that adds some sort of
    functionality to the site. It should inherit its basic look and feel
    from the currently running theme (for example, background/foreground
    colors, calling header and footer components, etc. will be handled by
    the installed theme).

  How do I get my plugin into the install system?
    There are two ways to do this. First, you can put it in the plugins
    directory with the distribution. During the install it will be copied to
    the plugins directory in (by default, /usr/local/slash/plugins/. The
    second option is to copy it in there yourself and make sure that your
    library files (perl modules) are installed. If you decide to go the
    first route you may want to consider adding your libraries to the list
    of plugins that get installed, in the main Slash Makefile.

  What does my plugin need to make it work with the install?
    If you look at the plugins that come with Slash you will find a file
    called PLUGIN. This handles how the plugin installer will see your
    plugin. In the file, each keyword appears on a line by itself with a '='
    seperating it and the directive. For example:

            htdoc=search.pl

    The following are the keywords it knows:

    description
        What will be displayed during the install for the user, describing
        what the plugin does

    mysql_schema
        Schema for MySQL

    mysql_dump
        Dump for MySQL

    pg_schema
        Schema for PostgreSQL

    pg_dump
        Dump for PostgreSQL

    htdoc
        A document to be installed in the htdocs directory for the Slash
        site

    template
        A template to be installed in the database

    image
        An image to be installed in the image directory

    note
        A note to show the user when the install is over. Good place to put
        notes about aditional libraries needed, or other dependencies.

  How do I install a plugin once my site is installed?
    Use the install-plugin tool. If run with the "-h" option, it will
    describe the tool's usage. If can list available plugins and you can
    then select which plugins you want to install (just like with
    install-slashsite).

  Do install-plugin and install-slashsite use the same logic?
    Yes, you can find it in the Slash::Install library.

  I have a really cool plugin and I would like to see it added to the Slash distribution. Wi
ll you distribute mine?
    Maybe. We don't have any rules concerning this at the moment, so it will
    be on a case by case basis. At some point in the future we will come up
    with a much better answer.