Skip to content

Commit 5db78bf

Browse files
committed
feat: Add builds next option
1 parent 046fddf commit 5db78bf

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

admin/starter/builds

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env php
22
<?php
33

4-
define('LATEST_RELEASE', '^4.0');
4+
define('LATEST_RELEASE', '^4.7');
5+
define('DEVELOP_BRANCH', 'dev-develop');
6+
define('NEXT_MINOR', '^4.8-dev');
57
define('GITHUB_URL', 'https://github.com/codeigniter4/codeigniter4');
68

79
/*
@@ -11,18 +13,18 @@ define('GITHUB_URL', 'https://github.com/codeigniter4/codeigniter4');
1113
* Use this script to toggle the CodeIgniter dependency between the
1214
* latest stable release and the most recent development update.
1315
*
14-
* Usage: php builds [release|development]
16+
* Usage: php builds [release|development|next]
1517
*/
1618

19+
$branch = $argv[1] ?? '';
20+
1721
// Determine the requested stability
18-
if (empty($argv[1]) || ! in_array($argv[1], ['release', 'development'], true)) {
19-
echo 'Usage: php builds [release|development]' . PHP_EOL;
22+
if ($branch === '' || ! in_array($branch, ['release', 'development', 'next'], true)) {
23+
echo 'Usage: php builds [release|development|next]' . PHP_EOL;
2024

2125
exit;
2226
}
2327

24-
$dev = $argv[1] === 'development';
25-
2628
$modified = [];
2729

2830
// Locate each file and update it for the requested stability
@@ -36,7 +38,7 @@ if (is_file($file)) {
3638
$array = json_decode($contents, true);
3739

3840
if (is_array($array)) {
39-
if ($dev) {
41+
if ($branch !== 'release') {
4042
$array['minimum-stability'] = 'dev';
4143
$array['prefer-stable'] = true;
4244
$array['repositories'] ??= [];
@@ -57,7 +59,7 @@ if (is_file($file)) {
5759
];
5860
}
5961

60-
$array['require']['codeigniter4/codeigniter4'] = 'dev-develop';
62+
$array['require']['codeigniter4/codeigniter4'] = $branch === 'next' ? NEXT_MINOR : DEVELOP_BRANCH;
6163
unset($array['require']['codeigniter4/framework']);
6264
} else {
6365
unset($array['minimum-stability']);
@@ -70,7 +72,7 @@ if (is_file($file)) {
7072
}
7173
}
7274

73-
if (empty($array['repositories'])) {
75+
if ($array['repositories'] === []) {
7476
unset($array['repositories']);
7577
}
7678
}
@@ -100,7 +102,7 @@ foreach ($files as $file) {
100102
if (is_file($file)) {
101103
$contents = file_get_contents($file);
102104

103-
if ($dev) {
105+
if ($branch !== 'release') {
104106
$contents = str_replace('vendor/codeigniter4/framework', 'vendor/codeigniter4/codeigniter4', $contents);
105107
} else {
106108
$contents = str_replace('vendor/codeigniter4/codeigniter4', 'vendor/codeigniter4/framework', $contents);
@@ -120,6 +122,7 @@ if ($modified === []) {
120122
foreach ($modified as $file) {
121123
echo " * {$file}" . PHP_EOL;
122124
}
123-
124-
echo 'Run `composer update` to sync changes with your vendor folder.' . PHP_EOL;
125125
}
126+
127+
echo 'Run `composer update` to sync changes with your vendor folder.' . PHP_EOL;
128+
echo 'Don\'t forget to update the project files in app folder from "vendor/codeigniter4/*/app/".' . PHP_EOL;

user_guide_src/source/changelogs/v4.7.1.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ Message Changes
2424
Changes
2525
*******
2626

27+
Others
28+
======
29+
30+
- **builds:** In the ``builds`` script (for ``codeigniter4/appstarter``), the ``next`` option has been added
31+
to switch ``4.7.x`` to the next minor version ``4.8-dev``. See :ref:`Latest Dev<switch-to-dev-version>`.
32+
2733
************
2834
Deprecations
2935
************

user_guide_src/source/installation/installing_composer.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ Folders in your project after set up:
158158
- app, public, tests, writable
159159
- vendor/codeigniter4/framework/system
160160

161+
.. _switch-to-dev-version:
162+
161163
Latest Dev
162164
----------
163165

@@ -169,6 +171,9 @@ The `development user guide <https://codeigniter4.github.io/CodeIgniter4/>`_ is
169171
Note that this differs from the released user guide, and will pertain to the
170172
develop branch explicitly.
171173

174+
.. note:: You should not rely on the version of the framework in your project
175+
- the development code may contain an incorrect number.
176+
172177
Update for Latest Dev
173178
^^^^^^^^^^^^^^^^^^^^^
174179

@@ -188,15 +193,11 @@ files if necessary.
188193
Next Minor Version
189194
^^^^^^^^^^^^^^^^^^
190195

191-
If you want to use the next minor version branch, after using the ``builds`` command
192-
edit **composer.json** manually.
196+
If you want to use the next minor version branch:
193197

194-
If you try the ``4.8`` branch, change the version to ``4.8.x-dev``::
198+
.. code-block:: console
195199
196-
"require": {
197-
"php": "^8.2",
198-
"codeigniter4/codeigniter4": "4.8.x-dev"
199-
},
200+
php builds next
200201
201202
And run ``composer update`` to sync your vendor
202203
folder with the latest target build. Then, check the Upgrading Guide

0 commit comments

Comments
 (0)