Jump to content

git submodule for wire


tibs
 Share

Recommended Posts

I'm in no way a github guru, and I may be missing a lot about the implications of what I'm about to suggest, so please bear with me even if it's completely moronic. It's Christmas, after all :)

When a PW site is installed, the original structure is destroyed. In other words, that neat looking .git directory becomes completely meaningless. On the other hand, the wire directory isn't ever touched and, as I see, upgrading PW is done exactly by replacing that directory (and the index.php file, though I believe that one hardly ever changes).

So, the suggestion: Why not make the wire directory a separate github project, referenced from within ProcessWire as a submodule? Downloading PW would now take a git clone --recursive ... (I know, it's overbearingly complex) but upgrading would be super easy, just a single git command. For additional magic and peace of mind, index.php could be moved inside wire, and the original could be just one line to require it from there.

  • Like 1
Link to comment
Share on other sites

The processwire repository is a place to keep "processwire development". So it's git repository is not meant to comply with anything other than that usecase (the site directory is even excluded). For your own projects you can create a own repository how ever you want. While submodules sound like a great idea it's not used by many, because it's workflow is far from optimal.

Also, why technically moving the index.php's logic would be possible, that strategy does not work for the .htaccess file, which is also changed every now and then dependent on the processwire version. That file does need to be in the root directory to work correctly.

  • Like 3
Link to comment
Share on other sites

  1. adding a useful use case at practically zero cost (as i understand it would be) is not a bad deal

a component that is developed and used in a mostly independent fashion to get its own repository sounds like an improvement to the workflow

index.php would still be there (as a stub like "<?php require 'wire/index.php';") so .htaccess would need not be changed (as for where it is stored, it isn't part of the installation, it's generated (well, copied) at installation; its template could be anywhere (i.e. within wire))

upgrades from a php viewpoint remain the same: having the code hosted in a submodule changes nothing to whether that code can alter stuff (e.g. the .htaccess file) from outside its tree (e.g. after a pull when PW decides there are upgrades to do: for php, it's the same as if the new version was manually copied, like we do it now)

Link to comment
Share on other sites

Why not using existing methods? As @LostKobrakai said, git submodules are not used by many because of the peculiar workflow.

There is a module to handle core upgrades: Core Upgrade. Or - if you're familiar with using git - you may consider using wireshell, this is a command line interface like drush for drupal. Instead of  `git submodule update` just execute `wireshell upgrade`. If there are no changes the `index.php` and `.htaccess` files are updated as well.

  • Like 3
Link to comment
Share on other sites

As far as I understand tibs (just correct me if I'm wrong), his issue is not about how to update PW with one line of cli command or how to update with a few clicks, but it is about how to utilize the official git repo, since this method would fit his workflow, and he thinks that it might be possible to support both the "ProcessWire development" and personal projects based on a workflow he describes.

  • Like 2
Link to comment
Share on other sites

  1. adding a useful use case at practically zero cost (as i understand it would be) is not a bad deal
  2. a component that is developed and used in a mostly independent fashion to get its own repository sounds like an improvement to the workflow
  3. index.php would still be there (as a stub like "<?php require 'wire/index.php';") so .htaccess would need not be changed (as for where it is stored, it isn't part of the installation, it's generated (well, copied) at installation; its template could be anywhere (i.e. within wire))
  4. upgrades from a php viewpoint remain the same: having the code hosted in a submodule changes nothing to whether that code can alter stuff (e.g. the .htaccess file) from outside its tree (e.g. after a pull when PW decides there are upgrades to do: for php, it's the same as if the new version was manually copied, like we do it now)

You're making good points there, but to be completely fair that's your point of view. I'm not so sure that Ryan feels that way, and I certainly wouldn't. Even if it's just a question of committing some changes to separate repository and keeping track of two repositories for issues etc. in my opinion it seems like added workload and complexity compared to current situation.

The point with .htaccess is that while you've suggested this as something that would make upgrading as simple as one git command, the .htaccess file is exactly why this isn't true: it may require manual changes, and thus that single git command is only a partial solution. Note that I'm not saying that making the index.php file a placeholder would be a bad idea in itself; I'm referring to the bigger context here.

Finally, I believe that you can already upgrade your site with a "git pull". The only downsides I can see are that a) it won't upgrade index.php or .htaccess, b) you'll probably have a bunch of unnecessary site-* directories, and c) it will also pull in some other unnecessary files, like a htaccess.txt (.htaccess should prevent direct access to these).

Please correct me if I'm getting something wrong here, writing this in a bit of hurry and probably not thinking everything through :)

Link to comment
Share on other sites

Thanks for the responses! To be honest, it's not like I'm on a crusade to make this happen, it's just an idea that I kept reminded of so I thought why not throw it out there. (Reading back on my posts I may say sorry if my tone implied otherwise; I was just focusing on the arguments too much  :lol:)

@teppo I think whatever I meant by the .htaccess thing ignored the case of having to make manual changes; I had the impression the upgrade process takes care of that.

@szabesz yes I think you're partially right: it would just look "cleaner" haha. I'm not that concerned about my workflow; strict convictions about small things bring about much overhead  :P

@justb3a thanks for wireshell! I haven't seen it before, I just checked it out, it looks awesome! (omg drush reminds me of much struggling with drupal)

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...