Parcourir la source

Update Vagrantfile to use Rasmus' php7 box

This allows us to easily switch between PHP versions down to 5.3 using
the `newphp nn` command.

You're on your own for installing PHPUnit though, it's easy enough with
`composer global require phpunit/phpunit:~4.0` or whatever though.
Rob Allen il y a 10 ans
Parent
commit
372ab75581
5 fichiers modifiés avec 32 ajouts et 198 suppressions
  1. 1 0
      .gitignore
  2. 31 75
      Vagrantfile
  3. 0 25
      puppet/manifests/default.pp
  4. 0 14
      puppet/scripts/pe.sh
  5. 0 84
      puppet/scripts/php-build.sh

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
+.vagrant
 tests/Zend/Db/Table/_files/cachefiles/*
 tests/Zend/Auth/Adapter/OpenId/_files/*
 tests/Zend/Filter/_files/Compress/*

+ 31 - 75
Vagrantfile

@@ -1,90 +1,46 @@
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 
-Vagrant::Config.run do |config|
-  # All Vagrant configuration is done here. The most common configuration
-  # options are documented and commented below. For a complete reference,
-  # please see the online documentation at vagrantup.com.
 
-  # Every Vagrant virtual environment requires a box to build off of.
-  config.vm.box = "lucid32"
+# Inline provisioning shell script
+@script = <<SCRIPT
 
-  # The url from where the 'config.vm.box' box will be fetched if it
-  # doesn't already exist on the user's system.
-  config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
+echo -e '\nexport PATH=~/.composer/vendor/bin:$PATH\n' >> ~/.bashrc
 
-  # Boot with a GUI so you can see the screen. (Default is headless)
-  #config.vm.boot_mode = :gui
+# Switch to PHP7
+newphp 7
 
-  # Assign this VM to a host-only network IP, allowing you to access it
-  # via the IP. Host-only networks can talk to the host machine as well as
-  # any other machines on the same network, but cannot be accessed (through this
-  # network interface) by any external networks.
-  # config.vm.network :hostonly, "192.168.33.10"
+# rebuild PHP7
+#makephp 7
 
-  # Assign this VM to a bridged network, allowing you to connect directly to a
-  # network using the host's network device. This makes the VM appear as another
-  # physical device on your network.
-  # config.vm.network :bridged
+echo ""
+echo "** SSH into the box to run the tests. use newphp to switch between versions and makephp 7 to rebuld PHP  7**"
+echo "** Use 'newphp nn' to switch between versions (e.g. newphp 54)**"
+echo "** Install PHPUnit via composer global require phpunit/phpunit:~n.n for the version required**"
+echo ""
+SCRIPT
 
-  # Forward a port from the guest to the host, which allows for outside
-  # computers to access the VM, whereas host only networking does not.
-  config.vm.forward_port 80, 8081
 
-  # Hostname
-  config.vm.host_name = "zf1.dev"
+# Vagrant configuration
+VAGRANTFILE_API_VERSION = "2"
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |c|
+  c.vm.define "zf1dev", primary: true do |config|
+    config.vm.box = 'rasmus/php7dev'
+    # config.vm.network :forwarded_port, guest: 80, host: 8889
+    config.vm.hostname = "zf1dev.localhost"
+    
+    config.vm.provision 'shell', inline: @script
 
-  # Pass custom arguments to VBoxManage before booting VM
-  config.vm.customize [
-    # 'modifyvm', :id, '--chipset', 'ich9', # solves kernel panic issue on some host machines
-    # '--uartmode1', 'file', 'C:\\base6-console.log' # uncomment to change log location on Windows
-    "setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"
-  ]
+    config.vm.provider "virtualbox" do |vb|
+      vb.customize ["modifyvm", :id, "--memory", "1024"]
+    end
 
-  # Share an additional folder to the guest VM. The first argument is
-  # an identifier, the second is the path on the guest to mount the
-  # folder, and the third is the path on the host to the actual folder.
-  # config.vm.share_folder "v-data", "/vagrant_data", "../data"
-
-  # Enable provisioning with Puppet stand alone.  Puppet manifests
-  # are contained in a directory path relative to this Vagrantfile.
-  # You will need to create the manifests directory and a manifest in
-  # the file lucid32.pp in the manifests_path directory.
-  #
-  # An example Puppet manifest to provision the message of the day:
-  #
-  # # group { "puppet":
-  # #   ensure => "present",
-  # # }
-  # #
-  # # File { owner => 0, group => 0, mode => 0644 }
-  # #
-  # # file { '/etc/motd':
-  # #   content => "Welcome to your Vagrant-built virtual machine!
-  # #               Managed by Puppet.\n"
-  # # }
-  #
-  # config.vm.provision :puppet do |puppet|
-  #   puppet.manifests_path = "manifests"
-  #   puppet.manifest_file  = "lucid32.pp"
-  # end
-
-
-  config.vm.provision :puppet do |puppet|
-    puppet.manifests_path = "puppet/manifests"
-    puppet.manifest_file  = "default.pp"
   end
+end
 
-#  config.vm.provision :puppet do |puppet|
-#    puppet.manifests_path = "puppet/manifests"
-#    puppet.module_path = "puppet/modules"
-#    puppet.manifest_file = "zf1.pp"
-#    puppet.options = [
-#      '--verbose',
-#      #'--debug',
-#      # '--graph',
-#      # '--graphdir=/vagrant/puppet/graphs'
-#    ]
-#  end  
 
-end
+    # config.vm.customize [
+    #   # 'modifyvm', :id, '--chipset', 'ich9', # solves kernel panic issue on some host machines
+    #   # '--uartmode1', 'file', 'C:\\base6-console.log' # uncomment to change log location on Windows
+    #   "setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"
+    # ]

+ 0 - 25
puppet/manifests/default.pp

@@ -1,25 +0,0 @@
-group { "puppet":
-    ensure => "present",
-}
-
-exec { "apt-update" :
-    command => "/usr/bin/apt-get update"
-}
-
-# install vim and all packages required to build PHP
-$packages = [ "vim", "curl", "libxpm-dev", "libmcrypt-dev", "libbz2-dev", "libcurl4-gnutls-dev", "libjpeg62-dev", "libpng12-dev", "libfreetype6-dev", "libt1-dev", "libgmp3-dev", "libmysqlclient-dev", "libpq-dev", "libpcre3-dev", "libxml2-dev", "libxslt-dev", "make", "phpunit"]
-
-package { $packages :
-    ensure => installed,
-    require => Exec["apt-update"],
-}
-
-# Update .bashrc
-$serial = "2012043001"
-$serialfile = "/var/log/pe-bashrc-update.serial"
-exec { "install-bashrc-update":
-    command => "/bin/cat /vagrant/puppet/scripts/pe.sh >> /home/vagrant/.bashrc \
-                && /bin/echo \"$serial\" > \"$serialfile\"",
-    unless  => "/usr/bin/test \"`/bin/cat $serialfile 2> /dev/null`\" = \"$serial\"",
-}
-

+ 0 - 14
puppet/scripts/pe.sh

@@ -1,14 +0,0 @@
-
-function pe () {
-        version=$1
-        shift
-
-        if [ "$#" == "0" ]; then
-                export PATH=/usr/local/php/${version}/bin:/usr/local/bin:/usr/bin:/bin:/vagrant/puppet/scripts
-        else
-                PATH=/usr/local/php/${version}/bin:$PATH $@
-        fi
-}
-
-export PATH=/vagrant/puppet/scripts/:$PATH
-

+ 0 - 84
puppet/scripts/php-build.sh

@@ -1,84 +0,0 @@
-#!/bin/bash
-
-VERSION=$1
-
-RESET=$2
-POSTFIX=
-EXTRA_FLAGS=
-
-if [ -z "$VERSION" ]; then
-    echo "Usage: php-build.sh {VERSION}"
-    echo ""
-    echo "e.g. php-build.sh 5.2.11"
-    exit;
-fi
-
-if [ -z "$RESET" ]; then
-    RESET=0
-fi
-
-
-SRC_DIR=/home/vagrant/src
-PHP_DIR=${SRC_DIR}/php-${VERSION}
-
-if [ ! -d "$SRC_DIR" ]; then 
-    mkdir ${SRC_DIR}
-fi
-cd $SRC_DIR
-
-# If we don't have the src file downloaded, then we're going to need it.
-if [ ! -f "php-${VERSION}.tar.gz" ]; then
-    RESET=1
-fi;
-
-# Retrieve source code 
-if [ $RESET -eq 1 ] ; then
-    echo "Downloading php-${VERSION}.tar.gz"
-    RESPONSE=$(curl --write-out %{http_code} --silent  --head --output /dev/null http://museum.php.net/php5/php-${VERSION}.tar.gz)
-    echo $RESPONSE
-    if [ $RESPONSE -eq 404 ]; then
-        wget -O php-${VERSION}.tar.gz http://uk3.php.net/get/php-${VERSION}.tar.gz/from/this/mirror
-    else
-        wget http://museum.php.net/php5/php-${VERSION}.tar.gz
-    fi
-
-    if [ ! -f php-${VERSION}.tar.gz ];
-    then
-        echo "Could not find php-${VERSION}.tar.gz"
-        exit;
-    fi
-    
-    rm -rf ${PHP_DIR}
-    tar -zxf php-${VERSION}.tar.gz
-fi
-
-cd $PHP_DIR
-echo "Configuring ${VERSION}${POSTFIX} in $PHP_DIR"
-
-# Configure 
-OPTIONS="--with-gd --with-jpeg-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr \
-    --with-mysql=/usr --enable-bcmath --with-gmp --with-readline \
-    --with-openssl --with-curl --without-esmtp \
-    --with-mysqli --enable-pcntl \
-    --enable-memory-limit --with-mcrypt --with-t1lib \
-    --enable-debug --with-iconv --enable-wddx --with-pdo-pgsql \
-    --enable-spl --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
-    --with-ctype --with-bz2 --enable-mbstring --with-mime-magic \
-    --with-xmlrpc --with-zlib --disable-zend-memory-manager --with-esmtp \
-    --with-xsl --enable-exif --enable-soap --enable-ftp"
-
-./configure --prefix=/usr/local/php/${VERSION}${POSTFIX} ${EXTRA_FLAGS} ${OPTIONS}
-
-# Build and install
-echo "Building ${VERSION}${POSTFIX} in $PHP_DIR"
-make -j 5
-
-echo "Installing ${VERSION}${POSTFIX} in $PHP_DIR"
-sudo make install
-
-echo "Linking PHPUnit library"
-sudo ln -s /usr/share/php/PHPUnit /usr/local/php/${VERSION}${POSTFIX}/lib/php/PHPUnit
-
-echo ""
-echo "PHP version ${VERSION} is now installed. Type: pe ${VERSION}"
-echo ""