Skip to content

Commit

Permalink
Merge pull request #30 from mothership-gmbh/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
azngeek committed Mar 3, 2016
2 parents f0eb97b + 32f08ea commit 5f17e60
Show file tree
Hide file tree
Showing 17 changed files with 713 additions and 36 deletions.
43 changes: 18 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
language: php
sudo: true

php:
- 5.3
- 5.4
- 5.5
- 5.6
# - 5.6
- 7.0

env:
matrix:
- MAGENTO_VERSION="magento-mirror-1.6.2.0" INSTALL_SAMPLE_DATA=yes
- MAGENTO_VERSION="magento-mirror-1.7.0.2" INSTALL_SAMPLE_DATA=yes
- MAGENTO_VERSION="magento-mirror-1.8.1.0" INSTALL_SAMPLE_DATA=yes
# Do not download sample data of 1.9 -> The file is too big
- MAGENTO_VERSION="magento-mirror-1.9.0.1" INSTALL_SAMPLE_DATA=no
- MAGENTO_VERSION="magento-mirror-1.9.1.1" INSTALL_SAMPLE_DATA=no
- MAGENTO_VERSION="magento-mirror-1.9.2.1" INSTALL_SAMPLE_DATA=no
- MAGENTO_VERSION="magento-mirror-1.9.2.2" INSTALL_SAMPLE_DATA=no
- MAGENTO_VERSION="magento-mirror-1.9.2.3" INSTALL_SAMPLE_DATA=no

## Update composer and run the appropriate composer command
before_script:
- composer install
#install modman
#- sudo wget http://module-manager.googlecode.com/files/modman-1.1.1
#- sudo cp modman-1.1.1 /usr/local/bin/modman
#- sudo chmod +x /usr/local/bin/modman #needs to be executable
#- cd "${MAGENTO_VERSION}"
#- modman init
#- modman deploy-all
- composer self-update -q
- if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;

before_install:
- chmod +x _deploy/travis.sh

allow_failures:
- php: 5.4
- php: hhvm
- env: MAGENTO_VERSION="magento-mirror-1.8.1.0" INSTALL_SAMPLE_DATA=yes
- env: MAGENTO_VERSION="magento-mirror-1.9.2.3" INSTALL_SAMPLE_DATA=yes

env:
- MAGENTO_VERSION="magento-mirror-1.8.1.0" INSTALL_SAMPLE_DATA=no
- MAGENTO_VERSION="magento-mirror-1.9.2.3" INSTALL_SAMPLE_DATA=no

#script:
# - phpunit --coverage-text
script: _deploy/travis.sh
1 change: 1 addition & 0 deletions _deploy/.basedir
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
htdocs
97 changes: 97 additions & 0 deletions _deploy/deploy_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
set -e
set -x

function cleanup {
if [ -z $SKIP_CLEANUP ]; then
echo "Removing build directory ${BUILDENV}"
#rm -rf "${BUILDENV}"
fi
}

trap cleanup EXIT

BUILDENV="/srv/extension.vm";

MAGENTO_DB_HOST="127.0.0.1";
MAGENTO_DB_PORT="3306";
MAGENTO_DB_USER="super";
MAGENTO_DB_PASS="super123";
MAGENTO_DB_NAME="extension";
MAGENTO_DB_ALLOWSAME="0";

CWD=$(pwd)


# Use the local mothership patched one
MAGENTO_VERSION=magento-mirror-1.8.1.0

#
if [ -d "${BUILDENV}/htdocs" ] ; then
rm -rf ${BUILDENV}/htdocs
fi

mkdir -p ${BUILDENV}/htdocs


echo "Using build directory ${BUILDENV}"



if [ -d "${BUILDENV}/.modman/extension" ] ; then
rm -rf "${BUILDENV}/.modman/extension"
fi

mkdir -p ${BUILDENV}/.modman/extension

cp -rf . "${BUILDENV}/.modman/extension"

# Start building everything
cp -f ${CWD}/composer.json ${BUILDENV}
cp -f ${CWD}/_deploy/.basedir ${BUILDENV}/.modman

# Get absolute path to main directory
ABSPATH=$(cd "${0%/*}" 2>/dev/null; echo "${PWD}/${0##*/}")
SOURCE_DIR=`dirname "${ABSPATH}"`

echo ${SOURCE_DIR}

echo
echo "-------------------------------"
echo "- Mothership local deployment -"
echo "-------------------------------"
echo

cd /tmp

mysql -u${MAGENTO_DB_USER} -p${MAGENTO_DB_PASS} -h${MAGENTO_DB_HOST} -P${MAGENTO_DB_PORT} -e "DROP DATABASE IF EXISTS \`${MAGENTO_DB_NAME}\`; CREATE DATABASE \`${MAGENTO_DB_NAME}\`;"

# Install Magento with sample data
magerun install \
--dbHost="${MAGENTO_DB_HOST}" --dbUser="${MAGENTO_DB_USER}" --dbPass="${MAGENTO_DB_PASS}" --dbName="${MAGENTO_DB_NAME}" --dbPort="${MAGENTO_DB_PORT}" \
--installSampleData=yes \
--useDefaultConfigParams=yes \
--magentoVersionByName="${MAGENTO_VERSION}" \
--installationFolder="${BUILDENV}/htdocs" \
--baseUrl="http://extension.vm/" || { echo "Installing Magento failed"; exit 1; }


