Project

pupu

0.0
No commit activity in last 3 years
No release in over 3 years
Pupu is a plugin system for media like mootools plugins, icon sets etc. It knows dependencies and it has CLI interface, so it's really easy to bundle such pupus into your app.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

About Pupu

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.

CLI example:

pupu install botanicus/autocompleter
~ Downloading botanicus/autocompleter
~ Downloading dependency botanicus/mootools

Why I wrote it

In my apps the root/ stuff always get bloated and messy when I have all javascripts in root/javascripts, all stylesheets in root/stylesheets etc. It’s nearly imposible to remove some stuff related with let’s say some mootools plugin. It has it’s own javascripts, stylesheets, few images + code which is required for initialization. And of course it is really bad idea to put your own code to directory with such things as javascript framework is.

Another thing which really annoyed me was the bloody js_include_tag and 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!

CLI interface

If you are storing your media files in different directory than in public or 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

Runtime Setup

Command-line interface doesn’t require any setup, runtime needs some.

At the moment Rango, Merb and Rails are supported directly. If you are using one of these frameworks, just use require "pupu/adapters/rango" in your environment file.

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)

And it should work. Check existing Rango, Merb resp. Rails adapter for inspiration.

Helpers

In your views you can include all the plugin-related files this way:

pupu :autocompleter

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:

Plugin[:autocompleter].image("spinner.gif")

Initializers

Initializers are the only part of pupu which are not stored in root/pupu, but are copyied to [media_root]/javascripts/initializers resp. [media_root]/stylesheets/initializers. In contrary to files in [media_root]/pupu, initializers are intended for user editing.

Example from botanicus/flash: flash.js, flash.css

Links

- Wiki
- Source Code
- API Documentation
- Examples: Rango, Merb and Rails