Comments (4)
@artfulrobot Yup,#2
is exactly what #254 implements. 😄
from civix.
@artfulrobot It might be a good idea. Let me share a couple related thoughts first:
- In the current implementation, there is a de-facto requirement to run
civix upgrade
before running other commands. The problem is that many commands will regenerate files from the latest template regardless (eg they'll regen*.civix.php
). Doing this separately (without a priorcivix upgrade
) leaves the code in an inconsistent state (eg stale references tohook_alterSettingsFolders
; eg missing the replacementsettings-php
). - I suspect this usability issue is at the root of #244, #250, #252. I've probably hit it once or twice on my own.
- In #250 (comment), there's some discussion about a way to address it.
- I'm open-minded that there could be other flows that leave inconsistencies. But I don't know of any -- so I can't really comment about that. (I'd need to see some example commands or example repos.)
- I have sometimes flirted with the idea of
civix advisor
orcivix refresh
command -- as an alternative tocivix upgrade
.- Both
civix upgrade
andcivix advisor
are conceived as migration-support, but they would be framed a bit differently. I wouldn't want to maintain two implementations of "migration-support". - Comparison:
civix upgrade
would (does) track a<format>
version. It checks the start version and then walks through each incremental update. It makes suggestions and applies changes.- (Ex: "If you start with format<22.05, then it will prompt you about removing
alterSettingsFolders
and enablingsetting-php
. After you set format to 22.05, it will won't bother you about that")
- (Ex: "If you start with format<22.05, then it will prompt you about removing
civix advisor
would scan the codebase for tell-tale signs of old/new code patterns. Based on the patterns that are present or missing, it would makes suggestions.- (Ex: "If your extension has
*.setting.php
, then it will prompt you about enablingsetting-php
. If it lacks*.setting.php
, then it will prompt about disablingsetting-php
. In either case, it will prompt about removingalterSettingsFolders
.")
- (Ex: "If your extension has
- There's probably a lot of overlap in how these two would work. In writing
upgrade
rules, I've tried to use/consider a lot of guards/edges (as one would foradvisor
rules) -- and I suspect most could be converted, although I'm not certain. - Maybe there are some trade-offs? Maybe trade-offs in questions like:
- How deeply does it have to scan? How does that perform?
- When implementing a check/migration... how many edge-cases do you have to consider?
- How opinionated is it? Does it strongly push ext's to be organized the same? Does it allow them to evolve in unforeseeable ways?
- How well does it heal from mistakes or unexpected code/patterns?
- Can it (should it / how does it) perform a pre-flight validation? (eg "Don't run civix commands unless you know the starting-point is clean")
- Both
Anyway, that's a bit of rant. I need to stop typing. :)
It leads to a situation where it kills Civi until you can resolve it. I've sometimes found removing the civix version from info.xml and re-running
civix upgrade
provides a fix.
I wonder if it would make sense to have an option like civix upgrade --reset
or civix upgrade --all
or civix upgrade --from=<version>
?
from civix.
@artfulrobot I've added an option civix upgrade --start=0
which will replay all the upgrade checks.
Closing because #254 and #255 should reduce the incidence a lot. Released v22.07.2.
There could still be scenarios for something like civix repair
or civix advisor
, but I would need more concrete examples. Feel free to reopen or file related issues.
(An ideal report is probably something like "Clone the repo https://foobar.git
, run these two commands, and see an error".)
from civix.
Thanks @totten, makes sense.
there is a de-facto requirement to run civix upgrade before running other commands.
I didn't know that, I suspect that's where I've fallen down.
Wouldn't it make sense to either:
-
internally call
upgrade
before calling whatever the user specified (e.g.generate:angular-module
: that way you'd ensure the code was up-to-date, or refuse to run.or
-
check the info.xml
<civix-version>
<=
running civix version before running a command, and refuse to run if not, suggesting acivix upgrade
is run?
from civix.
Related Issues (20)
- create composer.json on `generate:module` ? HOT 1
- civix generate:entity-boilerplate Not generating SQL in correct order for dependancies HOT 3
- civix the hook_civicrm_menuXml is gone HOT 5
- Teach civix about the [email protected] mixin HOT 6
- generate:entity-boilerplate errors output in auto_install.sql HOT 4
- generate:entity-boilerplate clean up issues HOT 5
- Boilerplate tempate(s?) idea
- Menu mixin problem on older version of civi HOT 9
- php8 - civix upgrade - preg_match(): Passing null to parameter 2 ($subject) of type string is deprecated in src\CRM\CivixBundle\Upgrader.php on line 244 HOT 1
- Failed to locate scan-classes@1/mixin.php HOT 2
- `Civibuild create` fails with Redis due to cached extensions HOT 3
- php 8.1 compatibility HOT 2
- Smarty local mix-in missing? HOT 4
- php codesniffer warnings HOT 2
- Civix could (or should?) offer in-line-replacements for dropped deprecated functions HOT 9
- Error running generate:module HOT 5
- Civix 23.08.1 Fatal Error with php 7.4 HOT 4
- Support setting-admin mixin HOT 1
- Database Upgraders - Continuing support for <5.37? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from civix.