Last active
December 25, 2015 18:49
-
-
Save nojimage/7022740 to your computer and use it in GitHub Desktop.
ComposerでインストールしたCakePHPからプロジェクトを生成して、CAKE_CORE_INCLUDE_PATHの相対パス化とautoloaderの読込み。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
Vendor/bin/cake bake project --empty -v app | |
# replace include_path | |
replace="s/define('CAKE_CORE_INCLUDE_PATH',.*$/define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib');/" | |
sed -i .orig -e "$replace" app/webroot/index.php app/webroot/test.php | |
## # replace console path, if CakePHP < 2.5 | |
## replace="s/ini_set('include_path',.*$/ini_set('include_path', \$root . PATH_SEPARATOR . \$root . \$ds . 'Vendor' . \$ds . 'cakephp' . \$ds . 'cakephp' . \$ds . 'lib' . PATH_SEPARATOR . ini_get('include_path'));/" | |
## | |
## sed -i .orig -e "$replace" app/Console/cake.php | |
# load composer autoloader in bootstrap.php | |
cat <<EOT >> app/Config/bootstrap.php | |
// Load composer autoload. | |
require ROOT . '/Vendor/autoload.php'; | |
// Remove and re-prepend CakePHP's autoloader as composer thinks it is the most important. | |
// See https://github.com/composer/composer/commit/c80cb76b9b5082ecc3e5b53b1050f76bb27b127b | |
spl_autoload_unregister(array('App', 'load')); | |
spl_autoload_register(array('App', 'load'), true, true); | |
EOT | |
# set permission | |
chmod -R o+w app/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "your_vendor/your_project", | |
"require": { | |
"cakephp/cakephp": "~2.6.1", | |
"composer/installers": "*", | |
"cakephp/debug_kit": "2.2.*", | |
"cakedc/migrations": "*", | |
"cakedc/search": "*", | |
"cakedc/utils": "*", | |
"cakedc/users": "*" | |
}, | |
"require-dev": { | |
"phpunit/phpunit": "~3.7" | |
}, | |
"config": { | |
"vendor-dir": "Vendor/" | |
}, | |
"extra": { | |
"installer-paths": { | |
"plugins/{$name}/": ["type:cakephp-plugin"] | |
} | |
} | |
} |
CakePHPの本体がPackagistに登録されたのでパス等々の修正
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
consoleスクリプトのパスを書き換え忘れてた。