Pupu is a framework-agnostic plugin system for assets like JS/CSS frameworks and its plugins, icon sets etc. You can search GitHub for more examples. It provides CLI interface for searching, installing and updating pupus from GitHub and it also provides a helper for including static files from pupu into your HTML page. Both CLI and helper can handle dependencies.
pupu install botanicus/autocompleter ~ Downloading botanicus/autocompleter ~ Downloading dependency botanicus/mootools
Why I wrote it
Another thing which really annoyed me was the bloody
css_include_tag. There are so stupid that they do not throw exception when the JS or CSS file do not exists! So you are surprised why you fancy script do not work and then you realized that it’s not correctly included at all!
If you are storing your media files in different directory than in
media or if you want to use submodules strategy, you will need some setup. In case you are using defaults, everything should just work out of the box.
# list all available pupus pupu search # search for pupu matching mootools in its name (you can use regexp) pupu search mootools # install autocompleter and its dependencies from my github repo pupu install botanicus/autocompleter # or uninstall, it's the same pupu uninstall autocompleter # list all installed pupus pupu list
Command-line interface doesn’t require any setup, runtime needs some.
Rango actually will have stack generator in upcoming version 0.2, so then you can just run
rango create stack my_blog and it will work with Pupu out of the box.
If your framework isn’t supported, just:
require "myframework" require "pupu" require "pupu/helpers" Pupu.root = MyFramework.root Pupu.media_root = File.join(MyFramework.root, "media") # you don't have to set it if you are using public or media MyFrameworkHelpersModule.send(:include, Pupu::Helpers)
In your views you can include all the plugin-related files this way:
If pupu has optional arguments, you can specify them, it will modify its behaviour (including extra files etc).
# this will include not just basic autocompleter files, but script for local requests too pupu :autocompleter, type: "local"
There is some helpers for getting path to pupu’s files:
Initializers are the only part of pupu which are not stored in
root/pupu, but are copyied to
[media_root]/stylesheets/initializers. In contrary to files in
[media_root]/pupu, initializers are intended for user editing.