Homestead: Inconsitency between folders mapping an sites mapping for `.` containing folder name

Created on 9 Mar 2017  路  3Comments  路  Source: laravel/homestead

When a homestead instance is created locally in a folder containing a . the dot is replaced by a - in the folders mapping but not in the sites mapping. This breaks the installation.

Versions

  • Vagrant: 1.9.1
  • Provider: Virtualbox 5.1.16 r113841
  • Homestead: 2.0.17

Host operating system

MacOS X 10.12.3

Homestead.yaml

ip: 192.168.10.10
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
    - ~/.ssh/id_rsa
folders:
    - { map: /Users/pln/Projects/7s/test.com, to: /home/vagrant/Code/test-com }
sites:
    - { map: test.com.app, to: /home/vagrant/Code/test.com/public }
databases:
    - homestead
name: test-com
hostname: test-com

Vagrant up output

Irrelevant

Expected behavior

Any . contained in the folder name should be replaced by a - in the sites mapping.

Expected result :

folders:
    - { map: /Users/pln/Projects/7s/test.com, to: /home/vagrant/Code/test-com }
sites:
    - { map: test.com.app, to: /home/vagrant/Code/test-com/public }

Actual behavior

Any . contained in the folder name is replaced by a - in the folders mapping but remains a . in the site mappings which makes the server not working.
Actual :

folders:
    - { map: /Users/pln/Projects/7s/test.com, to: /home/vagrant/Code/test-com }
sites:
    - { map: test.com.app, to: /home/vagrant/Code/test.com/public }

Most helpful comment

@pluxain you're right, let me write some tests for it and i will take a look a little latter.

All 3 comments

@pluxain you're right, let me write some tests for it and i will take a look a little latter.

In fact the tests exist but the preconfigured sites folders tests miss the sluggify step.

// tests/MakeCommandTest.php file

/** @test */
public function a_homestead_yaml_settings_has_preconfigured_shared_folders()
{
    // ...
   $projectDirectory = basename(getcwd());
   $projectName = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $projectDirectory))); // Sluggify
    // ...
}

/** @test */
public function a_homestead_yaml_settings_has_preconfigured_sites()
{
    // ...
    $projectName = basename(getcwd());
    // Here the sluggify step is missing
    // ...
}

This is also true for the json versions of these tests

@pluxain good catch!, i will extract those sluggify steps into methods for readability.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Modelizer picture Modelizer  路  5Comments

bironeaj picture bironeaj  路  3Comments

alexdover picture alexdover  路  4Comments

Quix0r picture Quix0r  路  4Comments

m4olivei picture m4olivei  路  4Comments