cd ${BUILDENV}

php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php composer-setup.php

php composer.phar install
modman deploy-all --force

# After running composer, we will have all the files needed. Now
#cp ${CWD}/phpunit.xml.dist "${BUILDENV}/htdocs/phpunit.xml.dist"

magerun cache:clean
magerun sys:module:list |grep Mothership

export N98_MAGERUN_TEST_MAGENTO_ROOT=${BUILDENV}/htdocs

cd ${BUILDENV}/htdocs
phpunit --group Mothership --debug --verbose

23 changes: 23 additions & 0 deletions _deploy/reload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
set -e
set -x


BUILDENV="/srv/extension.vm";

cp -f composer.json ${BUILDENV}
cp -f _deploy/.basedir ${BUILDENV}/.modman

if [ -d "${BUILDENV}/.modman/extension" ] ; then
rm -rf "${BUILDENV}/.modman/extension"
fi

cp -rf . "${BUILDENV}/.modman/extension"

cd ${BUILDENV}
php composer.phar install
modman deploy-all --force

magerun cache:clean
magerun sys:module:list |grep Mothership
export N98_MAGERUN_TEST_MAGENTO_ROOT=${BUILDENV}/htdocs
104 changes: 104 additions & 0 deletions _deploy/travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/bin/bash
set -e
set -x

# most of the script is based on the fantastic https://github.com/AOEpeople/MageTestStand project

# create a temporary directory
BUILDENV=`mktemp -d /tmp/mothership.XXXXXXXX`
CWD=$(pwd)

echo "BUILD = ${BUILDENV}"
echo "CWD = ${CWD}"


mkdir -p ${BUILDENV}/.modman/mothership_magerun

cp -rf . "${BUILDENV}/.modman/mothership_magerun"

# Start building everything
cp -f ${CWD}/composer.json ${BUILDENV}
cp -f ${CWD}/_deploy/.basedir ${BUILDENV}/.modman

# Get absolute path to main directory
ABSPATH=$(cd "${0%/*}" 2>/dev/null; echo "${PWD}/${0##*/}")
SOURCE_DIR=`dirname "${ABSPATH}"`

if [ -z $MAGENTO_DB_HOST ]; then MAGENTO_DB_HOST="localhost"; fi
if [ -z $MAGENTO_DB_PORT ]; then MAGENTO_DB_PORT="3306"; fi
if [ -z $MAGENTO_DB_USER ]; then MAGENTO_DB_USER="root"; fi
if [ -z $MAGENTO_DB_PASS ]; then MAGENTO_DB_PASS=""; fi
if [ -z $MAGENTO_DB_NAME ]; then MAGENTO_DB_NAME="mageteststand"; fi
if [ -z $MAGENTO_DB_ALLOWSAME ]; then MAGENTO_DB_ALLOWSAME="0"; fi

echo
echo "---------------------"
echo "- Mothership local -"
echo "---------------------"
echo
echo "Installing ${MAGENTO_VERSION} in ${SOURCE_DIR}/htdocs"
echo "using Database Credentials:"
echo " Host: ${MAGENTO_DB_HOST}"
echo " Port: ${MAGENTO_DB_PORT}"
echo " User: ${MAGENTO_DB_USER}"
echo " Pass: [hidden]"
echo " Main DB: ${MAGENTO_DB_NAME}"
echo " Test DB: ${MAGENTO_DB_NAME}_test"
echo " Allow same db: ${MAGENTO_DB_ALLOWSAME}"
echo




cd ${BUILDENV}

