cyu / bespin_composite_filesource

A Bespin file source plugin implementation that allows files to be loaded from multiple servers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Composite Filesource Plugin for Bespin

This is a Bespin plugin that allows multiple file sources to be accessible by Bespin. What I wanted to be able to do is to mount a local fileserver from a remote Bespin installation so I can access local files.

This plugin only works on the very latest Bespin client (v0.8).

Configuration

To configure the Bespin client to use this plugin, you’ll need to build a customized version of BespinEmbedded so you can make the composite_filesource plugin the primary file source for Bespin.

You can find more information about how to build a customized version of BespinEmbedded here:

bespin.mozillalabs.com/docs/embedding/building.html

Here’s what my build manifest looks like:

{
    "output_dir" : "../../public/bespin",
    "plugins"    : [
            "embedded",
            "syntax_manager",
            "bespin_server",
            "file_commands",
            "uicommands",

            "javascript",
            "html",

            "composite_filesource"
    ],
    "dynamic_plugins" : [],
    "search_path"     : ["../plugins"],

    "config": {
        "objects": {
            "filesource": {
                "factory"   : "composite_filesource",
                "arguments" : [ "initialSource" ],
                "objects"   : { "0": "bespin_filesource" }
            },
            "bespin_filesource": {
                "factory"   : "bespin_filesource",
                "arguments" : [ "server" ],
                "objects"   : { "0": "server" }
            }
        }
    }
}

In my case, I have the composite_filesource plugin in a plugins directory located at the same directory level of my BespinEmbedded installation directory. You’ll also want to tweak the output_dir to point to where you want the output files to go.

Usage

Once configured, you can run the mount command in the command line to add a new file source:

mount localhost:8888

The file server will need to support the same functions as the default Bespin file source. In addition, it will also have to support Cross-Origin Resource Sharing. You can get the file server I built here (Ruby-based):

github.com/cyu/bespin_filesrb

About

A Bespin file source plugin implementation that allows files to be loaded from multiple servers.


Languages

Language:JavaScript 100.0%