edgar.dueñas
Enviado por edgar.dueñas el Mar, 16/08/2016 - 17:12
entorno de desarrollo con drupal vm para drupal 7 y 8

## Dependencias

* VirtualBox: 5.x * Vagrant: 1.8.x * Ansible (optional, but recommended): 2.0.x

 

## Mac

brew cask install virtualbox brew cask install vagrant brew install ansible

 

## Linux Fedora

sudo dnf install virtualbox sudo dnf install vagrant sudo dnf install ansible

 

## Linux Debian

sudo apt-get install virtualbox sudo apt-get install vagrant sudo apt-get install ansible

 

## Getting started

Referencia Vagrant: https://www.vagrantup.com/docs/cli/destroy.html

 

Descargar el proyecto base de:

https://bitbucket.org/pixtig/drupal7-con-drupal-vm    

 git clone git@bitbucket.org:pixtig/drupal7-con-drupal-vm.git

https://bitbucket.org/pixtig/drupal8-con-drupal-vm      

git clone git@bitbucket.org:pixtig/drupal8-con-drupal-vm.git

 

Abrir el proyecto con PHP Storm y buscar el archivo config.yml y editar lo siguiente:
 
En la linea 10 definir la url a utilizar
En la linea 11 ponerle un nombre a la maquina virtual
En la linea 12 asignar una IP diferente, se sugiere cambiar el ultimo numero
 
vagrant_hostname: local.drupal7.developer
vagrant_machine_name: drupal7
vagrant_ip: 192.168.88.88
     
Tambien es necesario definir en la linea 26 la ubicación del proyecto.
 
- local_path: ~/Desarrollo/drupal_vm/drupal7
Buscar la carpeta gulp-tasks y editar los siguientes archivos (En cada archivo se explica el cambio a realizar).
 
     browser-sync.js
     eslint.js

## Vagrant Es necesario instalar las siguientes dependencias:

```bash vagrant plugin install vagrant-hostsupdater vagrant plugin install vagrant-auto_network ```

## Mac or Linux only:

```bash # Install Ansible Galaxy roles required for this VM. sudo ansible-galaxy install -r provisioning/requirements.yml --force ```

## Vagrant Up por ultimo escribir vagrant up, y Vagrant iniciara. IMPORTANTE: Nuestro proyecto a trabajar se encuentra en /public_html/drupal/web/ ## Ejecutar un solo comando para instalar todos los plugins de gulp configurados (Instalar después de vagrant up):

```bash npm install ```

## POSIBLE ERROR 1 Note: If there are any errors during the course of running vagrant up, and it drops you back to your command prompt, just run vagrant provision to continue building the VM from where you left off.

vagrant halt vagrant up --provision

## POSIBLE ERROR 2
 
raise VersionConflict(dist,req) # XXX put more info here
VersionConflict: (setuptools 1.1.6 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse('setuptools>=11.3'))
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

SOLUCION: http://stackoverflow.com/questions/36958125/ansible-roles-packages-ansible-galaxy-error-on-instalation-mac-osx

Solución: Run the following to upgrade setuptools under the python user: pip install --upgrade setuptools --user python

For some reason, the way things are installed inside OS X (and in my case, under CentOS 7 inside a Docker container), the setuptools package doesn't get installed correctly under the right user. ## POSIBLE ERROR 3 NFS is reporting that your exports file is invalid. Vagrant does this check before making any changes to the file. Please correct the issues below and execute "vagrant reload":

exports:2: path contains non-directory or non-existent components: /Users/edgar/Desarrollo/drupal8_dvm/drupal8 exports:2: no usable directories in export entry exports:2: using fallback (marked offline): /

Solución: So I had to clean up that file and restart my vagrant box. NFS is reporting that your exports file is invalid. Vagrant does this check before making any changes to the file. Please correct the issues below and execute "vagrant reload":

Here's what I did on my host machine: sudo rm /etc/exports sudo touch /etc/exports vagrant halt vagrant up --provision Referencia: http://stackoverflow.com/questions/20726248/vagrant-error-nfs-is-reporting-that-your-exports-file-is-invalid

## POSIBLE ERROR 4

drupal7 : ok=114  changed=43   unreachable=0    failed=1   

Ansible failed to complete successfully. Any error output should be visible above. Please fix these errors and try again. ## Turning it off

vagrant halt

## Configurando Gulp de forma manual

Referencia: https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md Referencia Gulp: http://gulpjs.com/plugins/

Ejecutar un solo comando para instalar todos los plugins de gulp configurados:

npm install

1. Install gulp globally: If you have previously installed a version of gulp globally, please run npm rm --global gulp to make sure your old version doesn't collide with gulp-cli.

$ sudo npm install --global gulp-cli 2. Initialize your project directory: $ sudo npm init

3. Install gulp in your project devDependencies: $ sudo npm install --save-dev gulp

4. Create a gulpfile.js at the root of your project (No hacer porque se ha creado y guardado en el repositorio): // Dependencies.

var requireDir = require('require-dir'); var tasks = requireDir('./gulp-tasks');

5. Run gulp:

$ gulp

The default task will run and do nothing. ## Para importar nuestro gulp en un directorio especifico (./gulp-tasks) es necesario instalar

sudo npm install require-dir sudo npm install gulp-task-listing

## Para usar gulp phplint es necesario instalar

sudo npm install phplint sudo npm install gulp-util

## Para usar gulp eslint es necesario instalar

sudo npm install gulp-eslint sudo npm install fs sudo npm install minimist sudo npm install gulp-if

## Para comprimir imagenes PNG, JPEG, GIF and SVG images

sudo npm install --save-dev gulp-imagemin

## Para validar nuestro codigo PHP Drupal

sudo npm install --save-dev through2 sudo npm install --save-dev sync-exec

## Para sincronizar el navegador con un dispositivo movil

sudo npm install --save-dev browser-sync O sudo npm install browser-sync gulp --save-dev

LISTO!!!