# Download composer
composer self-update
bash < <(curl -s -L https://raw.github.com/colinmollenhour/modman/master/modman-installer)

cd ${BUILDENV}
wget http://files.magerun.net/n98-magerun-latest.phar
chmod +x ./n98-magerun-latest.phar


if [ ! -f htdocs/app/etc/local.xml ] ; then

# Create main database
MYSQLPASS=""
if [ ! -z $MAGENTO_DB_PASS ]; then MYSQLPASS="-p${MAGENTO_DB_PASS}"; fi
mysql -u${MAGENTO_DB_USER} ${MYSQLPASS} -h${MAGENTO_DB_HOST} -P${MAGENTO_DB_PORT} -e "DROP DATABASE IF EXISTS \`${MAGENTO_DB_NAME}\`; CREATE DATABASE \`${MAGENTO_DB_NAME}\`;"

./n98-magerun-latest.phar install \
--dbHost="${MAGENTO_DB_HOST}" --dbUser="${MAGENTO_DB_USER}" --dbPass="${MAGENTO_DB_PASS}" --dbName="${MAGENTO_DB_NAME}" --dbPort="${MAGENTO_DB_PORT}" \
--installSampleData=yes \
--useDefaultConfigParams=yes \
--magentoVersionByName="${MAGENTO_VERSION}" \
--installationFolder="${BUILDENV}/htdocs" \
--baseUrl="http://magento.local/" || { echo "Installing Magento failed"; exit 1; }
fi

# run composer update and install all requirements
composer self-update
composer install

# run modman and first debug
ls -lisah ${BUILDENV}
modman deploy-all --force

./n98-magerun-latest.phar --root-dir=htdocs config:set dev/template/allow_symlink 1
./n98-magerun-latest.phar --root-dir=htdocs sys:setup:run
./n98-magerun-latest.phar --root-dir=htdocs cache:flush

./n98-magerun-latest.phar cache:clean
./n98-magerun-latest.phar sys:module:list
export N98_MAGERUN_TEST_MAGENTO_ROOT=${BUILDENV}/htdocs


cd ${BUILDENV}/htdocs
ls -lisah ${BUILDENV}/htdocs

ls -lisah ${BUILDENV}/vendor/
cat ${BUILDENV}/vendor/autoload.php
cat ${BUILDENV}/vendor/composer/autoload_psr4.php

../vendor/phpunit/phpunit/phpunit --verbose --debug --config=phpunit.xml
20 changes: 14 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@
"require": {
"php": ">=5.4",
"magento-hackathon/magento-composer-installer": "*",
"symfony/yaml": "2.7",
"mothership/state_machine": ">=v1.0 <2.0",
"symfony/yaml": "~2.7",
"mothership/state_machine": "v1.1.*",
"firegento/psr0autoloader": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "~4.8",
"escapestudios/symfony2-coding-standard": "~2.0"
"escapestudios/symfony2-coding-standard": "~2.0",
"n98/magerun": "dev-master",
"composer/composer": "1.0.*@dev",
"aoepeople/composer-installers": "*"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.firegento.com"
"url": "https://packages.firegento.com/"
}
],
"authors": [
Expand All @@ -30,10 +33,15 @@
],
"autoload": {
"psr-4": {
"Mothership\\Magerun\\": "www/lib/Mothership/Magerun"
"Mothership\\Magerun\\": "htdocs/lib/Mothership/Magerun"
}
},
"autoload-dev": {
"psr-4": {
"Mothership\\Magerun\\Base\\": ["htdocs/lib/n98-magerun/modules/mothership_addons/src", "htdocs/tests/Mothership/Magerun/Base"]
}
},
"extra": {
"magento-root-dir": "root"
"magento-root-dir": "htdocs"
}
}
7 changes: 6 additions & 1 deletion modman
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
src/lib/n98-magerun/modules/mothership_addons lib/n98-magerun/modules/mothership_addons
src/app/etc/mothership/environments/environment_vm.php.example app/etc/mothership/environments/environment_vm.php.example

src/app/etc/mothership/workflows/Example.yaml app/etc/mothership/workflows/Example.yaml

src/app/etc/modules/Mothership_Addons.xml app/etc/modules/Mothership_Addons.xml
src/app/code/local/Mothership/Addons app/code/local/Mothership/Addons

src/media/feeds/readme.md media/feeds/readme.md
src/lib/Mothership/Magerun lib/Mothership/Magerun

src/shell/queue.php shell/queue.php
src/shell/queue.php shell/queue.php

tests tests
phpunit.xml.dist phpunit.xml
33 changes: 33 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<phpunit backupGlobals="true"
bootstrap="tests/bootstrap.php"
backupStaticAttributes="false"
cacheTokens="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
mapTestClassNameToCoveredClassName="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false">
<testsuites>
<testsuite name="n98-magerun-tests">
<directory>./tests</directory>
<exclude>tests/N98/Magento/Command/Installer/UninstallCommandTest.php</exclude>
</testsuite>
<testsuite name="n98-magerun-magento-uninstall-tests">
<file>./tests/N98/Magento/Command/Installer/UninstallCommandTest.php</file>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<file>tests/bootstrap.php</file>
</exclude>
</whitelist>
</filter>
</phpunit>
10 changes: 9 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#Mothership Magerun Addons

![](https://travis-ci.org/mothership-gmbh/magerun_mothership.svg?branch=develop)
![](https://travis-ci.org/mothership-gmbh/magerun_mothership.svg)


[![Dependency Status](https://www.versioneye.com/user/projects/56d70789d71695003e63118a/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56d70789d71695003e63118a)
[![Latest Stable Version](https://poser.pugx.org/mothership/mothership_magerun/v/stable)](https://packagist.org/packages/mothership/mothership_magerun)
[![Total Downloads](https://poser.pugx.org/mothership/mothership_magerun/downloads)](https://packagist.org/packages/mothership/mothership_magerun)
[![Latest Unstable Version](https://poser.pugx.org/mothership/mothership_magerun/v/unstable)](https://packagist.org/packages/mothership/mothership_magerun)
[![License](https://poser.pugx.org/mothership/mothership_magerun/license)](https://packagist.org/packages/mothership/mothership_magerun)

=========================
This repository contains a list of extensions, which might be useful for your development workflow.

Expand Down
Loading

0 comments on commit 5f17e60

Please sign in to comment.