Skip to content

Conversation

@webflo
Copy link
Member

@webflo webflo commented Jul 18, 2016

No description provided.

@yobottehg
Copy link

What about fonts from custom themes? Perhaps we should make the file types that should get copied configurable.

@webflo
Copy link
Member Author

webflo commented Jul 19, 2016

Yes, thats the idea. We can add it to the composer.json. I think we should have the ability to link whole folders as well. E.g. Symlink the css and js folder of a certain theme instead of individual files.

"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"app/core": ["type:drupal-core"],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need the "app" directory? Shouldn't core be at the root? This just one annoying directory level deeper with no benefit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily, but this project had a folder which contained modules, profiles, theme and some dotfiles before. And it was not on the repo root before.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate breaking out all the application stuff into a separate folder. I can then put things like patternlab directly into the app folder and sync over what I need.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that "app" does not make so much sense, as "vendor" would have to be part of the app also?

Copy link

@ostark ostark Jul 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"/app" is the common folder in symfony and laravel for code you own. While "/vendor" is the default place for 3rd party (composer) dependencies. This structure is common pattern these days:

/app
/vendor
/var (or /storage)
/web (or /public)


// Symlink public files
$fs = new Filesystem();
$fs->symlink(realpath($extra['drupal-app-dir']) . '/sites/default/files', $extra['drupal-web-dir'] . '/sites/default/files');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO is a good thing create the files symlink using relative paths, absolute symbolic links don't work when the filesystem is mounted elsewhere.
$fs->symlink('../../../' . $extra['drupal-web-dir'] . '/sites/default/files', $extra['drupal-app-dir'] . '/sites/default/files');

@jkribeiro
Copy link

@webflo could you please update this PR to solve those files conflicts

@webflo
Copy link
Member Author

webflo commented Apr 6, 2017

@jkribeiro Did a rebase against 8.x

@medienverbinder
Copy link

Whenever possible I use the approach from drupal.org for new installations and I think a working "paranoia mode" is very useful. What is going to happen next with this issue? Can I do something to move forward?

throw new \RuntimeException('Please configure drupal-web-dir in your composer.json');
}
foreach (static::$frontControllers as $fileName) {
static::createStubPhpFile($extra['drupal-app-dir'], $extra['drupal-web-dir'], $fileName);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that makePathRelative() expects absolute paths to do the comparison. In this case it should be:
static::createStubPhpFile(realpath($extra['drupal-app-dir']), realpath($extra['drupal-web-dir']), $fileName);

throw new \RuntimeException('Please configure drupal-web-dir in your composer.json');
}
foreach (static::$frontControllers as $fileName) {
static::createStubPhpFile($extra['drupal-app-dir'], $extra['drupal-web-dir'], $fileName);
Copy link

@jkribeiro jkribeiro Nov 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before call createStubPhpFile(), the web and app folders must exist, otherwise the process will return an error

[Symfony\Component\Filesystem\Exception\IOException] Unable to write to the "/" directory. 

This was not happening before because createSymlinks() was being called before createStubPhpFile() and creating the folders.
b111239#diff-a97cd408fd45330f7510ba6d71ab4907R25

Suggestion:

// Ensure that the app and web directories exist. $cfs = new \Composer\Util\Filesystem(); $cfs->ensureDirectoryExists($web_dir); $cfs->ensureDirectoryExists($app_dir); // Call createStubPhpFile(). // Call createSymlinks(). 
@jkribeiro
Copy link

From: #335

Initially, I know that is not a good thing to have parallel PR for the same change, I'm gonna explain:
I've been running the paranoia mode on some of my projects for a while and since #180 has been without activity for some time, I decided to fork it and create this #335 with the changes that I've made. I tried to create a PR from #180 but it is conflicting, so, here is a fresh one from 8.x.

Main changes made from the original PR

  • Recreate the web dir on every assets installer process: The web directory is disposable, I think its needs to be deleted and recreated from scratch on every installation to remove the old assets and install the new ones.
  • Added new config for Public files folder location: A new optional config was added to be able to set a custom symlink target for the the public files at the web dir. This could help with custom locations on different servers. The new optional config is drupal-web-dir-public-files.

I'm running the paranoia mode on Acquia Cloud servers, to be able to customize this for Acquia structure, I've created https://github.com/jkribeiro/drupal-project-acquia-paranoia-mode for additional installation/instruction.

@webflo webflo closed this Apr 11, 2018
@webflo webflo deleted the paranoia-mode branch April 11, 2018 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

8 participants