Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows support #5

Open
flyke opened this issue Jun 26, 2018 · 5 comments
Open

Windows support #5

flyke opened this issue Jun 26, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@flyke
Copy link

flyke commented Jun 26, 2018

Hi, I tested this out, but in the end the composer install ended with this error:

...
web.config (https://cgit.drupalcode.org/drupal/plain/web.config?h=8.5.4): Downloading (100%)
In Filesystem.php line 342:
$from (C:\websites\test\htdocs/sites/default/files) and $to () must be absolute paths.

The site seems to be partially working: after the composer install (after the message above) I pointed a new entry (site.test) in my host file to the drupal-web-dir (I used 'htdocs' instead of 'web') so I pointed site.test to C:\websites\test\htdocs. When I surf to site.test I do see the drupal install page, but there is no theming at all.

The resulted folder structure ofter the composer install looks like this:

testsite
  app
    core
    modules
    profiles
    sites
    themes
    (all the drupal scaffold files)
  htdocs
    core
      modules
        statistics
          statistics.php
      install.php
      rebuild.php
    sites
      default (this is completely empty)
  vendor
    (all vendor folders)
  composer.json
  composer.lock
@flyke
Copy link
Author

flyke commented Jun 26, 2018

Update:

This is usable if you copy all assets from within the app/ folder to your drupal-web-dir folder (default web/ but I set mine to be htdocs/)

I found a script here:
https://www.drupal.org/node/2767907

So in my root folder, I created a copyassets.php file containing:

<?php
function select_copy($src,$dst) {
  $allowedtypes=array("css"=>true,"js"=>true,"svg"=>true,"png"=>true,"jpg"=>true,"jpeg"=>true,"ico"=>true,"gif"=>true);
  $dir = opendir($src);
  $dirmaker = 0;
  while(false !== ( $file = readdir($dir)) ) {
    if (( $file != '.' ) && ( $file != '..' )) {
      if ( is_dir($src . '/' . $file) ) {
        select_copy($src . '/' . $file,$dst . '/' . $file);
      }
      else {
        $fileext=pathinfo($file, PATHINFO_EXTENSION);
        if( !empty($allowedtypes[strtolower($fileext)]) && $allowedtypes[strtolower($fileext)]===true){
          if($dirmaker ==0){
            $patharray=explode('/', $dst);
            $path='';
            foreach ($patharray as &$value) {
              $path=$path.'/'.$value;
              @mkdir(ltrim($path, '/'));
            }
            echo '<b>'.ltrim($path, '/').'</b><br>';
            $dirmaker =1;
          }
          copy($src . '/' . $file,$dst . '/' . $file);
          echo $dst . '/' . $file.'<br>';
        }
      }
    }
  }
  closedir($dir);
}

select_copy('app/core/assets','htdocs/core/assets');
select_copy('app/core/misc','htdocs/core/misc');
select_copy('app/core/modules','htdocs/core/modules');
select_copy('app/core/scripts','htdocs/core/scripts');
select_copy('app/core/tests','htdocs/core/tests');
select_copy('app/core/themes','htdocs/core/themes');

select_copy('app/libraries','htdocs/libraries'); //if use custom or contrib libraries
select_copy('app/modules','htdocs/modules');     //if use custom or contrib modules
select_copy('app/profiles','htdocs/profiles');   //if use custom or contrib profiles
select_copy('app/themes','htdocs/themes');       //if use custom or contrib themes

and after my composer install was finished (and I have app/ and htdocs/ folders), i ran:
php copyassets.php

and then everything seems to work. (theme/layout is now ok)

But then I guess this will need to run after every new module install, every module update, every theme adjustment, ... so if you have a better method, please do enlight me.

Also: by default clean urls are not working. You need to copy app/.htaccess to htdocs/.htaccess

@jkribeiro
Copy link
Collaborator

Hi,

You are running this on Windows, right? I noticed the path C:\websites\test\htdocs/sites/default/files.
It seems that this plugin has no support for Windows environments because of the symlinks. We need to test it.

Could you post here how your environment is set up?

  • OS
  • Composer version
  • How composer is installed (.exe, cygwin, etc)
  • composer.json extra config

Thanks

@flyke
Copy link
Author

flyke commented Jun 27, 2018

Hi, thank you for your reply.

OS: Windows 10 64bit
Composer version: 1.6.2

This is my composer file:

{
    "name": "intracto/paranoiatest",
    "description": "Add a new blanco site",
    "type": "project",
    "require": {
        "composer/installers": "^1.0.21",
        "cweagans/composer-patches": "^1.6",
        "digity/basetheme": "^1.0",
        "digity/digity_install_profile": "^1.0",
        "drupal-composer/drupal-paranoia": "~1",
        "drupal-composer/drupal-scaffold": "^2.5",
        "drupal/address": "^1.3",
        "drupal/admin_toolbar": "^1.22",
        "drupal/adminimal_admin_toolbar": "^1.5",
        "drupal/adminimal_theme": "^1.3",
        "drupal/advagg": "^3.4",
        "drupal/allowed_formats": "^1.1",
        "drupal/contact_storage": "^1.0@beta",
        "drupal/core": "^8.5",
        "drupal/critical_css": "^1.8",
        "drupal/ctools": "3.x-dev",
        "drupal/data_attribute_gmap": "1.3",
        "drupal/devel": "^1.2",
        "drupal/email_registration": "^1.0@RC",
        "drupal/field_group": "^1.0",
        "drupal/geolocation": "^1.11",
        "drupal/gmap_popup_styler": "^1.0",
        "drupal/http2_server_push": "^1.0",
        "drupal/image_widget_crop": "^2.1",
        "drupal/imce": "^1.6",
        "drupal/linkit": "^4.3",
        "drupal/menu_admin_per_menu": "^1.0",
        "drupal/messageclose": "^1.0",
        "drupal/metatag": "^1.4",
        "drupal/override_node_options": "^2.3",
        "drupal/paragraphs": "^1.2",
        "drupal/paragraphs_edit": "^2.0@alpha",
        "drupal/pathauto": "^1.0",
        "drupal/redirect": "^1.0",
        "drupal/simple_sitemap": "^2.11",
        "drupal/system_tags": "^1.1",
        "drupal/tasty_backend": "^1.0@beta",
        "drupal/token": "^1.1",
        "drupal/twig_tweak": "^1.9",
        "drush/drush": "^9.2",
        "oomphinc/composer-installers-extender": "^1.1",
        "twbs/bootstrap": "^4.1"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true,
        "optimize-autoloader": true,
        "preferred-install": "source",
        "autoloader-suffix": "Drupal8",
        "discard-changes": true
    },
    "extra": {
        "installer-types": ["drupal-digity-module"],
        "installer-paths": {
            "app/core": ["type:drupal-core"],
            "app/profiles/{$name}": ["type:drupal-profile"],
            "app/modules/contrib/{$name}": ["type:drupal-module"],
            "app/modules/digity/{$name}": ["type:drupal-digity-module"],
            "app/modules/custom/{$name}": ["type:drupal-custom-module"],
            "htdocs/themes/contrib/{$name}": ["type:drupal-theme"],
            "htdocs/themes/custom/{$name}": ["type:drupal-custom-theme"],
            "app/libraries/{$name}": ["type:drupal-library"],
            "drush/contrib/{$name}": ["type:drupal-drush"],
            "app/themes/custom/basetheme/scss/vendor/bootstrap": ["twbs/bootstrap"]
        },
        "patches-file": "composer.patches.json",
        "drupal-app-dir": "app",
        "drupal-web-dir": "htdocs"
    },
    "autoload": {
        "psr-4": {
            "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
        }
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "git",
            "url":  "git@bitbucket.org:flyke/digity_install_profile.git"
        },
        {
            "type": "git",
            "url":  "git@bitbucket.org:flyke/basetheme.git"
        }
    ],
    "require-dev": {
        "drupal/coder": "^8.2",
        "drupal/twig_xdebug": "^1.0",
        "phpro/grumphp": "^0.14.1"
    },
    "authors": [
        {
            "name": "Joery Lemmens",
            "email": "joery@digity.be"
        }
    ],
    "scripts": {
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess",
        "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
        "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup"
    }
}

@flyke
Copy link
Author

flyke commented Jun 27, 2018

I retested this in debian linux (via vagrant) and also had en error, I will open a separate issue for this (so this can remain a windows issue)

@jkribeiro jkribeiro changed the title Problem with files directory [Windows] Problem with files directory Jun 27, 2018
@jkribeiro jkribeiro added the enhancement New feature or request label Jun 27, 2018
@jkribeiro
Copy link
Collaborator

Thanks, I'll test this on a Windows environment.
I think for Windows, we'll need to copy the files instead of symlinking them. We can add a verification for it.

I would say that this issue is not a bug, so I flagged it as an enhancement.

For now, I'm updating the REAME to say that currently we don't support Windows environments.

@jkribeiro jkribeiro changed the title [Windows] Problem with files directory Windows support Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants