Skip to content

Commit 338cd64

Browse files
committed
WIP
1 parent ed6b7c2 commit 338cd64

File tree

13 files changed

+6794
-125
lines changed

13 files changed

+6794
-125
lines changed

.beetbox/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
host.config.yml
2+
local.config.yml
3+
Vagrantfile
4+
Vagrantfile.local

.beetbox/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
vagrant_memory: 2048
3+
beet_domain: drupal-project.local
4+
beet_project: custom
5+
beet_web: "/var/beetbox/"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
- name: Disable xdebug.
3+
file:
4+
path: "/etc/php/{{ php_version }}/fpm/conf.d/20-xdebug.ini"
5+
state: absent
6+
notify:
7+
- restart webserver
8+
- restart php-fpm

.composer/cache/.htaccess

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deny from all

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@
1919

2020
# Ignore files generated by PhpStorm
2121
/.idea/
22+
23+
# Extra.
24+
web/
25+
.composer/
26+
Vagrantfile

.gitignore.dist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Ignore sensitive information
2+
/web/sites/*/settings.php
3+
/web/sites/*/settings.local.php
4+
5+
# Ignore Drupal's file directory
6+
/web/sites/*/files/
7+
8+
# Ignore SimpleTest multi-site environment.
9+
/web/sites/simpletest
10+
11+
# Ignore files generated by PhpStorm
12+
/.idea/
13+
14+
# Extra.
15+
.beetbox/
16+
.composer/
17+
Vagrantfile

.htaccess

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Redirect all requests to the web directory.
3+
#
4+
5+
<IfModule mod_rewrite.c>
6+
RewriteEngine On
7+
8+
RewriteCond %{REQUEST_URI} ^/composer [NC,OR]
9+
RewriteCond %{REQUEST_URI} ^/composer.php$
10+
RewriteRule ^ composer.php [L]
11+
12+
RewriteRule ^(.*)$ /web/$1 [L]
13+
</IfModule>

README.md

Lines changed: 40 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,47 @@
1-
# Composer template for Drupal projects
1+
# Disclaimer
22

3-
[![Build Status](https://travis-ci.org/drupal-composer/drupal-project.svg?branch=8.x)](https://travis-ci.org/drupal-composer/drupal-project)
3+
First off I'd like to say this not an ideal solution and should never be considered as an alternative to using composer via CLI.
44

5-
This project template should provide a kickstart for managing your site
6-
dependencies with [Composer](https://getcomposer.org/).
5+
We're in an awkward situtation where composer is becoming a hard requirement for Drupal. If all this project achieves is more awareness of the proplem and convinces composer naysayers that it's actually better to use composer CLI, I'd be happy.
76

8-
If you want to know how to use it as replacement for
9-
[Drush Make](https://github.com/drush-ops/drush/blob/8.x/docs/make.md) visit
10-
the [Documentation on drupal.org](https://www.drupal.org/node/2471553).
7+
However, I understand that there are some cases where composer via CLI might be technically impossible leaving some users behind and the only option would be to use another CMS.
118

12-
## Usage
9+
To be clear, it would still be better to address the educational / technical limitations.
1310

14-
First you need to [install composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
11+
Currently, this is just a proof of concept and is very insecure and should not be used on any externally accessible webserver.
1512

16-
> Note: The instructions below refer to the [global composer installation](https://getcomposer.org/doc/00-intro.md#globally).
17-
You might need to replace `composer` with `php composer.phar` (or similar)
18-
for your setup.
13+
It would be nice if this could be integrated into Drupal's existing authentication and only allow access to user 1 similar to `update.php`.
1914

20-
After that you can create the project:
21-
22-
```
23-
composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
24-
```
25-
26-
With `composer require ...` you can download new dependencies to your
27-
installation.
28-
29-
```
30-
cd some-dir
31-
composer require drupal/devel:~1.0
32-
```
33-
34-
The `composer create-project` command passes ownership of all files to the
35-
project that is created. You should create a new git repository, and commit
36-
all files not excluded by the .gitignore file.
37-
38-
## What does the template do?
39-
40-
When installing the given `composer.json` some tasks are taken care of:
41-
42-
* Drupal will be installed in the `web`-directory.
43-
* Autoloader is implemented to use the generated composer autoloader in `vendor/autoload.php`,
44-
instead of the one provided by Drupal (`web/vendor/autoload.php`).
45-
* Modules (packages of type `drupal-module`) will be placed in `web/modules/contrib/`
46-
* Theme (packages of type `drupal-theme`) will be placed in `web/themes/contrib/`
47-
* Profiles (packages of type `drupal-profile`) will be placed in `web/profiles/contrib/`
48-
* Creates default writable versions of `settings.php` and `services.yml`.
49-
* Creates `web/sites/default/files`-directory.
50-
* Latest version of drush is installed locally for use at `vendor/bin/drush`.
51-
* Latest version of DrupalConsole is installed locally for use at `vendor/bin/drupal`.
52-
53-
## Updating Drupal Core
54-
55-
This project will attempt to keep all of your Drupal Core files up-to-date; the
56-
project [drupal-composer/drupal-scaffold](https://github.com/drupal-composer/drupal-scaffold)
57-
is used to ensure that your scaffold files are updated every time drupal/core is
58-
updated. If you customize any of the "scaffolding" files (commonly .htaccess),
59-
you may need to merge conflicts if any of your modified files are updated in a
60-
new release of Drupal core.
61-
62-
Follow the steps below to update your core files.
63-
64-
1. Run `composer update drupal/core --with-dependencies` to update Drupal Core and its dependencies.
65-
1. Run `git diff` to determine if any of the scaffolding files have changed.
66-
Review the files for any changes and restore any customizations to
67-
`.htaccess` or `robots.txt`.
68-
1. Commit everything all together in a single commit, so `web` will remain in
69-
sync with the `core` when checking out branches or running `git bisect`.
70-
1. In the event that there are non-trivial conflicts in step 2, you may wish
71-
to perform these steps on a branch, and use `git merge` to combine the
72-
updated core files with your customized files. This facilitates the use
73-
of a [three-way merge tool such as kdiff3](http://www.gitshah.com/2010/12/how-to-setup-kdiff-as-diff-tool-for-git.html). This setup is not necessary if your changes are simple;
74-
keeping all of your modifications at the beginning or end of the file is a
75-
good strategy to keep merges easy.
76-
77-
## Generate composer.json from existing project
78-
79-
With using [the "Composer Generate" drush extension](https://www.drupal.org/project/composer_generate)
80-
you can now generate a basic `composer.json` file from an existing project. Note
81-
that the generated `composer.json` might differ from this project's file.
82-
83-
84-
## FAQ
85-
86-
### Should I commit the contrib modules I download?
87-
88-
Composer recommends **no**. They provide [argumentation against but also
89-
workrounds if a project decides to do it anyway](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).
90-
91-
### Should I commit the scaffolding files?
92-
93-
The [drupal-scaffold](https://github.com/drupal-composer/drupal-scaffold) plugin can download the scaffold files (like
94-
index.php, update.php, …) to the web/ directory of your project. If you have not customized those files you could choose
95-
to not check them into your version control system (e.g. git). If that is the case for your project it might be
96-
convenient to automatically run the drupal-scaffold plugin after every install or update of your project. You can
97-
achieve that by registering `@drupal-scaffold` as post-install and post-update command in your composer.json:
98-
99-
```json
100-
"scripts": {
101-
"drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
102-
"post-install-cmd": [
103-
"@drupal-scaffold",
104-
"..."
105-
],
106-
"post-update-cmd": [
107-
"@drupal-scaffold",
108-
"..."
109-
]
110-
},
111-
```
112-
### How can I apply patches to downloaded modules?
113-
114-
If you need to apply patches (depending on the project being modified, a pull
115-
request is often a better solution), you can do so with the
116-
[composer-patches](https://github.com/cweagans/composer-patches) plugin.
117-
118-
To add a patch to drupal module foobar insert the patches section in the extra
119-
section of composer.json:
120-
```json
121-
"extra": {
122-
"patches": {
123-
"drupal/foobar": {
124-
"Patch description": "URL to patch"
125-
}
126-
}
127-
}
128-
```
129-
### How do I switch from packagist.drupal-composer.org to packages.drupal.org?
130-
131-
Follow the instructions in the [documentation on drupal.org](https://www.drupal.org/docs/develop/using-composer/using-packagesdrupalorg).
15+
# What?
16+
17+
This project provides a way to run common composer commands via a browser.
18+
19+
# How?
20+
21+
It creates a simple endpoint that will run a command on the project codebase.
22+
23+
eg. `/composer/update/drupal/core/--/with-dependencies` would run `composer update drupal/core --with-dependencies`.
24+
25+
# limitations.
26+
27+
Due to memory limitations it is unlikely you'd be able to run `install` to install all dependencies, also an unfiltered `update` would be impossible.
28+
However, if you include most packages in the tarball you don't have to install all packages and `require` or `update` on single packages are possible.
29+
30+
# Request structure.
31+
32+
/composer/[command]/[argument]/--/[options]
33+
34+
# Examples.
35+
36+
`/composer/validate` (default)
37+
38+
`/composer/show`
39+
40+
`/composer/require/drupal/devel/--/prefer-dist`
41+
42+
`/composer/install`
43+
44+
`/composer/install/--/no-dev`
45+
46+
`/composer/update/drupal/core/--/with-dependencies`
47+

circle.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
machine:
3+
php:
4+
version: 7.1.0
5+
dependencies:
6+
override:
7+
- composer install --prefer-dist
8+
- rm .gitignore && mv .gitignore.dist .gitignore
9+
- find ./vendor -type d | grep .git | xargs rm -rf
10+
- find ./web -type d | grep .git | xargs rm -rf
11+
- git config --global user.email "[email protected]"
12+
- git config --global user.name "Circle CI"
13+
- git add -A && git commit -m"[skip ci] Build of $CIRCLE_SHA1"
14+
- git push origin $CIRCLE_BRANCH:build --force
15+
test:
16+
override:
17+
- composer validate

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
}
1717
],
1818
"require": {
19+
"composer/composer": "^1.4",
1920
"composer/installers": "^1.2",
2021
"cweagans/composer-patches": "^1.6",
2122
"drupal-composer/drupal-scaffold": "^2.2",
@@ -26,6 +27,7 @@
2627
"webmozart/path-util": "^2.3"
2728
},
2829
"require-dev": {
30+
"beet/box": "^0.5.1",
2931
"behat/mink": "~1.7",
3032
"behat/mink-goutte-driver": "~1.2",
3133
"jcalderonzumba/gastonjs": "~1.0.2",
@@ -44,7 +46,8 @@
4446
},
4547
"autoload": {
4648
"classmap": [
47-
"scripts/composer/ScriptHandler.php"
49+
"scripts/composer/ScriptHandler.php",
50+
"scripts/composer/WebComposer.php"
4851
]
4952
},
5053
"scripts": {

0 commit comments

Comments
 (0)