├── .gitignore
├── LICENSE
├── composer.json
├── composer.lock
├── run
└── src
├── DiffRecipeVersionsCommand.php
├── GenerateArchivedRecipesCommand.php
├── GenerateFlexEndpointCommand.php
├── GenerateRecipesReadmeCommand.php
├── LintManifestsCommand.php
├── LintPackagesCommand.php
├── LintPullRequestCommand.php
├── LintYamlCommand.php
└── ListUnpatchedPackagesCommand.php
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published by
637 | the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "symfony-tools/recipes-checker",
3 | "type": "project",
4 | "license": "MIT",
5 | "authors": [
6 | {
7 | "name": "Fabien Potencier",
8 | "email": "fabien@symfony.com"
9 | },
10 | {
11 | "name": "Nicolas Grekas",
12 | "email": "p@tchwork.com"
13 | }
14 | ],
15 | "require": {
16 | "php": ">=8",
17 | "ext-ctype": "*",
18 | "ext-intl": "*",
19 | "ext-mbstring": "*",
20 | "symfony/console": "^5.4",
21 | "symfony/filesystem": "^5.4",
22 | "symfony/http-client": "^5.4",
23 | "symfony/process": "^5.4",
24 | "symfony/runtime": "^5.4",
25 | "symfony/yaml": "^5.4"
26 | },
27 | "require-dev": {
28 | "symfony/var-dumper": "^5.3"
29 | },
30 | "replace": {
31 | "symfony/polyfill-ctype": "*",
32 | "symfony/polyfill-intl-grapheme": "*",
33 | "symfony/polyfill-intl-normalizer": "*",
34 | "symfony/polyfill-mbstring": "*",
35 | "symfony/polyfill-php73": "*",
36 | "symfony/polyfill-php80": "*"
37 | },
38 | "autoload": {
39 | "psr-4": {
40 | "App\\": "src/"
41 | }
42 | },
43 | "config": {
44 | "allow-plugins": {
45 | "symfony/runtime": true
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/composer.lock:
--------------------------------------------------------------------------------
1 | {
2 | "_readme": [
3 | "This file locks the dependencies of your project to a known state",
4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 | "This file is @generated automatically"
6 | ],
7 | "content-hash": "b25ce32c7d6e71b918aac859e08fcd3d",
8 | "packages": [
9 | {
10 | "name": "psr/container",
11 | "version": "2.0.2",
12 | "source": {
13 | "type": "git",
14 | "url": "https://github.com/php-fig/container.git",
15 | "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
16 | },
17 | "dist": {
18 | "type": "zip",
19 | "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
20 | "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
21 | "shasum": ""
22 | },
23 | "require": {
24 | "php": ">=7.4.0"
25 | },
26 | "type": "library",
27 | "extra": {
28 | "branch-alias": {
29 | "dev-master": "2.0.x-dev"
30 | }
31 | },
32 | "autoload": {
33 | "psr-4": {
34 | "Psr\\Container\\": "src/"
35 | }
36 | },
37 | "notification-url": "https://packagist.org/downloads/",
38 | "license": [
39 | "MIT"
40 | ],
41 | "authors": [
42 | {
43 | "name": "PHP-FIG",
44 | "homepage": "https://www.php-fig.org/"
45 | }
46 | ],
47 | "description": "Common Container Interface (PHP FIG PSR-11)",
48 | "homepage": "https://github.com/php-fig/container",
49 | "keywords": [
50 | "PSR-11",
51 | "container",
52 | "container-interface",
53 | "container-interop",
54 | "psr"
55 | ],
56 | "support": {
57 | "issues": "https://github.com/php-fig/container/issues",
58 | "source": "https://github.com/php-fig/container/tree/2.0.2"
59 | },
60 | "time": "2021-11-05T16:47:00+00:00"
61 | },
62 | {
63 | "name": "psr/log",
64 | "version": "2.0.0",
65 | "source": {
66 | "type": "git",
67 | "url": "https://github.com/php-fig/log.git",
68 | "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
69 | },
70 | "dist": {
71 | "type": "zip",
72 | "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
73 | "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
74 | "shasum": ""
75 | },
76 | "require": {
77 | "php": ">=8.0.0"
78 | },
79 | "type": "library",
80 | "extra": {
81 | "branch-alias": {
82 | "dev-master": "2.0.x-dev"
83 | }
84 | },
85 | "autoload": {
86 | "psr-4": {
87 | "Psr\\Log\\": "src"
88 | }
89 | },
90 | "notification-url": "https://packagist.org/downloads/",
91 | "license": [
92 | "MIT"
93 | ],
94 | "authors": [
95 | {
96 | "name": "PHP-FIG",
97 | "homepage": "https://www.php-fig.org/"
98 | }
99 | ],
100 | "description": "Common interface for logging libraries",
101 | "homepage": "https://github.com/php-fig/log",
102 | "keywords": [
103 | "log",
104 | "psr",
105 | "psr-3"
106 | ],
107 | "support": {
108 | "source": "https://github.com/php-fig/log/tree/2.0.0"
109 | },
110 | "time": "2021-07-14T16:41:46+00:00"
111 | },
112 | {
113 | "name": "symfony/console",
114 | "version": "v5.4.1",
115 | "source": {
116 | "type": "git",
117 | "url": "https://github.com/symfony/console.git",
118 | "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4"
119 | },
120 | "dist": {
121 | "type": "zip",
122 | "url": "https://api.github.com/repos/symfony/console/zipball/9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4",
123 | "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4",
124 | "shasum": ""
125 | },
126 | "require": {
127 | "php": ">=7.2.5",
128 | "symfony/deprecation-contracts": "^2.1|^3",
129 | "symfony/polyfill-mbstring": "~1.0",
130 | "symfony/polyfill-php73": "^1.9",
131 | "symfony/polyfill-php80": "^1.16",
132 | "symfony/service-contracts": "^1.1|^2|^3",
133 | "symfony/string": "^5.1|^6.0"
134 | },
135 | "conflict": {
136 | "psr/log": ">=3",
137 | "symfony/dependency-injection": "<4.4",
138 | "symfony/dotenv": "<5.1",
139 | "symfony/event-dispatcher": "<4.4",
140 | "symfony/lock": "<4.4",
141 | "symfony/process": "<4.4"
142 | },
143 | "provide": {
144 | "psr/log-implementation": "1.0|2.0"
145 | },
146 | "require-dev": {
147 | "psr/log": "^1|^2",
148 | "symfony/config": "^4.4|^5.0|^6.0",
149 | "symfony/dependency-injection": "^4.4|^5.0|^6.0",
150 | "symfony/event-dispatcher": "^4.4|^5.0|^6.0",
151 | "symfony/lock": "^4.4|^5.0|^6.0",
152 | "symfony/process": "^4.4|^5.0|^6.0",
153 | "symfony/var-dumper": "^4.4|^5.0|^6.0"
154 | },
155 | "suggest": {
156 | "psr/log": "For using the console logger",
157 | "symfony/event-dispatcher": "",
158 | "symfony/lock": "",
159 | "symfony/process": ""
160 | },
161 | "type": "library",
162 | "autoload": {
163 | "psr-4": {
164 | "Symfony\\Component\\Console\\": ""
165 | },
166 | "exclude-from-classmap": [
167 | "/Tests/"
168 | ]
169 | },
170 | "notification-url": "https://packagist.org/downloads/",
171 | "license": [
172 | "MIT"
173 | ],
174 | "authors": [
175 | {
176 | "name": "Fabien Potencier",
177 | "email": "fabien@symfony.com"
178 | },
179 | {
180 | "name": "Symfony Community",
181 | "homepage": "https://symfony.com/contributors"
182 | }
183 | ],
184 | "description": "Eases the creation of beautiful and testable command line interfaces",
185 | "homepage": "https://symfony.com",
186 | "keywords": [
187 | "cli",
188 | "command line",
189 | "console",
190 | "terminal"
191 | ],
192 | "support": {
193 | "source": "https://github.com/symfony/console/tree/v5.4.1"
194 | },
195 | "funding": [
196 | {
197 | "url": "https://symfony.com/sponsor",
198 | "type": "custom"
199 | },
200 | {
201 | "url": "https://github.com/fabpot",
202 | "type": "github"
203 | },
204 | {
205 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
206 | "type": "tidelift"
207 | }
208 | ],
209 | "time": "2021-12-09T11:22:43+00:00"
210 | },
211 | {
212 | "name": "symfony/deprecation-contracts",
213 | "version": "v3.0.0",
214 | "source": {
215 | "type": "git",
216 | "url": "https://github.com/symfony/deprecation-contracts.git",
217 | "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced"
218 | },
219 | "dist": {
220 | "type": "zip",
221 | "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced",
222 | "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced",
223 | "shasum": ""
224 | },
225 | "require": {
226 | "php": ">=8.0.2"
227 | },
228 | "type": "library",
229 | "extra": {
230 | "branch-alias": {
231 | "dev-main": "3.0-dev"
232 | },
233 | "thanks": {
234 | "name": "symfony/contracts",
235 | "url": "https://github.com/symfony/contracts"
236 | }
237 | },
238 | "autoload": {
239 | "files": [
240 | "function.php"
241 | ]
242 | },
243 | "notification-url": "https://packagist.org/downloads/",
244 | "license": [
245 | "MIT"
246 | ],
247 | "authors": [
248 | {
249 | "name": "Nicolas Grekas",
250 | "email": "p@tchwork.com"
251 | },
252 | {
253 | "name": "Symfony Community",
254 | "homepage": "https://symfony.com/contributors"
255 | }
256 | ],
257 | "description": "A generic function and convention to trigger deprecation notices",
258 | "homepage": "https://symfony.com",
259 | "support": {
260 | "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0"
261 | },
262 | "funding": [
263 | {
264 | "url": "https://symfony.com/sponsor",
265 | "type": "custom"
266 | },
267 | {
268 | "url": "https://github.com/fabpot",
269 | "type": "github"
270 | },
271 | {
272 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
273 | "type": "tidelift"
274 | }
275 | ],
276 | "time": "2021-11-01T23:48:49+00:00"
277 | },
278 | {
279 | "name": "symfony/filesystem",
280 | "version": "v5.4.0",
281 | "source": {
282 | "type": "git",
283 | "url": "https://github.com/symfony/filesystem.git",
284 | "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01"
285 | },
286 | "dist": {
287 | "type": "zip",
288 | "url": "https://api.github.com/repos/symfony/filesystem/zipball/731f917dc31edcffec2c6a777f3698c33bea8f01",
289 | "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01",
290 | "shasum": ""
291 | },
292 | "require": {
293 | "php": ">=7.2.5",
294 | "symfony/polyfill-ctype": "~1.8",
295 | "symfony/polyfill-mbstring": "~1.8",
296 | "symfony/polyfill-php80": "^1.16"
297 | },
298 | "type": "library",
299 | "autoload": {
300 | "psr-4": {
301 | "Symfony\\Component\\Filesystem\\": ""
302 | },
303 | "exclude-from-classmap": [
304 | "/Tests/"
305 | ]
306 | },
307 | "notification-url": "https://packagist.org/downloads/",
308 | "license": [
309 | "MIT"
310 | ],
311 | "authors": [
312 | {
313 | "name": "Fabien Potencier",
314 | "email": "fabien@symfony.com"
315 | },
316 | {
317 | "name": "Symfony Community",
318 | "homepage": "https://symfony.com/contributors"
319 | }
320 | ],
321 | "description": "Provides basic utilities for the filesystem",
322 | "homepage": "https://symfony.com",
323 | "support": {
324 | "source": "https://github.com/symfony/filesystem/tree/v5.4.0"
325 | },
326 | "funding": [
327 | {
328 | "url": "https://symfony.com/sponsor",
329 | "type": "custom"
330 | },
331 | {
332 | "url": "https://github.com/fabpot",
333 | "type": "github"
334 | },
335 | {
336 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
337 | "type": "tidelift"
338 | }
339 | ],
340 | "time": "2021-10-28T13:39:27+00:00"
341 | },
342 | {
343 | "name": "symfony/finder",
344 | "version": "v5.4.0",
345 | "source": {
346 | "type": "git",
347 | "url": "https://github.com/symfony/finder.git",
348 | "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590"
349 | },
350 | "dist": {
351 | "type": "zip",
352 | "url": "https://api.github.com/repos/symfony/finder/zipball/d2f29dac98e96a98be467627bd49c2efb1bc2590",
353 | "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590",
354 | "shasum": ""
355 | },
356 | "require": {
357 | "php": ">=7.2.5",
358 | "symfony/deprecation-contracts": "^2.1|^3",
359 | "symfony/polyfill-php80": "^1.16"
360 | },
361 | "type": "library",
362 | "autoload": {
363 | "psr-4": {
364 | "Symfony\\Component\\Finder\\": ""
365 | },
366 | "exclude-from-classmap": [
367 | "/Tests/"
368 | ]
369 | },
370 | "notification-url": "https://packagist.org/downloads/",
371 | "license": [
372 | "MIT"
373 | ],
374 | "authors": [
375 | {
376 | "name": "Fabien Potencier",
377 | "email": "fabien@symfony.com"
378 | },
379 | {
380 | "name": "Symfony Community",
381 | "homepage": "https://symfony.com/contributors"
382 | }
383 | ],
384 | "description": "Finds files and directories via an intuitive fluent interface",
385 | "homepage": "https://symfony.com",
386 | "support": {
387 | "source": "https://github.com/symfony/finder/tree/v5.4.0"
388 | },
389 | "funding": [
390 | {
391 | "url": "https://symfony.com/sponsor",
392 | "type": "custom"
393 | },
394 | {
395 | "url": "https://github.com/fabpot",
396 | "type": "github"
397 | },
398 | {
399 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
400 | "type": "tidelift"
401 | }
402 | ],
403 | "time": "2021-11-28T15:25:38+00:00"
404 | },
405 | {
406 | "name": "symfony/http-client",
407 | "version": "v5.4.1",
408 | "source": {
409 | "type": "git",
410 | "url": "https://github.com/symfony/http-client.git",
411 | "reference": "78b69fc4532253f3025db7f2429d8765e506cbf2"
412 | },
413 | "dist": {
414 | "type": "zip",
415 | "url": "https://api.github.com/repos/symfony/http-client/zipball/78b69fc4532253f3025db7f2429d8765e506cbf2",
416 | "reference": "78b69fc4532253f3025db7f2429d8765e506cbf2",
417 | "shasum": ""
418 | },
419 | "require": {
420 | "php": ">=7.2.5",
421 | "psr/log": "^1|^2|^3",
422 | "symfony/deprecation-contracts": "^2.1|^3",
423 | "symfony/http-client-contracts": "^2.4",
424 | "symfony/polyfill-php73": "^1.11",
425 | "symfony/polyfill-php80": "^1.16",
426 | "symfony/service-contracts": "^1.0|^2|^3"
427 | },
428 | "provide": {
429 | "php-http/async-client-implementation": "*",
430 | "php-http/client-implementation": "*",
431 | "psr/http-client-implementation": "1.0",
432 | "symfony/http-client-implementation": "2.4"
433 | },
434 | "require-dev": {
435 | "amphp/amp": "^2.5",
436 | "amphp/http-client": "^4.2.1",
437 | "amphp/http-tunnel": "^1.0",
438 | "amphp/socket": "^1.1",
439 | "guzzlehttp/promises": "^1.4",
440 | "nyholm/psr7": "^1.0",
441 | "php-http/httplug": "^1.0|^2.0",
442 | "psr/http-client": "^1.0",
443 | "symfony/dependency-injection": "^4.4|^5.0|^6.0",
444 | "symfony/http-kernel": "^4.4.13|^5.1.5|^6.0",
445 | "symfony/process": "^4.4|^5.0|^6.0",
446 | "symfony/stopwatch": "^4.4|^5.0|^6.0"
447 | },
448 | "type": "library",
449 | "autoload": {
450 | "psr-4": {
451 | "Symfony\\Component\\HttpClient\\": ""
452 | },
453 | "exclude-from-classmap": [
454 | "/Tests/"
455 | ]
456 | },
457 | "notification-url": "https://packagist.org/downloads/",
458 | "license": [
459 | "MIT"
460 | ],
461 | "authors": [
462 | {
463 | "name": "Nicolas Grekas",
464 | "email": "p@tchwork.com"
465 | },
466 | {
467 | "name": "Symfony Community",
468 | "homepage": "https://symfony.com/contributors"
469 | }
470 | ],
471 | "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously",
472 | "homepage": "https://symfony.com",
473 | "support": {
474 | "source": "https://github.com/symfony/http-client/tree/v5.4.1"
475 | },
476 | "funding": [
477 | {
478 | "url": "https://symfony.com/sponsor",
479 | "type": "custom"
480 | },
481 | {
482 | "url": "https://github.com/fabpot",
483 | "type": "github"
484 | },
485 | {
486 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
487 | "type": "tidelift"
488 | }
489 | ],
490 | "time": "2021-12-01T15:04:08+00:00"
491 | },
492 | {
493 | "name": "symfony/http-client-contracts",
494 | "version": "v2.5.0",
495 | "source": {
496 | "type": "git",
497 | "url": "https://github.com/symfony/http-client-contracts.git",
498 | "reference": "ec82e57b5b714dbb69300d348bd840b345e24166"
499 | },
500 | "dist": {
501 | "type": "zip",
502 | "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ec82e57b5b714dbb69300d348bd840b345e24166",
503 | "reference": "ec82e57b5b714dbb69300d348bd840b345e24166",
504 | "shasum": ""
505 | },
506 | "require": {
507 | "php": ">=7.2.5"
508 | },
509 | "suggest": {
510 | "symfony/http-client-implementation": ""
511 | },
512 | "type": "library",
513 | "extra": {
514 | "branch-alias": {
515 | "dev-main": "2.5-dev"
516 | },
517 | "thanks": {
518 | "name": "symfony/contracts",
519 | "url": "https://github.com/symfony/contracts"
520 | }
521 | },
522 | "autoload": {
523 | "psr-4": {
524 | "Symfony\\Contracts\\HttpClient\\": ""
525 | }
526 | },
527 | "notification-url": "https://packagist.org/downloads/",
528 | "license": [
529 | "MIT"
530 | ],
531 | "authors": [
532 | {
533 | "name": "Nicolas Grekas",
534 | "email": "p@tchwork.com"
535 | },
536 | {
537 | "name": "Symfony Community",
538 | "homepage": "https://symfony.com/contributors"
539 | }
540 | ],
541 | "description": "Generic abstractions related to HTTP clients",
542 | "homepage": "https://symfony.com",
543 | "keywords": [
544 | "abstractions",
545 | "contracts",
546 | "decoupling",
547 | "interfaces",
548 | "interoperability",
549 | "standards"
550 | ],
551 | "support": {
552 | "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.0"
553 | },
554 | "funding": [
555 | {
556 | "url": "https://symfony.com/sponsor",
557 | "type": "custom"
558 | },
559 | {
560 | "url": "https://github.com/fabpot",
561 | "type": "github"
562 | },
563 | {
564 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
565 | "type": "tidelift"
566 | }
567 | ],
568 | "time": "2021-11-03T09:24:47+00:00"
569 | },
570 | {
571 | "name": "symfony/process",
572 | "version": "v5.4.0",
573 | "source": {
574 | "type": "git",
575 | "url": "https://github.com/symfony/process.git",
576 | "reference": "5be20b3830f726e019162b26223110c8f47cf274"
577 | },
578 | "dist": {
579 | "type": "zip",
580 | "url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274",
581 | "reference": "5be20b3830f726e019162b26223110c8f47cf274",
582 | "shasum": ""
583 | },
584 | "require": {
585 | "php": ">=7.2.5",
586 | "symfony/polyfill-php80": "^1.16"
587 | },
588 | "type": "library",
589 | "autoload": {
590 | "psr-4": {
591 | "Symfony\\Component\\Process\\": ""
592 | },
593 | "exclude-from-classmap": [
594 | "/Tests/"
595 | ]
596 | },
597 | "notification-url": "https://packagist.org/downloads/",
598 | "license": [
599 | "MIT"
600 | ],
601 | "authors": [
602 | {
603 | "name": "Fabien Potencier",
604 | "email": "fabien@symfony.com"
605 | },
606 | {
607 | "name": "Symfony Community",
608 | "homepage": "https://symfony.com/contributors"
609 | }
610 | ],
611 | "description": "Executes commands in sub-processes",
612 | "homepage": "https://symfony.com",
613 | "support": {
614 | "source": "https://github.com/symfony/process/tree/v5.4.0"
615 | },
616 | "funding": [
617 | {
618 | "url": "https://symfony.com/sponsor",
619 | "type": "custom"
620 | },
621 | {
622 | "url": "https://github.com/fabpot",
623 | "type": "github"
624 | },
625 | {
626 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
627 | "type": "tidelift"
628 | }
629 | ],
630 | "time": "2021-11-28T15:25:38+00:00"
631 | },
632 | {
633 | "name": "symfony/runtime",
634 | "version": "v5.4.1",
635 | "source": {
636 | "type": "git",
637 | "url": "https://github.com/symfony/runtime.git",
638 | "reference": "f7a8403ae0e6847e56881c3c106e4ea2ec4ef8c9"
639 | },
640 | "dist": {
641 | "type": "zip",
642 | "url": "https://api.github.com/repos/symfony/runtime/zipball/f7a8403ae0e6847e56881c3c106e4ea2ec4ef8c9",
643 | "reference": "f7a8403ae0e6847e56881c3c106e4ea2ec4ef8c9",
644 | "shasum": ""
645 | },
646 | "require": {
647 | "composer-plugin-api": "^1.0|^2.0",
648 | "php": ">=7.2.5",
649 | "symfony/polyfill-php80": "^1.15"
650 | },
651 | "conflict": {
652 | "symfony/dotenv": "<5.1"
653 | },
654 | "require-dev": {
655 | "composer/composer": "^1.0.2|^2.0",
656 | "symfony/console": "^4.4.30|^5.3.7|^6.0",
657 | "symfony/dotenv": "^5.1|^6.0",
658 | "symfony/http-foundation": "^4.4.30|^5.3.7|^6.0",
659 | "symfony/http-kernel": "^4.4.30|^5.3.7|^6.0"
660 | },
661 | "type": "composer-plugin",
662 | "extra": {
663 | "class": "Symfony\\Component\\Runtime\\Internal\\ComposerPlugin"
664 | },
665 | "autoload": {
666 | "psr-4": {
667 | "Symfony\\Component\\Runtime\\": "",
668 | "Symfony\\Runtime\\Symfony\\Component\\": "Internal/"
669 | },
670 | "exclude-from-classmap": [
671 | "/Tests/"
672 | ]
673 | },
674 | "notification-url": "https://packagist.org/downloads/",
675 | "license": [
676 | "MIT"
677 | ],
678 | "authors": [
679 | {
680 | "name": "Nicolas Grekas",
681 | "email": "p@tchwork.com"
682 | },
683 | {
684 | "name": "Symfony Community",
685 | "homepage": "https://symfony.com/contributors"
686 | }
687 | ],
688 | "description": "Enables decoupling PHP applications from global state",
689 | "homepage": "https://symfony.com",
690 | "support": {
691 | "source": "https://github.com/symfony/runtime/tree/v5.4.1"
692 | },
693 | "funding": [
694 | {
695 | "url": "https://symfony.com/sponsor",
696 | "type": "custom"
697 | },
698 | {
699 | "url": "https://github.com/fabpot",
700 | "type": "github"
701 | },
702 | {
703 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
704 | "type": "tidelift"
705 | }
706 | ],
707 | "time": "2021-12-01T15:47:38+00:00"
708 | },
709 | {
710 | "name": "symfony/service-contracts",
711 | "version": "v3.0.0",
712 | "source": {
713 | "type": "git",
714 | "url": "https://github.com/symfony/service-contracts.git",
715 | "reference": "36715ebf9fb9db73db0cb24263c79077c6fe8603"
716 | },
717 | "dist": {
718 | "type": "zip",
719 | "url": "https://api.github.com/repos/symfony/service-contracts/zipball/36715ebf9fb9db73db0cb24263c79077c6fe8603",
720 | "reference": "36715ebf9fb9db73db0cb24263c79077c6fe8603",
721 | "shasum": ""
722 | },
723 | "require": {
724 | "php": ">=8.0.2",
725 | "psr/container": "^2.0"
726 | },
727 | "conflict": {
728 | "ext-psr": "<1.1|>=2"
729 | },
730 | "suggest": {
731 | "symfony/service-implementation": ""
732 | },
733 | "type": "library",
734 | "extra": {
735 | "branch-alias": {
736 | "dev-main": "3.0-dev"
737 | },
738 | "thanks": {
739 | "name": "symfony/contracts",
740 | "url": "https://github.com/symfony/contracts"
741 | }
742 | },
743 | "autoload": {
744 | "psr-4": {
745 | "Symfony\\Contracts\\Service\\": ""
746 | }
747 | },
748 | "notification-url": "https://packagist.org/downloads/",
749 | "license": [
750 | "MIT"
751 | ],
752 | "authors": [
753 | {
754 | "name": "Nicolas Grekas",
755 | "email": "p@tchwork.com"
756 | },
757 | {
758 | "name": "Symfony Community",
759 | "homepage": "https://symfony.com/contributors"
760 | }
761 | ],
762 | "description": "Generic abstractions related to writing services",
763 | "homepage": "https://symfony.com",
764 | "keywords": [
765 | "abstractions",
766 | "contracts",
767 | "decoupling",
768 | "interfaces",
769 | "interoperability",
770 | "standards"
771 | ],
772 | "support": {
773 | "source": "https://github.com/symfony/service-contracts/tree/v3.0.0"
774 | },
775 | "funding": [
776 | {
777 | "url": "https://symfony.com/sponsor",
778 | "type": "custom"
779 | },
780 | {
781 | "url": "https://github.com/fabpot",
782 | "type": "github"
783 | },
784 | {
785 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
786 | "type": "tidelift"
787 | }
788 | ],
789 | "time": "2021-11-04T17:53:12+00:00"
790 | },
791 | {
792 | "name": "symfony/string",
793 | "version": "v6.0.1",
794 | "source": {
795 | "type": "git",
796 | "url": "https://github.com/symfony/string.git",
797 | "reference": "0cfed595758ec6e0a25591bdc8ca733c1896af32"
798 | },
799 | "dist": {
800 | "type": "zip",
801 | "url": "https://api.github.com/repos/symfony/string/zipball/0cfed595758ec6e0a25591bdc8ca733c1896af32",
802 | "reference": "0cfed595758ec6e0a25591bdc8ca733c1896af32",
803 | "shasum": ""
804 | },
805 | "require": {
806 | "php": ">=8.0.2",
807 | "symfony/polyfill-ctype": "~1.8",
808 | "symfony/polyfill-intl-grapheme": "~1.0",
809 | "symfony/polyfill-intl-normalizer": "~1.0",
810 | "symfony/polyfill-mbstring": "~1.0"
811 | },
812 | "conflict": {
813 | "symfony/translation-contracts": "<2.0"
814 | },
815 | "require-dev": {
816 | "symfony/error-handler": "^5.4|^6.0",
817 | "symfony/http-client": "^5.4|^6.0",
818 | "symfony/translation-contracts": "^2.0|^3.0",
819 | "symfony/var-exporter": "^5.4|^6.0"
820 | },
821 | "type": "library",
822 | "autoload": {
823 | "psr-4": {
824 | "Symfony\\Component\\String\\": ""
825 | },
826 | "files": [
827 | "Resources/functions.php"
828 | ],
829 | "exclude-from-classmap": [
830 | "/Tests/"
831 | ]
832 | },
833 | "notification-url": "https://packagist.org/downloads/",
834 | "license": [
835 | "MIT"
836 | ],
837 | "authors": [
838 | {
839 | "name": "Nicolas Grekas",
840 | "email": "p@tchwork.com"
841 | },
842 | {
843 | "name": "Symfony Community",
844 | "homepage": "https://symfony.com/contributors"
845 | }
846 | ],
847 | "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way",
848 | "homepage": "https://symfony.com",
849 | "keywords": [
850 | "grapheme",
851 | "i18n",
852 | "string",
853 | "unicode",
854 | "utf-8",
855 | "utf8"
856 | ],
857 | "support": {
858 | "source": "https://github.com/symfony/string/tree/v6.0.1"
859 | },
860 | "funding": [
861 | {
862 | "url": "https://symfony.com/sponsor",
863 | "type": "custom"
864 | },
865 | {
866 | "url": "https://github.com/fabpot",
867 | "type": "github"
868 | },
869 | {
870 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
871 | "type": "tidelift"
872 | }
873 | ],
874 | "time": "2021-12-08T15:13:44+00:00"
875 | },
876 | {
877 | "name": "symfony/yaml",
878 | "version": "v5.4.0",
879 | "source": {
880 | "type": "git",
881 | "url": "https://github.com/symfony/yaml.git",
882 | "reference": "034ccc0994f1ae3f7499fa5b1f2e75d5e7a94efc"
883 | },
884 | "dist": {
885 | "type": "zip",
886 | "url": "https://api.github.com/repos/symfony/yaml/zipball/034ccc0994f1ae3f7499fa5b1f2e75d5e7a94efc",
887 | "reference": "034ccc0994f1ae3f7499fa5b1f2e75d5e7a94efc",
888 | "shasum": ""
889 | },
890 | "require": {
891 | "php": ">=7.2.5",
892 | "symfony/deprecation-contracts": "^2.1|^3",
893 | "symfony/polyfill-ctype": "^1.8"
894 | },
895 | "conflict": {
896 | "symfony/console": "<5.3"
897 | },
898 | "require-dev": {
899 | "symfony/console": "^5.3|^6.0"
900 | },
901 | "suggest": {
902 | "symfony/console": "For validating YAML files using the lint command"
903 | },
904 | "bin": [
905 | "Resources/bin/yaml-lint"
906 | ],
907 | "type": "library",
908 | "autoload": {
909 | "psr-4": {
910 | "Symfony\\Component\\Yaml\\": ""
911 | },
912 | "exclude-from-classmap": [
913 | "/Tests/"
914 | ]
915 | },
916 | "notification-url": "https://packagist.org/downloads/",
917 | "license": [
918 | "MIT"
919 | ],
920 | "authors": [
921 | {
922 | "name": "Fabien Potencier",
923 | "email": "fabien@symfony.com"
924 | },
925 | {
926 | "name": "Symfony Community",
927 | "homepage": "https://symfony.com/contributors"
928 | }
929 | ],
930 | "description": "Loads and dumps YAML files",
931 | "homepage": "https://symfony.com",
932 | "support": {
933 | "source": "https://github.com/symfony/yaml/tree/v5.4.0"
934 | },
935 | "funding": [
936 | {
937 | "url": "https://symfony.com/sponsor",
938 | "type": "custom"
939 | },
940 | {
941 | "url": "https://github.com/fabpot",
942 | "type": "github"
943 | },
944 | {
945 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
946 | "type": "tidelift"
947 | }
948 | ],
949 | "time": "2021-11-28T15:25:38+00:00"
950 | }
951 | ],
952 | "packages-dev": [
953 | {
954 | "name": "symfony/var-dumper",
955 | "version": "v5.4.1",
956 | "source": {
957 | "type": "git",
958 | "url": "https://github.com/symfony/var-dumper.git",
959 | "reference": "2366ac8d8abe0c077844613c1a4f0c0a9f522dcc"
960 | },
961 | "dist": {
962 | "type": "zip",
963 | "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2366ac8d8abe0c077844613c1a4f0c0a9f522dcc",
964 | "reference": "2366ac8d8abe0c077844613c1a4f0c0a9f522dcc",
965 | "shasum": ""
966 | },
967 | "require": {
968 | "php": ">=7.2.5",
969 | "symfony/polyfill-mbstring": "~1.0",
970 | "symfony/polyfill-php80": "^1.16"
971 | },
972 | "conflict": {
973 | "phpunit/phpunit": "<5.4.3",
974 | "symfony/console": "<4.4"
975 | },
976 | "require-dev": {
977 | "ext-iconv": "*",
978 | "symfony/console": "^4.4|^5.0|^6.0",
979 | "symfony/process": "^4.4|^5.0|^6.0",
980 | "symfony/uid": "^5.1|^6.0",
981 | "twig/twig": "^2.13|^3.0.4"
982 | },
983 | "suggest": {
984 | "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
985 | "ext-intl": "To show region name in time zone dump",
986 | "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
987 | },
988 | "bin": [
989 | "Resources/bin/var-dump-server"
990 | ],
991 | "type": "library",
992 | "autoload": {
993 | "files": [
994 | "Resources/functions/dump.php"
995 | ],
996 | "psr-4": {
997 | "Symfony\\Component\\VarDumper\\": ""
998 | },
999 | "exclude-from-classmap": [
1000 | "/Tests/"
1001 | ]
1002 | },
1003 | "notification-url": "https://packagist.org/downloads/",
1004 | "license": [
1005 | "MIT"
1006 | ],
1007 | "authors": [
1008 | {
1009 | "name": "Nicolas Grekas",
1010 | "email": "p@tchwork.com"
1011 | },
1012 | {
1013 | "name": "Symfony Community",
1014 | "homepage": "https://symfony.com/contributors"
1015 | }
1016 | ],
1017 | "description": "Provides mechanisms for walking through any arbitrary PHP variable",
1018 | "homepage": "https://symfony.com",
1019 | "keywords": [
1020 | "debug",
1021 | "dump"
1022 | ],
1023 | "support": {
1024 | "source": "https://github.com/symfony/var-dumper/tree/v5.4.1"
1025 | },
1026 | "funding": [
1027 | {
1028 | "url": "https://symfony.com/sponsor",
1029 | "type": "custom"
1030 | },
1031 | {
1032 | "url": "https://github.com/fabpot",
1033 | "type": "github"
1034 | },
1035 | {
1036 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
1037 | "type": "tidelift"
1038 | }
1039 | ],
1040 | "time": "2021-12-01T15:04:08+00:00"
1041 | }
1042 | ],
1043 | "aliases": [],
1044 | "minimum-stability": "stable",
1045 | "stability-flags": [],
1046 | "prefer-stable": false,
1047 | "prefer-lowest": false,
1048 | "platform": {
1049 | "php": ">=8",
1050 | "ext-ctype": "*",
1051 | "ext-intl": "*",
1052 | "ext-mbstring": "*"
1053 | },
1054 | "platform-dev": [],
1055 | "plugin-api-version": "2.1.0"
1056 | }
1057 |
--------------------------------------------------------------------------------
/run:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | add(new DiffRecipeVersionsCommand());
21 | $app->add(new GenerateFlexEndpointCommand());
22 | $app->add(new GenerateArchivedRecipesCommand());
23 | $app->add(new GenerateRecipesReadmeCommand());
24 | $app->add(new LintManifestsCommand());
25 | $app->add(new LintPackagesCommand());
26 | $app->add(new LintPullRequestCommand());
27 | $app->add(new LintYamlCommand());
28 | $app->add(new ListUnpatchedPackagesCommand());
29 |
30 | return $app;
31 | };
32 |
--------------------------------------------------------------------------------
/src/DiffRecipeVersionsCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Input\InputArgument;
15 | use Symfony\Component\Console\Input\InputInterface;
16 | use Symfony\Component\Console\Output\OutputInterface;
17 | use Symfony\Component\Process\Process;
18 |
19 | #[AsCommand(name: 'diff-recipe-versions', description: 'Displays the diff between versions of a recipe')]
20 | class DiffRecipeVersionsCommand extends Command
21 | {
22 | protected function configure(): void
23 | {
24 | $this
25 | ->addArgument('endpoint', InputArgument::OPTIONAL, 'The Flex endpoint', '')
26 | ;
27 | }
28 |
29 | protected function execute(InputInterface $input, OutputInterface $output): int
30 | {
31 | $packages = [];
32 | $requires = [];
33 |
34 | while (false !== $package = fgets(\STDIN)) {
35 | $package = substr($package, 0, -1);
36 |
37 | $versions = scandir($package, \SCANDIR_SORT_NONE);
38 | usort($versions, 'version_compare');
39 |
40 | if (!$versions = \array_slice($versions, 2)) {
41 | continue;
42 | }
43 |
44 | $packages[$package] = $versions;
45 |
46 | $requires[] = escapeshellarg($package.':^'.array_pop($versions));
47 | }
48 |
49 | if ($endpoint = $input->getArgument('endpoint')) {
50 | $requires = implode(' ', $requires);
51 | $endpoint = << $versions) {
91 | $previousVersion = array_shift($versions);
92 |
93 | if (!$versions) {
94 | continue;
95 | }
96 |
97 | if (null !== $head) {
98 | $output->writeln($head);
99 | $head = null;
100 | }
101 | $output->writeln(sprintf("### %s\n", $package));
102 |
103 | foreach ($versions as $version) {
104 | $process = new Process(['git', 'diff', '--color=never', '--no-index', $package.'/'.$previousVersion, $package.'/'.$version]);
105 | $process->run(null, ['LC_ALL' =>'C']);
106 |
107 | $output->writeln('');
108 | $output->writeln(sprintf("%s vs %s
\n", $previousVersion, $version));
109 | $output->writeln("```diff\n{$process->getOutput()}```");
110 | $output->writeln("\n \n");
111 |
112 | $previousVersion = $version;
113 | }
114 | }
115 |
116 | if (null !== $head) {
117 | $output->writeln($head);
118 | }
119 |
120 | return 0;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/src/GenerateArchivedRecipesCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Helper\ProgressBar;
15 | use Symfony\Component\Console\Input\InputArgument;
16 | use Symfony\Component\Console\Input\InputInterface;
17 | use Symfony\Component\Console\Output\OutputInterface;
18 | use Symfony\Component\Filesystem\Filesystem;
19 | use Symfony\Component\Process\Process;
20 |
21 | #[AsCommand(name: 'generate:archived-recipes', description: 'Generates an "archived" directory containing the history of every recipe.')]
22 | class GenerateArchivedRecipesCommand extends Command
23 | {
24 | protected function configure(): void
25 | {
26 | $this
27 | ->addArgument('directory', InputArgument::REQUIRED, 'Path to the local recipes repository')
28 | ->addArgument('branch', InputArgument::REQUIRED, 'Branch on the recipes repository to use')
29 | ->addArgument('output_directory', InputArgument::REQUIRED, 'The directory where generated files should be stored')
30 | ;
31 | }
32 |
33 | protected function execute(InputInterface $input, OutputInterface $output): int
34 | {
35 | $recipesDirectory = $input->getArgument('directory');
36 | $branch = $input->getArgument('branch');
37 | $outputDir = $input->getArgument('output_directory');
38 | $filesystem = new Filesystem();
39 |
40 | if (!file_exists($recipesDirectory)) {
41 | throw new \InvalidArgumentException(sprintf('Cannot find directory "%s"', $recipesDirectory));
42 | }
43 |
44 | $process = new Process(['git', 'checkout', $branch], $recipesDirectory);
45 | $process->mustRun();
46 |
47 | $tmpDir = sys_get_temp_dir().'/_flex_archive/';
48 | if (file_exists($tmpDir)) {
49 | $filesystem->remove($tmpDir);
50 | }
51 | $filesystem->mkdir($tmpDir);
52 |
53 | $process = (new Process(['git', 'rev-list', '--count', $branch, '--no-merges'], $recipesDirectory))->mustRun();
54 | // an imperfect estimate of the total commits
55 | $totalCommits = (int) trim($process->getOutput());
56 | $progress = new ProgressBar($output, $totalCommits);
57 | while (true) {
58 | // most arguments to the command do not matter for us and so are hardcoded
59 | $process = Process::fromShellCommandline(
60 | sprintf('git ls-tree HEAD */*/* | php %s/run generate:flex-endpoint symfony/recipes master flex/main $OUTPUT_DIR', realpath(__DIR__.'/../')),
61 | $recipesDirectory
62 | );
63 | // this WILL occasionally fail: some legacy recipes were invalid and pointed to non-existent files
64 | $process->run(null, ['OUTPUT_DIR' => $tmpDir]);
65 |
66 | $process = new Process(['git', 'checkout', 'HEAD^1'], $recipesDirectory);
67 | $process->mustRun();
68 |
69 | $process = (new Process(['git', 'rev-list', '--count', 'HEAD', '--no-merges'], $recipesDirectory))->mustRun();
70 | $newCount = (int) trim($process->getOutput());
71 | // when we've come to the final commit, this will be 1
72 | if (1 === $newCount) {
73 | break;
74 | }
75 | $progress->setProgress($totalCommits - $newCount);
76 | }
77 |
78 | $filesystem->mirror($tmpDir.'/archived', $outputDir);
79 | $progress->finish();
80 | $filesystem->remove($tmpDir);
81 |
82 | return 0;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/GenerateFlexEndpointCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Input\InputArgument;
15 | use Symfony\Component\Console\Input\InputInterface;
16 | use Symfony\Component\Console\Output\OutputInterface;
17 |
18 | #[AsCommand(name: 'generate:flex-endpoint', description: 'Generates the json files required by Flex')]
19 | class GenerateFlexEndpointCommand extends Command
20 | {
21 | protected function configure(): void
22 | {
23 | $this
24 | ->addArgument('repository', InputArgument::REQUIRED, 'The name of the GitHub repository')
25 | ->addArgument('source_branch', InputArgument::REQUIRED, 'The source branch of recipes')
26 | ->addArgument('flex_branch', InputArgument::REQUIRED, 'The branch of the target Flex endpoint')
27 | ->addArgument('output_directory', InputArgument::REQUIRED, 'The directory where generated files should be stored')
28 | ->addArgument('versions_json', InputArgument::OPTIONAL, 'The file where versions of Symfony are described')
29 | ->addOption('contrib')
30 | ;
31 | }
32 |
33 | protected function execute(InputInterface $input, OutputInterface $output): int
34 | {
35 | $repository = $input->getArgument('repository');
36 | $sourceBranch = $input->getArgument('source_branch');
37 | $flexBranch = $input->getArgument('flex_branch');
38 | $outputDir = $input->getArgument('output_directory');
39 | $versionsJson = $input->getArgument('versions_json');
40 | $contrib = $input->getOption('contrib');
41 |
42 | $aliases = $recipes = $recipeConflicts = $versions = [];
43 |
44 | if ($versionsJson) {
45 | $versions = json_decode(file_get_contents($versionsJson), true);
46 |
47 | foreach ($versions['splits'] as $package => $v) {
48 | if (0 === strpos($package, 'symfony/') && '-pack' !== substr($package, -5)) {
49 | $alias = substr($package, 8);
50 | $aliases[$alias] = $package;
51 | $aliases[str_replace('-', '', $alias)] = $package;
52 | }
53 | }
54 |
55 | if (isset($versions['splits']['symfony/var-exporter'])) {
56 | // Allow var-exporter v6.2+ to be installed with pre-6.2 apps
57 | $versions['splits']['symfony/var-exporter'] = array_values(array_diff($versions['splits']['symfony/var-exporter'], ['4.2', '4.3', '4.4', '5.0', '5.1', '5.2', '5.3', '5.4', '6.0', '6.1']));
58 | }
59 | }
60 |
61 | // stdin usually generated by `git ls-tree HEAD */*/*`
62 |
63 | while (false !== $line = fgets(\STDIN)) {
64 | [$tree, $package] = explode("\t", trim($line));
65 | [,, $tree] = explode(' ', $tree);
66 |
67 | if (!file_exists($package.'/manifest.json')) {
68 | continue;
69 | }
70 |
71 | $manifest = json_decode(file_get_contents($package.'/manifest.json'), true);
72 | $version = substr($package, 1 + strrpos($package, '/'));
73 | $package = substr($package, 0, -1 - \strlen($version));
74 |
75 | foreach ($manifest['aliases'] ?? [] as $alias) {
76 | $aliases[$alias] = $package;
77 | $aliases[str_replace('-', '', $alias)] = $package;
78 | }
79 |
80 | if (0 === strpos($package, 'symfony/') && '-pack' !== substr($package, -5)) {
81 | $alias = substr($package, 8);
82 | $aliases[$alias] = $package;
83 | $aliases[str_replace('-', '', $alias)] = $package;
84 | }
85 |
86 | if ($this->generatePackageJson($package, $version, $manifest, $tree, $outputDir)) {
87 | $recipes[$package][] = $version;
88 | usort($recipes[$package], 'strnatcmp');
89 |
90 | if (isset($manifest['conflict'])) {
91 | uksort($manifest['conflict'], 'strnatcmp');
92 | $recipeConflicts[$package][$version] = $manifest['conflict'];
93 | uksort($recipeConflicts[$package], 'strnatcmp');
94 | }
95 | }
96 | }
97 |
98 | ksort($aliases, \SORT_NATURAL);
99 | ksort($recipes, \SORT_NATURAL);
100 | ksort($recipeConflicts, \SORT_NATURAL);
101 |
102 | file_put_contents($outputDir.'/index.json', json_encode([
103 | 'aliases' => $aliases,
104 | 'recipes' => $recipes,
105 | 'recipe-conflicts' => $recipeConflicts,
106 | 'versions' => $versions,
107 | 'branch' => $sourceBranch,
108 | 'is_contrib' => $contrib,
109 | '_links' => [
110 | 'repository' => sprintf('github.com/%s', $repository),
111 | 'origin_template' => sprintf('{package}:{version}@github.com/%s:%s', $repository, $sourceBranch),
112 | 'recipe_template' => sprintf('https://raw.githubusercontent.com/%s/%s/{package_dotted}.{version}.json', $repository, $flexBranch),
113 | 'recipe_template_relative' => sprintf('{package_dotted}.{version}.json', $repository, $flexBranch),
114 | 'archived_recipes_template' => sprintf('https://raw.githubusercontent.com/%s/%s/archived/{package_dotted}/{ref}.json', $repository, $flexBranch),
115 | 'archived_recipes_template_relative' => sprintf('archived/{package_dotted}/{ref}.json', $repository, $flexBranch),
116 | ],
117 | ], \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)."\n");
118 |
119 | return 0;
120 | }
121 |
122 | private function generatePackageJson(string $package, string $version, array $manifest, string $tree, string $outputDir): bool
123 | {
124 | unset($manifest['aliases']);
125 |
126 | $files = [];
127 | $it = new \RecursiveDirectoryIterator($package.'/'.$version);
128 | $it->setFlags($it::SKIP_DOTS | $it::FOLLOW_SYMLINKS | $it::UNIX_PATHS);
129 |
130 | foreach (new \RecursiveIteratorIterator($it) as $path => $file) {
131 | $file = substr($path, 1 + \strlen($package.'/'.$version));
132 | if (is_dir($path) || 'manifest.json' === $file) {
133 | continue;
134 | }
135 | if ('post-install.txt' === $file) {
136 | $manifest['post-install-output'] = explode("\n", rtrim(str_replace("\r", '', file_get_contents($path)), "\n"));
137 | continue;
138 | }
139 | if ('Makefile' === $file) {
140 | $manifest['makefile'] = explode("\n", rtrim(str_replace("\r", '', file_get_contents($path)), "\n"));
141 | continue;
142 | }
143 | $contents = file_get_contents($path);
144 | $files[$file] = [
145 | 'contents' => preg_match('//u', $contents) ? explode("\n", $contents) : base64_encode($contents),
146 | 'executable' => is_executable($path),
147 | ];
148 | }
149 |
150 | if (!$manifest) {
151 | return false;
152 | }
153 |
154 | ksort($files, \SORT_NATURAL);
155 |
156 | $contents = json_encode(
157 | [
158 | 'manifests' => [
159 | $package => [
160 | 'manifest' => $manifest,
161 | 'files' => $files,
162 | 'ref' => $tree,
163 | ],
164 | ],
165 | ],
166 | \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES
167 | )."\n";
168 | file_put_contents(sprintf('%s/%s.%s.json', $outputDir, str_replace('/', '.', $package), $version), $contents);
169 |
170 | // save another version for the archives
171 | $archivedPath = sprintf('%s/archived/%s/%s.json', $outputDir, str_replace('/', '.', $package), $tree);
172 | if (!file_exists(\dirname($archivedPath))) {
173 | mkdir(\dirname($archivedPath), 0777, true);
174 | }
175 | file_put_contents($archivedPath, $contents);
176 |
177 | return true;
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/src/GenerateRecipesReadmeCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Input\InputArgument;
15 | use Symfony\Component\Console\Input\InputInterface;
16 | use Symfony\Component\Console\Input\InputOption;
17 | use Symfony\Component\Console\Output\OutputInterface;
18 |
19 | #[AsCommand(name: 'generate:recipes-readme', description: 'Generates a "README" containing a list of all recipes.')]
20 | class GenerateRecipesReadmeCommand extends Command
21 | {
22 | protected function configure(): void
23 | {
24 | $this
25 | ->addArgument('index_path', InputArgument::REQUIRED, 'Path to the local index.json')
26 | ->addOption('contrib', null, InputOption::VALUE_NONE, 'Is this the contrib repository?')
27 | ;
28 | }
29 |
30 | protected function execute(InputInterface $input, OutputInterface $output): int
31 | {
32 | $indexPath = $input->getArgument('index_path');
33 | $isContrib = $input->getOption('contrib');
34 |
35 | if (!file_exists($indexPath)) {
36 | throw new \InvalidArgumentException(sprintf('Cannot find index JSON file "%s".', $indexPath));
37 | }
38 |
39 | $data = json_decode(file_get_contents($indexPath), true);
40 |
41 | $aliases = $this->organizeAliases($data['aliases']);
42 | $hasAliases = count($aliases) > 0;
43 |
44 | $contentLines = [];
45 | $contentLines[] = '# List of Recipes';
46 | $contentLines[] = '';
47 | if ($isContrib) {
48 | $contentLines[] = 'Additional recipes can be found on the [Main Recipes Repository](https://github.com/symfony/recipes/blob/flex/main/RECIPES.md)';
49 | } else {
50 | $contentLines[] = 'Additional recipes can be found on the [Contrib Recipes Repository](https://github.com/symfony/recipes-contrib/blob/flex/main/RECIPES.md)';
51 | }
52 | $contentLines[] = '';
53 |
54 | // Package | Latest recipe | Aliases
55 | // [symfony/framework-bundle](https://packagist) | [5.4](github.com/.../) | framework-bundle
56 | $contentLines[] = '| Package | Latest Recipe |'.($hasAliases ? ' Aliases |' : '');
57 | $contentLines[] = '| --- | --- |'.($hasAliases ? ' --- |' : '');
58 | foreach ($data['recipes'] as $package => $versions) {
59 | $latestVersion = array_pop($versions);
60 | $line = sprintf('| [%s](https://packagist.org/packages/%s) | [%s](%s/%s) |', $package, $package, $latestVersion, $package, $latestVersion);
61 | if ($hasAliases) {
62 | $styledAliases = array_map(function ($alias) {
63 | return sprintf('`%s`', $alias);
64 | }, $aliases[$package] ?? []);
65 | $line .= sprintf(' %s |', implode(', ', $styledAliases));
66 | }
67 |
68 | $contentLines[] = $line;
69 | }
70 |
71 | echo implode("\n", $contentLines);
72 |
73 | return 0;
74 | }
75 |
76 | private function organizeAliases(array $aliases): array
77 | {
78 | $byPackageAliases = [];
79 | foreach ($aliases as $alias => $package) {
80 | if (!isset($byPackageAliases[$package])) {
81 | $byPackageAliases[$package] = [];
82 | }
83 |
84 | $byPackageAliases[$package][] = $alias;
85 | }
86 |
87 | return $byPackageAliases;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/src/LintManifestsCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Input\InputInterface;
15 | use Symfony\Component\Console\Output\OutputInterface;
16 |
17 | #[AsCommand(name: 'lint:manifests', description: 'Checks manifest.json files')]
18 | class LintManifestsCommand extends Command
19 | {
20 | private const ALLOWED_KEYS = [
21 | 'bundles' => 1,
22 | 'copy-from-recipe' => 0,
23 | 'copy-from-package' => 0,
24 | 'composer-scripts' => 0,
25 | 'dotenv' => 0,
26 | 'env' => 0,
27 | 'makefile' => 0,
28 | 'gitignore' => 0,
29 | 'post-install-output' => 0,
30 | 'aliases' => 0,
31 | 'container' => 0,
32 | 'conflict' => 0,
33 | 'dockerfile' => 0,
34 | 'docker-compose' => 0,
35 | 'add-lines' => 0,
36 | ];
37 |
38 | private const SPECIAL_FILES = ['.', '..', 'manifest.json', 'post-install.txt', 'Makefile'];
39 |
40 | protected function configure(): void
41 | {
42 | $this
43 | ->addOption('contrib')
44 | ;
45 | }
46 |
47 | protected function execute(InputInterface $input, OutputInterface $output): int
48 | {
49 | $exit = 0;
50 | $aliases = [];
51 |
52 | foreach (glob('*/*/*/manifest.json') as $manifest) {
53 | [$vendor, $package, $version] = explode('/', $manifest);
54 | $package = "$vendor/$package";
55 | $data = json_decode(file_get_contents($manifest), true);
56 |
57 | $empty = true;
58 | foreach (self::ALLOWED_KEYS as $key => $count) {
59 | if ($count ? \count($data[$key] ?? []) > $count : !empty($data[$key])) {
60 | $empty = false;
61 | break;
62 | }
63 | }
64 | if ($empty && !is_file("$package/$version/post-install.txt") && 'all' === current($data['bundles'] ?? [])) {
65 | $output->writeln(sprintf('::error file=%s::Recipe is not needed as it only registers a bundle for all environments', $manifest));
66 | continue;
67 | }
68 |
69 | if (!isset($data['aliases'])) {
70 | // no-op
71 | } elseif ($input->getOption('contrib')) {
72 | $output->writeln(sprintf('::error file=%s::Aliases not supported in the contrib repository', $manifest));
73 | $exit = 1;
74 | } else {
75 | foreach ($data['aliases'] as $alias) {
76 | if (\in_array($aliases, ['lock', 'nothing', 'mirrors', ''], true)) {
77 | $output->writeln(sprintf('::error file=%s::Alias "%s" cannot be used as it\'s a special alias used by Composer', $manifest, $alias));
78 | $exit = 1;
79 | }
80 | if (isset($aliases[$alias]) && $package !== $aliases[$alias]) {
81 | $output->writeln(sprintf('::error file=%s::Alias "%s" also defined for "%s"', $manifest, $alias, $aliases[$alias]));
82 | $exit = 1;
83 | } else {
84 | $aliases[$alias] = $package;
85 | }
86 | }
87 | }
88 |
89 | if (isset($data['add-lines'])) {
90 | if (!$this->isAddLinesValid($data['add-lines'], $manifest, $output)) {
91 | $exit = 1;
92 | }
93 | }
94 |
95 | if ($extraKeys = array_diff_key($data, self::ALLOWED_KEYS)) {
96 | $extraKeys = array_keys($extraKeys);
97 | $lastKey = array_pop($extraKeys);
98 | $extraKeys = $extraKeys ? 's: '.implode('", "', $extraKeys).' and' : ':';
99 | $output->writeln(sprintf('::error file=%s::Unsupported key%s "%s"', $manifest, $extraKeys, $lastKey));
100 | $exit = 1;
101 | }
102 |
103 | foreach (scandir("$package/$version") as $file) {
104 | $path = "$package/$version/$file";
105 |
106 | if (\in_array($file, self::SPECIAL_FILES, true)) {
107 | if (is_file($path) && !preg_match('//u', file_get_contents($path))) {
108 | $output->writeln(sprintf('::error file=%s::File "%s" must be UTF-8 encoded', $path, $file));
109 | $exit = 1;
110 | }
111 | continue;
112 | }
113 |
114 | if (is_dir($path)) {
115 | if (isset($data['copy-from-recipe'][$file.'/'])) {
116 | // no-op
117 | } elseif (isset($data['copy-from-recipe'][$file])) {
118 | $output->writeln(sprintf('::error file=%s::Directory must be listed under "%s/" in the "copy-from-recipe" section', $manifest, $file));
119 | $exit = 1;
120 | } else {
121 | $output->writeln(sprintf('::error file=%s::Directory must be listed under "%s/" in the "copy-from-recipe" section of "manifest.json"', $path, $file));
122 | $exit = 1;
123 | }
124 | } elseif (!isset($data['copy-from-recipe'][$file])) {
125 | $output->writeln(sprintf('::error file=%s::File must be listed in the "copy-from-recipe" section of "manifest.json"', $path));
126 | $exit = 1;
127 | }
128 | }
129 | }
130 |
131 | return $exit;
132 | }
133 |
134 | private function isAddLinesValid(mixed $data, string $manifest, OutputInterface $output)
135 | {
136 | if (!is_array($data)) {
137 | $output->writeln(sprintf('::error file=%s::"add-lines" must be an array', $manifest));
138 |
139 | return false;
140 | }
141 |
142 | $isValid = true;
143 | foreach ($data as $index => $addLine) {
144 | foreach (['file', 'content', 'position'] as $key) {
145 | if (!isset($addLine[$key])) {
146 | $output->writeln(sprintf('::error file=%s::"add-lines" (index %d) must have a "%s" key', $manifest, $index, $key));
147 | $isValid = false;
148 |
149 | continue;
150 | }
151 |
152 | if (!is_string($addLine[$key])) {
153 | $output->writeln(sprintf('::error file=%s::"add-lines" (index %d) has a "%s" key but it must be a string value', $manifest, $index, $key));
154 |
155 | $isValid = false;
156 | }
157 | }
158 |
159 | if (isset($addLine['position'])) {
160 | $validPositions = ['top', 'bottom', 'after_target'];
161 | if (!\in_array($addLine['position'], $validPositions, true)) {
162 | $output->writeln(sprintf('::error file=%s::"add-lines" (index %d) must have a "position" key with one of the following values: "%s"', $manifest, $index, implode('", "', $validPositions)));
163 |
164 | $isValid = false;
165 | }
166 |
167 | if ('after_target' === $addLine['position']) {
168 | if (!isset($addLine['target'])) {
169 | $output->writeln(sprintf('::error file=%s::"add-lines" (index %d) must have a "target" key when "position" is "after_target"', $manifest, $index));
170 |
171 | $isValid = false;
172 | } elseif (!is_string($addLine['target'])) {
173 | $output->writeln(sprintf('::error file=%s::"add-lines" (index %d) has a "target" key but it must be a string value', $manifest, $index));
174 |
175 | $isValid = false;
176 | }
177 | }
178 | }
179 | }
180 |
181 | return $isValid;
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/src/LintPackagesCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Input\InputInterface;
15 | use Symfony\Component\Console\Output\OutputInterface;
16 | use Symfony\Component\HttpClient\HttpClient;
17 |
18 | #[AsCommand(name: 'lint:packages', description: 'Ensures directories map to valid packages on packagist.org')]
19 | class LintPackagesCommand extends Command
20 | {
21 | protected function execute(InputInterface $input, OutputInterface $output): int
22 | {
23 | $client = HttpClient::create();
24 |
25 | $packages = [];
26 |
27 | foreach (glob('*/*') as $package) {
28 | $packages[] = [false, $package, $client->request('GET', "https://repo.packagist.org/p2/{$package}.json")];
29 | }
30 |
31 | $exit = 0;
32 |
33 | for ($i = 0; isset($packages[$i]); ++$i) {
34 | [$dev, $package, $response] = $packages[$i];
35 | unset($packages[$i]);
36 |
37 | if (200 !== $response->getStatusCode()) {
38 | $output->writeln(sprintf('::error::Package "%s" does not exist on Packagist', $package));
39 | $exit = 1;
40 | unset($packages[$package]);
41 |
42 | continue;
43 | }
44 |
45 | $data = $response->toArray();
46 |
47 | foreach (glob("$package/*") as $version) {
48 | $version = substr($version, 1 + \strlen($package));
49 |
50 | if (!preg_match('/^\d+\.\d+$/D', $version)) {
51 | $output->writeln(sprintf('::error::Version "%s" is not valid, format is "x.y" where x and y are numbers for "%s"', $version, $package));
52 | $exit = 1;
53 | continue;
54 | }
55 |
56 | $found = false;
57 | foreach ($data['packages'][$package] as $versionData) {
58 | $v = str_ends_with($version, '.0') ? substr($version, 0, -2) : $version;
59 |
60 | if (str_starts_with($versionData['version_normalized'], $v.'.')) {
61 | $found = true;
62 | break;
63 | }
64 |
65 | if ($dev && str_starts_with($versionData['extra']['branch-alias'][$versionData['version'] ?? ''] ?? '', $v.'.')) {
66 | $found = true;
67 | break;
68 | }
69 | }
70 |
71 | if (!$found) {
72 | if ($dev) {
73 | $output->writeln(sprintf('::error::Version "%s" of "%s" does not exist on Packagist', $version, $package));
74 | $exit = 1;
75 | } else {
76 | if (!$packages) {
77 | $i = -1;
78 | }
79 | $packages[] = [true, $package, $client->request('GET', "https://repo.packagist.org/p2/{$package}~dev.json")];
80 | }
81 |
82 | continue;
83 | }
84 |
85 | if (isset($versionData['require']['symfony/symfony'])) {
86 | $output->writeln(sprintf('::error::Package "%s/%s" must not depend on symfony/symfony; depend on explicit symfony/* packages instead', $package, $version));
87 | $exit = 1;
88 | }
89 |
90 | if (isset($versionData['require']['symfony/security']) && !\in_array($package.'/'.$version, ['nelmio/security-bundle/2.4', 'symfony/security-bundle/3.3'], true)) {
91 | $output->writeln(sprintf('::error::Package "%s/%s" must not depend on symfony/security; depend on explicit symfony/security-* packages instead', $package, $version));
92 | $exit = 1;
93 | }
94 |
95 | if (!is_file("$package/$version/manifest.json")) {
96 | continue;
97 | }
98 |
99 | $manifest = json_decode(file_get_contents("$package/$version/manifest.json"), true);
100 | if (empty($manifest['bundles']) && !empty($versionData['type'])) {
101 | if ('symfony-bundle' === $versionData['type']) {
102 | $output->writeln(sprintf('::error::You should register the bundle in the manifest as "%s/%s" is a Symfony bundle', $package, $version));
103 | $exit = 1;
104 | } elseif ('sylius-plugin' === $versionData['type']) {
105 | $output->writeln(sprintf('::error::You should register the bundle in the manifest as "%s/%s" is a Sylius plugin', $package, $version));
106 | $exit = 1;
107 | } elseif ('sulu-plugin' === $versionData['type']) {
108 | $output->writeln(sprintf('::error::You should register the bundle in the manifest as "%s/%s" is a Sulu bundle', $package, $version));
109 | $exit = 1;
110 | }
111 | }
112 | }
113 | }
114 |
115 | return $exit;
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/LintPullRequestCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Input\InputArgument;
15 | use Symfony\Component\Console\Input\InputInterface;
16 | use Symfony\Component\Console\Input\InputOption;
17 | use Symfony\Component\Console\Output\OutputInterface;
18 | use Symfony\Component\HttpClient\HttpClient;
19 |
20 | #[AsCommand(name: 'lint:pull-request', description: 'Ensures the PR can be accepted')]
21 | class LintPullRequestCommand extends Command
22 | {
23 | protected function configure(): void
24 | {
25 | $this
26 | ->addArgument('event_path', InputArgument::REQUIRED, 'The path where the GitHub event is stored')
27 | ->addArgument('github_token', InputArgument::REQUIRED, 'The GitHub API token to use')
28 | ->addOption('license', null, InputOption::VALUE_REQUIRED, 'The license to be check in PR body')
29 | ;
30 | }
31 |
32 | protected function execute(InputInterface $input, OutputInterface $output): int
33 | {
34 | $data = json_decode(file_get_contents($input->getArgument('event_path')), true);
35 | $exit = 0;
36 |
37 | $license = $input->getOption('license');
38 | if ($license && !preg_match('/^[ |\t]*License[ |\t]+'.preg_quote($license).'[ |\t]*\r?$/mi', $data['pull_request']['body'])) {
39 | $output->writeln('::error::Contributions must be licensed under '.$license.' (add the pull request header in the description)');
40 | $exit = 1;
41 | }
42 |
43 | $client = HttpClient::create();
44 | $commits = $client->request('GET', $data['pull_request']['commits_url'], ['auth_bearer' => $input->getArgument('github_token')]);
45 |
46 | foreach ($commits->toArray() as $commit) {
47 | if (1 < \count($commit['parents'])) {
48 | $output->writeln('Pull requests should not have merge commits (please rebase)');
49 | $exit = 1;
50 | break;
51 | }
52 | }
53 |
54 | return $exit;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/LintYamlCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Input\InputInterface;
15 | use Symfony\Component\Console\Output\OutputInterface;
16 | use Symfony\Component\Yaml\Exception\ParseException;
17 | use Symfony\Component\Yaml\Parser;
18 | use Symfony\Component\Yaml\Yaml;
19 |
20 | #[AsCommand(name: 'lint:yaml', description: 'Validates the content of yaml files')]
21 | class LintYamlCommand extends Command
22 | {
23 | protected function execute(InputInterface $input, OutputInterface $output): int
24 | {
25 | $exit = 0;
26 |
27 | while (false !== $file = fgets(\STDIN)) {
28 | $file = substr($file, 0, -1);
29 | $this->validate($file, $output, $exit);
30 | }
31 |
32 | return $exit;
33 | }
34 |
35 | private function validate(string $file, OutputInterface $output, int &$exit)
36 | {
37 | $parser = new Parser();
38 | $content = file_get_contents($file);
39 |
40 | $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler, $parser) {
41 | if (\E_USER_DEPRECATED === $level) {
42 | throw new ParseException($message, $parser->getRealCurrentLineNb() + 1);
43 | }
44 |
45 | return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false;
46 | });
47 |
48 | try {
49 | $data = $parser->parse($content, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
50 | } catch (ParseException $e) {
51 | $output->writeln(sprintf('::error file=%s,line=%s::%s', $file, $e->getParsedLine(), $e->getMessage()));
52 | $exit = 1;
53 |
54 | return;
55 | } finally {
56 | restore_error_handler();
57 | }
58 |
59 | if (null === $data || !preg_match('{^[^/]+/[^/]+/[^/]+/config/packages/}', $file)) {
60 | return;
61 | }
62 |
63 | if (!\is_array($data)) {
64 | $output->writeln(sprintf('::error file=%s::A configuration array is expected', $file));
65 | $exit = 1;
66 |
67 | return;
68 | }
69 |
70 | foreach ($data as $k => $v) {
71 | if (!\in_array($v, ['', null, []], true)) {
72 | continue;
73 | }
74 |
75 | $v = preg_quote($k);
76 | foreach (file($file) as $i => $line) {
77 | if (preg_match("{^$v\s*:}", $line)) {
78 | $line = 1 + $i;
79 | break;
80 | }
81 | }
82 |
83 | if (\is_int($line)) {
84 | $output->writeln(sprintf('::error file=%s,line=%s::"%s" entry should be removed as it is empty', $file, $line, $k));
85 | } else {
86 | $output->writeln(sprintf('::error file=%s::"%s" entry should be removed as it is empty', $file, $k));
87 | }
88 | $exit = 1;
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/ListUnpatchedPackagesCommand.php:
--------------------------------------------------------------------------------
1 |
5 | *
6 | * For the full copyright and license information, please view the LICENSE
7 | * file that was distributed with this source code.
8 | */
9 |
10 | namespace App;
11 |
12 | use Symfony\Component\Console\Attribute\AsCommand;
13 | use Symfony\Component\Console\Command\Command;
14 | use Symfony\Component\Console\Input\InputArgument;
15 | use Symfony\Component\Console\Input\InputInterface;
16 | use Symfony\Component\Console\Output\OutputInterface;
17 | use Symfony\Component\HttpClient\HttpClient;
18 |
19 | #[AsCommand(name: 'list-unpatched-packages', description: 'Lists packages that are *not* patched by the PR')]
20 | class ListUnpatchedPackagesCommand extends Command
21 | {
22 | protected function configure(): void
23 | {
24 | $this
25 | ->addArgument('event_path', InputArgument::REQUIRED, 'The path where the GitHub event is stored')
26 | ->addArgument('github_token', InputArgument::REQUIRED, 'The GitHub API token to use')
27 | ;
28 | }
29 |
30 | protected function execute(InputInterface $input, OutputInterface $output): int
31 | {
32 | $data = json_decode(file_get_contents($input->getArgument('event_path')), true);
33 |
34 | $client = HttpClient::create();
35 | $diff = $client->request('GET', $data['pull_request']['url'],
36 | [
37 | 'auth_bearer' => $input->getArgument('github_token'),
38 | 'headers' => ['Accept' => 'application/vnd.github.v3.diff'],
39 | ]
40 | )->getContent();
41 |
42 | preg_match_all('{^diff --git a/(([^/]++/[^/]++)/.*) b/\1$}m', $diff, $matches, \PREG_PATTERN_ORDER);
43 |
44 | $patchedPackages = array_flip($matches[2]);
45 |
46 | foreach (glob('*/*') as $package) {
47 | if (!isset($patchedPackages[$package])) {
48 | $output->writeln($package);
49 | }
50 | }
51 |
52 | return 0;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------