Skip to content

Commit 6633cc0

Browse files
authored
Merge pull request #1358 from phalcon/feature/#1248-box-3-upgrade
#1248 - Box 3 upgrade
2 parents e42a73c + 3e579f0 commit 6633cc0

File tree

6 files changed

+104
-38
lines changed

6 files changed

+104
-38
lines changed

.ci/build-phar.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
#
3+
# This file is part of the Phalcon Framework.
4+
#
5+
# (c) Phalcon Team <[email protected]>
6+
#
7+
# For the full copyright and license information, please view the
8+
# LICENSE.txt file that was distributed with this source code.
9+
10+
set -eu
11+
12+
if [ "$(command -v box 2>/dev/null || true)" = "" ]; then
13+
(>&2 printf "To use this script you need to install humbug/box: %s \\n" \
14+
"https://github.com/humbug/box")
15+
(>&2 echo "Aborting.")
16+
exit 1
17+
fi
18+
19+
box validate
20+
box compile
21+
22+
if [ ! -f "./phalcon.phar" ] || [ ! -x "./phalcon.phar" ]; then
23+
(>&2 echo "Something went wrong when building zephir.phar")
24+
(>&2 echo "Aborting.")
25+
exit 1
26+
fi

.ci/install-box.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This file is part of the Phalcon Framework.
4+
#
5+
# (c) Phalcon Team <[email protected]>
6+
#
7+
# For the full copyright and license information, please view the
8+
# LICENSE.txt file that was distributed with this source code.
9+
10+
set -e
11+
12+
: "${BOX_VERSION:=3.8.3}"
13+
14+
wget "https://github.com/humbug/box/releases/download/${BOX_VERSION}/box.phar" \
15+
--quiet \
16+
-O "${HOME}/bin/box"
17+
18+
chmod +x "${HOME}/bin/box"
19+
box --version

.travis.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ services:
77
matrix:
88
include:
99
- php: 7.2
10-
env: ZEND_BACKEND="--backend=ZendEngine3"
10+
env:
11+
- BUILD_PHAR=1
12+
- ZEND_BACKEND="--backend=ZendEngine3"
1113
- php: 7.3
12-
env: ZEND_BACKEND="--backend=ZendEngine3"
14+
env:
15+
- BUILD_PHAR=0
16+
- ZEND_BACKEND="--backend=ZendEngine3"
1317

1418
git:
1519
depth: 1
@@ -27,13 +31,15 @@ cache:
2731

2832
env:
2933
global:
34+
- BUILD_PHAR=1
3035
- PATH="$PATH:~/bin"
3136
- DISPLAY=":99.0"
37+
- PHAR_PHP_VERSION=7.2.23
38+
- BOX_VERSION=3.8.3
3239
- PHALCON_VERSION=v4.0.0-rc.2
3340

3441
before_install:
3542
- export PHP_VERSION=$(php-config --version)
36-
- export PHP_MAJOR="$(echo $TRAVIS_PHP_VERSION | cut -d '.' -f 1)"
3743
- export PHP_EXTENSION_DIR=$(php-config --extension-dir)
3844
- source $TRAVIS_BUILD_DIR/tests/_ci/environment
3945
- export $(cut -d= -f1 $TRAVIS_BUILD_DIR/tests/_ci/environment)
@@ -44,6 +50,14 @@ before_install:
4450
install:
4551
- pecl install --force psr
4652
- .ci/install-phalcon.sh
53+
- |
54+
if [ "$BUILD_PHAR" -eq 1 ]
55+
then
56+
echo "Build Phalcon DevTools PHAR"
57+
composer config platform.php $PHAR_PHP_VERSION
58+
.ci/install-box.sh
59+
.ci/build-phar.sh
60+
fi
4761
4862
before_script:
4963
- travis_retry composer install --no-interaction --no-ansi --no-progress --no-suggest
@@ -59,3 +73,13 @@ script:
5973
- vendor/bin/codecept run console -v
6074
- vendor/bin/psalm --show-info=false
6175
- vendor/bin/phpstan analyse -l 5 -c phpstan.neon src -v
76+
77+
deploy:
78+
provider: releases
79+
api_key: $GITHUB_TOKEN
80+
file: phalcon.phar
81+
skip_cleanup: true
82+
on:
83+
php: '7.2'
84+
tags: true
85+
repo: phalcon/phalcon-devtools

bootstrap/autoload.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
/**
3838
* Check for old versions
3939
*/
40-
if (rtrim(strtolower(realpath(PTOOLSPATH)), '\\/') !== rtrim(strtolower(realpath(dirname(dirname(__FILE__)))), '\\/')) {
40+
$currentPath = realpath(dirname(dirname(__FILE__)));
41+
if ($currentPath !== false && rtrim(strtolower(realpath(PTOOLSPATH)), '\\/') !== rtrim(strtolower($currentPath), '\\/')) {
4142
throw new Exception(
4243
sprintf(
4344
'The environment variable PTOOLSPATH is outdated! Current value: %s. New value: %s',

box.json

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
11
{
2-
"main": "phalcon",
3-
"output": "phalcon.phar",
4-
"chmod": "0755",
5-
"directories": [
6-
"bootstrap",
7-
"resources",
8-
"src",
9-
"templates"
10-
],
11-
"files": [
12-
"webtools.php",
13-
"LICENSE.txt"
14-
],
15-
"finder": [
16-
{
17-
"in": "resources",
18-
"name": "*.*"
19-
},
20-
{
21-
"in": "src",
22-
"name": "*.*"
23-
},
24-
{
25-
"in": "templates",
26-
"ignoreDotFiles": false,
27-
"name": [
28-
"*.*",
29-
".htrouter.php"
30-
]
31-
}
32-
],
33-
"git-version": "git_tag",
34-
"stub": true
2+
"directories": [
3+
"bootstrap",
4+
"resources",
5+
"src",
6+
"templates"
7+
],
8+
"files": [
9+
"webtools.php",
10+
"LICENSE.txt"
11+
],
12+
"finder": [
13+
{
14+
"in": "resources",
15+
"name": "*.*"
16+
},
17+
{
18+
"in": "src",
19+
"name": "*.*"
20+
},
21+
{
22+
"in": "templates",
23+
"ignoreDotFiles": false,
24+
"name": [
25+
"*.*",
26+
".htrouter.php"
27+
]
28+
}
29+
],
30+
"git-version": "git_tag"
3531
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"phalcon/migrations": "^1.0"
3232
},
3333
"require-dev": {
34-
"kherge/box": "^2.7",
34+
"humbug/box": "^3.8",
3535
"codeception/codeception": "^3.1",
3636
"phpdocumentor/reflection-docblock": "^4.3",
3737
"phpunit/phpunit": "^8.0",

0 commit comments

Comments
 (0)