Code Monkey home page Code Monkey logo

textpattern-installer's Introduction

Textpattern Installer for Composer

Package directory | Issues

Install plugins and themes to Textpattern CMS with Composer dependency manager.

$ composer require rah/rah_replace

Why Composer?

Normally installing Textpattern plugins requires that you manually download an installation package, upload the package through your admin-panel, and then go through a multi-step installer process; rinse and repeat for every plugin, and when you need to update one.

With Composer, it's all managed through the dependency manager. Any theme or a plugin can be installed, updated or uninstalled, using a single command. This also comes with all the other Composer's benefits such as being able to commit your package manifesto under version control system and all of your project teammates will have the same set of plugins synced without any extra fiddling.

Quick start for end-users

After installing Composer to your host system that Textpattern is installed on, you can start adding plugins to Textpattern with Composer from command line.

First, head over to your Textpattern installation location, and tell Composer your Textpattern installation version by installing textpattern/lock meta-package:

$ cd /path/to/your/textpattern/installation/root
$ composer require textpattern/lock:4.6.2

After that, you can add any plugins and themes to your Textpattern installation like any other Composer packages:

$ composer require rah/rah_replace rah/rah_flat

Always run Composer commands in Textpattern installation directory, or in a directory right above it; the Composer installer supports installing Textpattern to a sub-directory, which would allow Textpattern to be within public HTTP server root directory, while Composer packages can be in a directory above it.

Quick start for developers

Plugins and themes are just like any other normal Composer package, but with a special type and a matching installer requirement in your composer.json. The package should be named after the plugin or the theme too. An example composer.json stub would look like the following:

{
  "name": "vendor/pfx_pluginname",
  "type": "textpattern-plugin",
  "require": {
      "textpattern/installer" : "*"
  }
}

Package types

Type Description
textpattern-plugin The package contains manifest.json formatted plugin sources. See an example plugin
textpattern-plugin-package The package contains collection of compiled plugin installer files. Any file that's name matches the format pfx_pluginname_v0.1.0.txt will be installed.
textpattern-admin-theme The package is an admin-side theme. See an example admin-theme.
textpattern-public-theme The package is a front-end theme

Internals

The installer works by scanning composer.json file's sibling and child directories for a Textpattern installation. If found, it injects the whole Textpattern application to the currently running Composer process. It then collects any plugins and themes from Composer packages and installs them, invoking plugin-lifecycle updaters and installers as needed. This process can be compatible with, and used by, any plugin or a theme.

The installer doesn't require any extra configuration from the end-user or the developer. All it needs is a functional Textpattern installation, located either in the same directory as the composer.json file or in a child directory. Just note that the system the Composer command is ran at, needs to have access to the database; take this in mind if you are, for instance, running the composer command outside a virtualized container.

Requirements

Development

See CONTRIBUTING.md

textpattern-installer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

textpattern-installer's Issues

Themes don't support deep directory structures

Unlike plugins, themes currently do not work with deep directory structures. Installation will fail if composer.json isn't placed next to the textpattern/ directory.

This needs to be supported since we shouldn't require that:

  • User needs to navigate away from project root when updating packages (all meta should be there).
  • Or have to set the project root as the server document root.

Install may die on a theme init error

If the theme errors or is removed between installs/updates, Composer will die on the following error:

cannot_instantiate_theme: pohjola, pohjola_theme

...because old-school Textpattern uses explicit process termination instead of Exceptions.

We should either:

  • Try to simulate Textpattern admin-side interface, skipping theme.
  • Default to core theme.

Uses Textile in help files

Hi @gocom,
I recently started to make my plugins available via Composer but I meet the same issue I get during your absence with MassPlugCompiler: help files are not textilized correctly. Id's, Classes and notextile. tags are removed, so it breaks many stuff in my styled files. I forked your MassPlugCompiler repo in the past to quickly include Textile and also add a mulptile help files support but I'm not sure what could be done with this repo to fix the issue and get a tidy plugin doc. when installed via Composer.

Edit: This version of oui_player can be tested if you need an example; compiled files (via my MassPlugCompiler fork) work nicely but are broken when installed via Composer.

Edit#2: Because I'm not sure why Textpattern does not correctly apply Textile by itself on plugins install, I posted a new a thread on the forum.

Uninstaller appears to be broken

Investigation necessary, but it appears that the uninstaller does not run properly and dies midway, resulting in a half-removal. I believe that composer lock file is neither update, only composer.json is modified when remove is called.

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.