FuelPHP 1.8-devでのComposerによるサブリポジトリの管理
FuelPHP 1.xのすべてのサブリポジトリの1.8/develop
ブランチ(今だと開発中の1.7.3)にcomposer.json
が追加されました。これにより、Composerによるサブリポジトリのインストールでrepositories
の指定にpackage
ではなくvcs
が使えるようになりました。
FuelPHP 1.xのコンポーネント(fuel/coreなど)は、Composerのrepositoriesの指定にpackageを使っているため、
composer update
しても最新の1.8/developブランチの状態には更新されません。
という制限はvcs
を使えば、今後はなくなります。
FuelPHP 1.8-devのインストール方法
開発版である1.8/develop
ブランチは次のようにインストールできます。
まず、普通にoilコマンドで最新の安定版(現在1.7.2)をインストールします。
$ oil create ProjectName
ブランチを1.7/master
から1.8/develop
に変更します。
$ cd ProjectName
$ git checkout -- composer.phar
$ git checkout 1.8/develop
composer.json
を変更します。リポジトリのタイプをvcs
に変更し、バージョンをdev-1.8/develop
にします。
--- a/composer.json
+++ b/composer.json
@@ -5,136 +5,24 @@
"keywords": ["application", "website", "development", "framework", "PHP"],
"license": "MIT",
"repositories": [
- {
- "type": "package",
- "package": {
- "name": "fuel/auth",
- "type": "fuel-package",
- "version": "1.7.2",
- "dist": {
- "url": "https://github.com/fuel/auth/archive/1.7/master.zip",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/fuel/auth.git",
- "type": "git",
- "reference": "1.8/develop"
- }
- }
- },
- {
- "type": "package",
- "package": {
- "name": "fuel/email",
- "type": "fuel-package",
- "version": "1.7.2",
- "dist": {
- "url": "https://github.com/fuel/email/archive/1.7/master.zip",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/fuel/email.git",
- "type": "git",
- "reference": "1.8/develop"
- }
- }
- },
- {
- "type": "package",
- "package": {
- "name": "fuel/oil",
- "type": "fuel-package",
- "version": "1.7.2",
- "dist": {
- "url": "https://github.com/fuel/oil/archive/1.7/master.zip",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/fuel/oil.git",
- "type": "git",
- "reference": "1.8/develop"
- }
- }
- },
- {
- "type": "package",
- "package": {
- "name": "fuel/orm",
- "type": "fuel-package",
- "version": "1.7.2",
- "dist": {
- "url": "https://github.com/fuel/orm/archive/1.7/master.zip",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/fuel/orm.git",
- "type": "git",
- "reference": "1.8/develop"
- }
- }
- },
- {
- "type": "package",
- "package": {
- "name": "fuel/parser",
- "type": "fuel-package",
- "version": "1.7.2",
- "dist": {
- "url": "https://github.com/fuel/parser/archive/1.7/master.zip",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/fuel/parser.git",
- "type": "git",
- "reference": "1.8/develop"
- }
- }
- },
- "type": "package",
- "package": {
- "name": "fuel/core",
- "type": "fuel-package",
- "version": "1.7.2",
- "dist": {
- "url": "https://github.com/fuel/core/archive/1.7/master.zip",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/fuel/core.git",
- "type": "git",
- "reference": "1.8/develop"
- }
- }
- },
- {
- "type": "package",
- "package": {
- "name": "fuel/docs",
- "type": "fuel-package",
- "version": "1.7.2",
- "dist": {
- "url": "https://github.com/fuel/docs/archive/1.7/master.zip",
- "type": "zip"
- },
- "source": {
- "url": "https://github.com/fuel/docs.git",
- "type": "git",
- "reference": "1.8/develop"
- }
- }
- }
+ { "type": "vcs", "url": "https://github.com/fuel/docs" },
+ { "type": "vcs", "url": "https://github.com/fuel/core" },
+ { "type": "vcs", "url": "https://github.com/fuel/auth" },
+ { "type": "vcs", "url": "https://github.com/fuel/email" },
+ { "type": "vcs", "url": "https://github.com/fuel/oil" },
+ { "type": "vcs", "url": "https://github.com/fuel/orm" },
+ { "type": "vcs", "url": "https://github.com/fuel/parser" }
],
"require": {
"php": ">=5.3.3",
"composer/installers": "~1.0",
- "fuel/docs": "1.7.2",
- "fuel/core": "1.7.2",
- "fuel/auth": "1.7.2",
- "fuel/email": "1.7.2",
- "fuel/oil": "1.7.2",
- "fuel/orm": "1.7.2",
- "fuel/parser": "1.7.2",
+ "fuel/docs": "dev-1.8/develop",
+ "fuel/core": "dev-1.8/develop",
+ "fuel/auth": "dev-1.8/develop",
+ "fuel/email": "dev-1.8/develop",
+ "fuel/oil": "dev-1.8/develop",
+ "fuel/orm": "dev-1.8/develop",
+ "fuel/parser": "dev-1.8/develop",
"fuelphp/upload": "2.0.2",
"monolog/monolog": "1.5.*",
"michelf/php-markdown": "1.4.0"
composer update
し依存パッケージを更新します。すべてのサブリポジトリを検索してパッケージ情報(composer.json)を探すため、初回は時間がかかります。
$ php composer.phar self-update
$ php composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing fuel/docs (1.7.2)
- Installing fuel/docs (dev-1.8/develop df2fa8b)
Cloning df2fa8bd5cbc65fcf6790ef3bfc2ff64b99a815b
- Removing fuel/core (1.7.2)
- Installing fuel/core (dev-1.8/develop c8ab9e4)
Cloning c8ab9e400baec13e17b0e05231a7759b63bee0fd
- Removing fuel/auth (1.7.2)
- Installing fuel/auth (dev-1.8/develop dc37500)
Cloning dc37500465c03cbb099188b0a0a9c2f0c06a4b05
- Removing fuel/email (1.7.2)
- Installing fuel/email (dev-1.8/develop ba3066f)
Cloning ba3066f2e5fe131bf8db7e5768fd5b8b9d945bcc
- Removing fuel/oil (1.7.2)
- Installing fuel/oil (dev-1.8/develop 7ce5d42)
Cloning 7ce5d4208fbf3816cb4da5b4ff7edb895ae56d23
- Removing fuel/orm (1.7.2)
- Installing fuel/orm (dev-1.8/develop 4a0de02)
Cloning 4a0de020038f4512d1c6217c24dab081d542f998
- Removing fuel/parser (1.7.2)
- Installing fuel/parser (dev-1.8/develop 2ebc953)
Cloning 2ebc95388d02b54933eade00d7155feb72193f25
- Removing fuelphp/upload (2.0.1)
- Installing fuelphp/upload (2.0.2)
Loading from cache
Writing lock file
Generating autoload files
これで、サブリポジトリがすべて1.8/develop
になりました。
今後は、composer update
コマンドを実行すれば、最新の1.8/develop
になります。
なお、1.7/master
以前にはcomposer.json
が存在しないため、この状態のcomposer.json
のversionを変更してもうまく動作しないことに注意してください。
この方法が使えるのは、1.8/develop
あるいは1.7.3がリリースされた後の1.7/master
ということになります。
関連
Date: 2015/01/13