1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Versioning Product Assets

Discussion in 'XenForo Development Discussions' started by Adrian Schneider, Feb 14, 2014.

  1. Adrian Schneider

    Adrian Schneider Active Member

    Hey Devs,

    Is there a way to add/edit/etc. cron entries, templates, listeners, etc. as files so they can be versioned and kept together with the code? I built something like that for vBulletin, so I was wondering if it's also needed here, or if there is a better way.

    (referencing https://github.com/ForumOps/vBulletin-Development-Environment/)

    Thanks!
     
  2. Adrian Schneider

    Adrian Schneider Active Member

    So, not quite what I wanted, but the WebDAV stuff was pretty helpful.

    a quick
    Code:
    sudo apt-get install davfs2
    sudo mount.davfs http://hostname/admindav.php/Public_Templates templates -o "rw" -o "uid=username" -o "gid=username" -o "file_mode=0777"
    and I was able to edit files in my editor more or less efficiently. Updates don't always take though, or take a few seconds to run. I'm not sure if it's aggressive caching or the writes are delayed somehow.

    Have things changed in the latest 1.3 branch to allow real file-based editing of styles/plugin configuration yet?

    Thanks
     
  3. Adrian Schneider

    Adrian Schneider Active Member

    So I've had to dig a little deeper here, as the ~10 second feedback loop on my desktop, is actually more like 25 seconds on my laptop. Completely impossible to work that way. Plus, not being able to version product assets in general is a little horrifying.

    I think I've found a working combination that is extremely fast.

    I'm using a combination of watchdog (watchmedo binary), and aufs (stackable filesystems -- maufs to manage easier) and I have both real-time editing on the filesystem, as well as an isolated project directory.

    Stackable Filesystem

    I cover this in great detail on my blog (written for vBulletin) a few years back: http://www.syndicatetheory.com/labs/developing-on-union-filesystems

    The short version is, you can compose your working web directory that your forum runs on by stacking a few directories. For me, co-ordinated with Maufs, I stack:

    • XenForo stock directory
    • My tools repository that contains this stuff
    • Add-on directory
    • Files directory

    The order is reversed for example's sake, but typically changes flow in one direction. This way, if I make any modifications to any directory in my working directory, they don't actually change. It instead writes the changes to the files directory while maintaining the integrity of the others.

    The stacked directory that gets created is what you actually run the webserver from.

    XDE (a port of VDE: vBulletin Development Environment)

    Now that we can isolate our project components, we can actually create a proper add-on directory.

    Code:
    .
    ├── config.php
    ├── docs
    ├── listeners
    │   └── load_models.php
    ├── templates
    │   ├── admin
    │   └── public
    │       └── some_template.html
    └── upload
        └── library
            └── VendorName
               └── SomeFile.php
    
    Basically, there are a few top-level add-on related directories, and then you can add whatever else you want.

    So to start it, I run

    Code:
    bin/watch ../path/to/repo
    from the working directory, and it watches the repository for changes, and updates XenForo accordingly. So far I am only tracking changes to public templates and code event listeners, but the concept is relatively trival to extend to all of the various add-on sections.

    Unlike VDE (which resides entirely in memory) this one will require a lot of interaction with the database. So there are lots of logistics to figure out still.

    I thought I'd post some progress because this has been racking my brain since I started looking at XenForo.


    End Goal

    I hope to be able to release two things from this:
    • A project skeleton that you can clone
    • A tools repository that you can copy (or stack) to your working directory

    The tools would include all of the little goodies like...
    • bin/run: run a static callback using XF environment, with optional args
    • bin/watch: watch a project dir for add-on or style changes
    • bin/build: build a project dir into a release zip



    --

    Anyway, this is all currently a little extreme and probably requires you running linux, at least for now. It's targeted at people who want to build add-ons professionally. Hopefully the core tooling gets better that we won't need to build obscure tooling suites around something that should exist in the first place.

    Cheers
     
    Aayush, Fuhrmann and Valhalla like this.

Share This Page