@@ -61,39 +61,10 @@ public function __construct(
61
61
$ this ->webDir = $ webDir ;
62
62
}
63
63
64
- /**
65
- * Dump a set of packages to the web root
66
- *
67
- * @param list<int> $packageIds
68
- */
69
- public function dump (array $ packageIds , bool $ force = false , bool $ verbose = false ): void
64
+ public function dumpRoot (bool $ verbose = false ): void
70
65
{
71
- // prepare build dir
72
- $ webDir = $ this ->webDir ;
73
-
74
- $ buildDirV2 = $ this ->buildDir .'/p2 ' ;
75
-
76
- // initialize
77
- $ initialRun = false ;
78
- if (!is_dir ($ buildDirV2 )) {
79
- $ initialRun = true ;
80
- $ this ->filesystem ->mkdir ($ buildDirV2 );
81
- }
82
- $ buildDirV2 = realpath ($ buildDirV2 );
83
- Assert::string ($ buildDirV2 );
84
-
85
- // copy existing stuff for smooth BC transition
86
- if ($ initialRun && !$ force ) {
87
- throw new \RuntimeException ('Run this again with --force the first time around to make sure it dumps all packages ' );
88
- }
89
-
90
- if ($ verbose ) {
91
- echo 'Web dir is ' .$ webDir .'/p2 ( ' .realpath ($ webDir .'/p2 ' ).') ' .PHP_EOL ;
92
- echo 'Build v2 dir is ' .$ buildDirV2 .PHP_EOL ;
93
- }
94
-
95
66
// prepare root file
96
- $ rootFile = $ webDir .'/packages.json ' ;
67
+ $ rootFile = $ this -> webDir .'/packages.json ' ;
97
68
$ rootFileContents = [
98
69
'packages ' => []
99
70
];
@@ -138,6 +109,38 @@ public function dump(array $packageIds, bool $force = false, bool $verbose = fal
138
109
echo 'Dumping root ' .PHP_EOL ;
139
110
}
140
111
$ this ->dumpRootFile ($ rootFile , json_encode ($ rootFileContents , JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR ));
112
+ }
113
+
114
+ /**
115
+ * Dump a set of packages to the web root
116
+ *
117
+ * @param list<int> $packageIds
118
+ */
119
+ public function dump (array $ packageIds , bool $ force = false , bool $ verbose = false ): void
120
+ {
121
+ // prepare build dir
122
+ $ webDir = $ this ->webDir ;
123
+
124
+ $ buildDirV2 = $ this ->buildDir .'/p2 ' ;
125
+
126
+ // initialize
127
+ $ initialRun = false ;
128
+ if (!is_dir ($ buildDirV2 )) {
129
+ $ initialRun = true ;
130
+ $ this ->filesystem ->mkdir ($ buildDirV2 );
131
+ }
132
+ $ buildDirV2 = realpath ($ buildDirV2 );
133
+ Assert::string ($ buildDirV2 );
134
+
135
+ // copy existing stuff for smooth BC transition
136
+ if ($ initialRun && !$ force ) {
137
+ throw new \RuntimeException ('Run this again with --force the first time around to make sure it dumps all packages ' );
138
+ }
139
+
140
+ if ($ verbose ) {
141
+ echo 'Web dir is ' .$ webDir .'/p2 ( ' .realpath ($ webDir .'/p2 ' ).') ' .PHP_EOL ;
142
+ echo 'Build v2 dir is ' .$ buildDirV2 .PHP_EOL ;
143
+ }
141
144
142
145
$ dumpTimeUpdates = [];
143
146
0 commit comments