Code Monkey home page Code Monkey logo

webroot-installer's Introduction

A Webroot Composer Library Installer

Build Status

This is for PHP packages that support composer to configure in their composer.json. It will allow a root package to define a webroot directory and webroot package and magically install it in the correct location.

Example composer.json File

{
    "name": "fancyguy/www-fancyguy-com",
    "description": "Package to build www.fancyguy.com",
    "authors": [
        {
            "name": "Steve Buzonas",
            "email": "[email protected]"
        }
    ],
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "wordpress/wordpress",
                "type": "webroot",
                "version": "4.5.1",
                "dist": {
                    "type": "zip",
                    "url": "https://wordpress.org/wordpress-4.5.1-no-content.zip"
                },
                "require": {
                    "fancyguy/webroot-installer": "^1.0"
                }
            }
        }
    ],
    "require": {
        "wordpress/wordpress": "4.5.*"
    },
    "extra": {
        "webroot-dir": "content",
        "webroot-package": "wordpress/wordpress"
    }
}

This would install the defined wordpress/wordpress package in the content directory of the project.

Warning

Setting the webroot-dir to a non-empty directory will delete the contents in most cases. It is recommended to use a clean target within your project directory.

webroot-installer's People

Contributors

sbuzonas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webroot-installer's Issues

Running `composer update` doesn't update custom packages

Running composer update doesn't update custom public git repo dependencies, current workaround is deleting package and re running composer update.

Take a look at the composer.json file in question here for reference.

Any ideas or recommendations?

Use dist instead source

The clone of the WordPress package is heavy. It's not necessary download the package. I used another solution that is lighter. Use a dist package referencing the WordPress zip package.

This is the README example using zip dist package.

{
    "name": "fancyguy/www-fancyguy-com",
    "description": "Package to build www.fancyguy.com",
    "authors": [
        {
            "name": "Steve Buzonas",
            "email": "[email protected]"
        }
    ],
    "repositories": [
        {
            "type" : "package",
            "package" : {
                "name" : "wordpress/wordpress",
                "type" : "webroot",
                "version" : "4.5.1",
                "dist" : {
                    "type" : "zip",
                    "url" : "https://wordpress.org/wordpress-4.5.1.zip"
                },
                "require" : {
                    "fancyguy/webroot-installer" : "^1.0"
                }
            }
        }
    ],
    "require": {
        "wordpress/wordpress": "4.5.*"
    },
    "extra": {
        "webroot-dir": "content",
        "webroot-package": "wordpress/wordpress"
    }
}

Another option is use the no-content package. This package not download the defaults plugins and themes.

https://wordpress.org/wordpress-4.5.1-no-content.zip

Probably a stupid question, but...

...I'm struggling to work out how to use this to install a normal Packagist package into a custom directory. So for example if I wanted to place font-awesome (fortawesome/font-awesome) in wp-content/libraries, how would I express that?

Sorry, I'm new to Composer and I have spent a considerable amount of time trying to do this but no luck as yet.

Support multiple webroots

There are some use cases where multiple packages should be installed under different webroots. Any plans to do this using similar technique as the Composer installer?

wp folder not being created

I am trying to run composer install with this file:

{
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "wordpress",
        "type": "webroot",
        "version": "4.1.1",
        "dist": {
          "type": "zip",
          "url": "https://github.com/WordPress/WordPress/archive/4.1.1.zip"
        },
        "require": {
          "fancyguy/webroot-installer": "1.0.0"
        }
      }
    }
  ],
  "require": {
    "php": ">=5.5.0",
    "fancyguy/webroot-installer": "1.0.0",
    "squizlabs/php_codesniffer": "2.*"
  },
  "extra": {
    "webroot-dir": "public/wp",
    "webroot-package": "wordpress"
  }
}

public/wp never gets made.
on ec2 running Ubuntu 14.04

project maintentance

is still this project maintened?
i like the idea to use wordpress as a composer project dependency.
currently i get this error message

Loading "fancyguy/webroot-installer" which is a legacy composer-installer built for Composer 1.x, it is likely to cause issues as you are running Composer 2.x.

Fork for PHP8.1 + Composer V2

Leaving this here since the repository is not maintained anymore actively. I invested some time to make this up-to-date and well-running with Composer v2, as the deprecation notice annoyed me.

-> https://github.com/nopenopenope/webroot-installer

Note: this plugin works still fine - if you take a look at what it does, Composer V2 has no impact on the Plugin itself. It just throws the deprecation note.

Add Webroot package to composer cache

Using the example on the readme.

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "wordpress/wordpress",
                "type": "webroot",
                "version": "3.5.1",
                "source": {
                    "type": "git",
                    "url": "https://github.com/WordPress/WordPress.git",
                    "reference": "3.5.1"
                },
                "require": {
                    "fancyguy/webroot-installer": "1.0.0"
                }
            }
        }
    ],
    "require": {
        "wordpress/wordpress": "3.5.*"
    }
}

When using the above composer.json WordPress is successfully cloned in the correct locations and on subsequent updates it knows WordPress is on the same version so it doesn't clone. If the webroot directory is deleted and WordPress needs to be recloned it does a git clone on the repo. Ideally the webroot should be in composer's cache and loaded from there.

Let me know if I'm missing something or if that's really a missing feature!

Installing anything into web root

I see that the example installs wordpress into the root folder. But I have a situation where I want to download a single file and install it into the root folder.

So for example

Repo1 contains a single file called Robots.json.

Repo2 depends on the single Robots.json file and it needs to be installed a specific location. It could be /Robots.json or Directory/Robots.json.

Is this installed capable of doing so? And barring that is it able extract the package it installs and remove the initial directory?

Doesn't work

Looks like this plugin does nothing with latest Composer version !ac497feabaa0d247c441178b7b4aaa4c61b07399 2014-06-10 14:13:12

Post install scripts are not executed

After the first composer install the post install scripts are not fired.

$ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)

  • Installing fancyguy/webroot-installer (1.0.0)
    Loading from cache
  • Installing wordpress (4.5.1)
    Loading from cache

Writing lock file
Generating autoload files

I have to run composer install again to run scripts:

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
[... scripts executing]

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.