Git Product home page Git Product logo

rapi-fs's Introduction

NAME

Rapi::Fs - Plack-compatible, instant ExtJS file browser

SYNOPSIS

use Rapi::Fs;

my $app = Rapi::Fs->new({
  mounts  => [ '/some/path', '/foo/blah' ]
});

# Plack/PSGI app:
$app->to_app

Or, using rapi-fs.pl utility script:

rapi-fs.pl /some/path /foo/blah

DESCRIPTION

This is a Plack-compatible file browser application written using RapidApp. It generates a nice-looking dynamic web interface to browse and view arbitrary files and directories for the configured "mounts" using a standard, split-panel tree layout:

Rapi::Fs screenshot

For a live demo, see: rapi.io/fs

Internally, the RapidApp module class Rapi::Fs::Module::FileTree does the heavy lifting, and that module can be configured and used directly within an existing RapidApp.

The convenience utility script rapi-fs.pl is also available, which is a simple wrapper around this module, to be able to fire up a fully working and self-contained app on-the-fly (including launching a built-in webserver) from the command-line.

CONFIGURATION

Rapi::Fs extends RapidApp::Builder and supports all of its options, as well as the following params specific to this module:

mounts

List of directory "mount" points to use/show in the application. This is the only required parameter and supports a flexible syntax. Mounts can be supplied as simple directory string paths, HashRef configs, or "driver" objects (consuming the Rapi::Fs::Role::Driver role). The default driver class which ships with the Rapi::Fs package is Rapi::Fs::Driver::Filesystem.

The following mount specifications are all equivalent:

$app = Rapi::Fs->new({
  mounts  => [ '/some/path' ]
});

$app = Rapi::Fs->new({
  mounts  => [{
    driver => 'Filesystem',
    name   => 'path',
    args   => '/some/path'
  }]
});

$app = Rapi::Fs->new({
  mounts  => [ 
    Rapi::Fs::Driver::Filesystem->new({
      name   => 'path',
      args   => '/some/path'
    })
  ]
});

When using the HashRef syntax, the 'driver' param is a class name relative to the Rapi::Fs::Driver::* namespace. To supply a full class name, prefix with '+', for instance:

$app = Rapi::Fs->new({
  mounts  => [{
    driver => '+My::Fs::Driver',
    name   => 'Foobar',
    args   => 'something understood by My::Fs::Driver'
  }]
});

Different forms can also be mix/matched:

$app = Rapi::Fs->new({
  mounts  => [
    {
      driver => '+My::Fs::Driver',
      name   => 'Foobar',
      args   => 'something understood by My::Fs::Driver'
    },
    '/path/to/something',
    {
      name  => 'perl5-lib',
      args  => '/usr/lib/perl5'
    },
    Some::Other::Driver->new({
      name   => 'larry',
      args   => 'bla',
      foo    => 'bar'
    })
  ]
});

Rapi::Fs::Driver::Filesystem is the only driver which has been implemented so far, but this module was written with the idea of implementing other drivers in mind, both as possible additional core-modules as well as user-defined drivers. See Rapi::Fs::Role::Driver for more info on the driver API.

filetree_class

Defaults to Rapi::Fs::Module::FileTree.

filetree_params

Optional extra params to supply to the filetree_class constructor.

METHODS

to_app

PSGI $app CodeRef. Derives from Plack::Component

TODO

  • Add write support (move/rename/copy/delete/edit)

  • Add "Mount" as a 4th Node type, to allow nesting other kinds of drivers within a structure.

Planned additional drivers

  • SSH/SFTP

  • IMAP

  • JSON/YAML files (i.e. browse data structure)

  • Zip/archive

  • Multipart/MIME

SEE ALSO

AUTHOR

Henry Van Styn <[email protected]>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by IntelliTree Solutions llc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.