< 232021-06-24⋎25 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
12:07*MatrixTravelerbo has quit (Quit: Client limit exceeded: 15000)
12:07*calbasi[m] has quit (Quit: Client limit exceeded: 15000)
14:57mstenta[m]shane_aldrich: OK - I think maybe the tarball-based approach is not going to be your best bet... since you intend to use Composer for local testing
14:57mstenta[m]The other option (which is actually what the Docker image does internally) is to use `composer create-project farmos/project`
14:57mstenta[m]So... you would start with a completely empty webroot directory and run that command in it (i think ... or maybe it's in the directory above it, i forget)
14:57mstenta[m]What that will do is download the "starter template" `composer.json` file from github.com/farmOS/composer-project and then run `composer install` on it
14:57mstenta[m]if you add the `--dev` flag to `composer create-project` then it will install all the dev dependencies too (including `drupal/coder`)
14:57mstenta[m]so: `composer create-project --dev farmos/project`
14:57mstenta[m]try running that in a different directory first... just to see if it works
14:57mstenta[m]the end result should be a completely up-to-date installation of the `2.x` branch of farmOS (not the `2.0.0-alpha2` release)
14:57mstenta[m]of course, the big consideration here is that you are then working with a "bleeding edge" installation... and it will very likely break (in different ways) if/when you run `composer update` in the future
14:57mstenta[m]so i would recommend getting in the habit of "starting fresh" each time you want to update - rebuilding the codebase and reinstalling farmOS from scratch
14:57mstenta[m]that's the easiest way to do it, without following closely all the changes that are happening in development and manually updating as you go along (which is what paul121 and I are doing basically)
14:57mstenta[m]so.... i don't know if that will be any easier for you... but you are playing with alpha software so... 🤷😄
14:58mstenta[m]it *will* probably resolve the issue you're hitting with the outdated `state_machine` module... and will provide you with the dev dependencies like `drupal/coder`... so you shouldn't need to run any `composer install/update/require` commands... but if you do then there is still a chance things will break
16:18shane_aldrich[m]Sounds good! I did extract and rewrite the files again after the error and things are back up and running. I'll copy this information into a text file for future reference. Since I have a separate webroot directory for Drupal already set up for nginx, I'll use that for testing this out moving forward. Once I get the hang of it, I'll use my `shane-farmos.edu` webroot from there.
18:08shane_aldrich[m]I finally have a working version of `phpcs.xml` in PhpStorm. So I ran "Inspect Code" on `Materials.php` with the resulting error: `phpcs: PHP Fatal error: Uncaught Error: Class 'VariableAnalysis\Sniffs\CodeAnalysis\VariableAnalysisSniff' not found in /var/www/shane-farmos.edu/vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php:24` Since this is my first time running `phpcs`, I need some help
18:08shane_aldrich[m]here to help me make sense of the error.
18:09mstenta[m]Hmm that sounds like the `coder` module has a dependency that's missing
18:09mstenta[m]how did you install coder?
18:10shane_aldrich[m]`composer require drupal/coder` after I extracted the alpha file again yesterday.
18:10shane_aldrich[m]That was run from my webroot directory
18:11mstenta[m]hmm... looks like it's part of github.com/sirbrillig/phpcs-variable-ana
18:11mstenta[m]which must be an upstream dependency of.... something.... i'm not sure why it isn't installed for you
18:12mstenta[m]but it's a clue that other things probably aren't installed too
18:12mstenta[m]can you try something for me?
18:12shane_aldrich[m]Sure
18:12mstenta[m]create a completely separate directory somewhere and run `composer create-project --dev farmos/project`
18:13mstenta[m]then look in `vendor` to see if there's a `sirbrillig/phpcs-variable-analysis` directory
18:13shane_aldrich[m]Anywhere in `/var/www`?
18:13mstenta[m]or outside of that... maybe `/var/test` or something
18:13mstenta[m]doesn't matter... all this will do is build the farmOS codebase with dev dependencies
18:15shane_aldrich[m]will do.
18:15shane_aldrich[m]`Could not find package farmos/project with stability stable.`
18:16mstenta[m]oh hmm try `composer create-project --dev --stability=dev farmos/project`
18:17mstenta[m]or alternatively, just download this `composer.json` file and run `composer install`: raw.githubusercontent.com/farmOS/compose
18:17mstenta[m](same result)
18:18shane_aldrich[m]It's running now. It didn't at first because I forgot to `chown` the directory
18:19mstenta[m]fwiw this is basically what the Docker image does when it is being built
18:19shane_aldrich[m]Is this a good way for me to "start over" when I need to?
18:20mstenta[m]yea i think so... depending on what you're doing i guess
18:20mstenta[m]and this will be the most up-to-date codebase always
18:20mstenta[m](which can be good/bad, depending on what you want)
18:20shane_aldrich[m]`sirbrillig` is there
18:21shane_aldrich[m]Would this delete `/sites/all`?
18:22mstenta[m]so... i don't think you'd be able to run this on an existing directory - i think it needs to be empty
18:22mstenta[m]but you could move your `sites` dir (and note that you want the WHOLE `sites` dir... not just`sites/all`), and then use this, then move it back
18:22mstenta[m](this is the recommended update procedure in general btw)
18:23mstenta[m](replace all but `sites`)
18:23shane_aldrich[m]That's easy enough. I can just keep a copy of `sites/all` in my home directory and copy it over afterwards.
18:23mstenta[m]yep! (but again: `sites`... not just `sites/all`)
18:23mstenta[m]oh now... this will also wipe out your phpcs.xml file
18:24mstenta[m]so you would want to save that too
18:24shane_aldrich[m]<mstenta[m] "yep! (but again: `sites`... not "> so I would be keeping a copy of `default` and all files as well?
18:25mstenta[m]ah well good question actually... if you want to keep your installed site then YES!
18:25mstenta[m]but if you are reinstalling from scratch, then no
18:25mstenta[m]`sites/default/settings.php` is where your database credentials get saved
18:26mstenta[m]so if you wipe that out, you can't connect to the database anymore
18:26mstenta[m](which is fine if you're reinstalling from scratch)
18:27shane_aldrich[m]Back to my `phpcs` error. For now can I install the `sirbrillig` dependency via `composer`? If so, what's the proper way?
18:27shane_aldrich[m]NM
18:27shane_aldrich[m]I should just look at the link you sent. DOH!
18:33mstenta[m]ah well... how about you just replace your old code with the one you just built?
18:33mstenta[m]copy your `/var/www/web/sites` directory to `/var/test/web/sites` (or wherever it is)... then wipe out `/var/www` and `mv /var/test /var/www`
18:33mstenta[m]?
18:33mstenta[m]then you'll have `sirbrillig` AND everything else that you might be missing
18:34shane_aldrich[m]Sounds good. Need to take a quick break. I'll report back when I get that accomplished. This is actually really fun!
18:47shane_aldrich[m]About to move the sites directory. Would this be the proper way: `sudo mv -f /var/www/shane-farmos.edu/web/sites /var/test/project/web/sites`?
18:47mstenta[m]I would `rm -r /var/test/project/web/sites first`
18:48mstenta[m] * I would `rm -r /var/test/project/web/sites` first
18:48shane_aldrich[m]OK. That way I don't have to use `-f`
18:48mstenta[m]yup!
19:09shane_aldrich[m]Site still works as expected. But `phpcs` error is still there. It has to be something in PhpStorm. Probably a mapping issue. I'll look into it further after I work on my new sourdough starter (last one bit the dust).
19:10mstenta[m]huh - yea maybe it's PHPStorm?
19:10mstenta[m]try this (when you're back): `vendor/bin/phpcs web/profiles/farm`
19:11mstenta[m](executed from your `/var/www/shane-farmos.edu` directory)
19:11mstenta[m]that will execute `phpcs` from the command line... taking PHPStorm out of the picture completely
19:11mstenta[m]curious if you get the same error in there... if so, then it's not a PHPStorm issue
20:14shane_aldrich[m]That ended up with a ton of errors. Too many to scroll through. I'm going to try it on my Materials module directory now.
20:15mstenta[m]oh no
20:15mstenta[m]:-(
20:15mstenta[m]oh... but do you have the `phpcs.xml` file in `/var/www/shane-farmos.edu`?
20:16mstenta[m]that's necessary to tell `phpcs` which rulesets to follow
20:16mstenta[m]so maybe it was using defaults if that wasn't present?
20:16shane_aldrich[m]I do have it there.
20:16mstenta[m]oh hm
20:16mstenta[m]OH! there's another step i think...
20:17mstenta[m]try running this: `vendor/bin/phpcs --config-set installed_paths /var/www/shane-farmos.edu/vendor/drupal/coder/coder_sniffer`
20:18mstenta[m](if you hadn't done that a while ago... i pasted it the other day i think)
20:18mstenta[m]that tells `phpcs` where the `drupal/coder` rulesets can be located
20:18mstenta[m]so maybe the errors were due to that
20:19mstenta[m](that's my last idea haha)
20:20shane_aldrich[m]I just ran that. Then ran `phpcs` on my `Materials.php` file and got this: ` 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
20:20shane_aldrich[m] | | "\r\n"`
20:20mstenta[m]ah ha! i think that's progress!
20:20mstenta[m]try running it on `web/profiles/farm` again... curious if that works
20:21shane_aldrich[m]I do too!
20:21mstenta[m]that `"\r\n"` thing is because you edited the file with Windows I bet
20:21mstenta[m]softwareengineering.stackexchange.com/qu
20:22mstenta[m]here's how to fix i think: stackoverflow.com/questions/40470895/php
20:23shane_aldrich[m]So all "errors" on that run are the same. None of those have been edited in Windows. Those all reside on my Ubuntu 20.04 wsl2.
20:23mstenta[m]can you paste one of the errors?
20:23mstenta[m]oh you mean they are all the same `\r\n` error?
20:24shane_aldrich[m]Yup
20:24mstenta[m]ah ok! so somehow those got changed
20:24mstenta[m]here try this...
20:24shane_aldrich[m]There's a ton of files. So scrolling through my terminal window is a long process. ;)
20:24mstenta[m]cd web/profiles/farm
20:24mstenta[m]git status
20:24mstenta[m]does that show that files are overridden?
20:25shane_aldrich[m]`HEAD detached at ddff8205
20:25shane_aldrich[m]nothing to commit, working tree clean`
20:25mstenta[m]hmm strange
20:25mstenta[m]shane_aldrich: do you have interest in a quick Zoom to look at it together?
20:25mstenta[m]i'm around for a few mins
20:26mstenta[m](no pressure - just if it's easy)
20:26shane_aldrich[m]Here is the last line after doing the composer command to build the project: `Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? y`
20:27shane_aldrich[m]Maybe that did it? I can probably do a quick zoom in about 15 minutes. Girlfriend is doing laundry right next to me and it's noisy. 😜
20:29mstenta[m]hmm not sure
20:29mstenta[m]the fact that you were able to run `git status` in `web/profiles/farm` and see `ddff8205` means you have a `.git` directory there and it's up to date (that's the latest commit)
20:30mstenta[m]it's strange that `phpcs` is telling you that there are `\n\r` occurrences in `web/profiles/farm` though
20:30shane_aldrich[m]Weird that files that haven't been touched in windows would have that. Hmmm
20:32mstenta[m]yea... but also weird that `git status` doesn't show any files as changed... those two things are contradictory
20:32mstenta[m]so i'm not sure i trust the `phpcs` output...
20:33mstenta[m]can you copy and paste the last error from that `phpcs` run?
20:33shane_aldrich[m]`FOUND 1 ERROR AFFECTING 1 LINE
20:33shane_aldrich[m]--------------------------------------------------------------------------------
20:33shane_aldrich[m] 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
20:33shane_aldrich[m] | | "\r\n"`
20:34mstenta[m]that's from `web/profiles/farm` ? or the material module?
20:34shane_aldrich[m]`web/profiles/farm`
20:35mstenta[m]ok does it tell you what file that is for?
20:35mstenta[m](should)
20:35shane_aldrich[m]`modules/log/lab_test/farm_lab_test.module`
20:35mstenta[m]so strange
20:36shane_aldrich[m]indeed. I could understand if it was only on my module.
20:37mstenta[m]yea... so here's my new theory (bear with me haha):
20:38mstenta[m]maybe git doesn't actually detect changes to line endings. so maybe the line endings were changed (somehow) but those changes are not showing up in `git status`.
20:38mstenta[m]but `phpcs` does
20:38shane_aldrich[m]Maybe it's the `phpcs.xml` file I edited.
20:38mstenta[m]now... those line endings are DEFINITELY not wrong in the upstream farmOS, otherwise we would see those same `phpcs` errors in our automated tests
20:39mstenta[m]> maybe git doesn't actually detect changes to line endings
20:39mstenta[m]this whole theory hinges on this ^ - which we can probably find out if that's true or not...
20:39shane_aldrich[m]Let's do some testing
20:39mstenta[m]well so... let's focus on material module for a moment...
20:40mstenta[m]open PHPStorm, and the first thing to do is make sure it's configured to use Linux line endings
20:40mstenta[m]> here's how to fix i think: stackoverflow.com/questions/40470895/php
20:41mstenta[m]then open the material module file that had the `phpcs` error and Ctrl+s (save it) ... this *should* change the line ending automatically... then rerun `phpcs` on that directory
20:41shane_aldrich[m]Looking at that now. But it's a bit dated. Give me a couple minutes.
20:43shane_aldrich[m]So I changed `Materials.php` to use `LF` from the bottom bar in PhpStorm, saved the file, ran `phpcs`. No error.
20:43shane_aldrich[m]Which still doesn't explain all of the other files.
20:44mstenta[m]ok!
20:44mstenta[m]that's great!
20:45shane_aldrich[m]Progress!
20:45mstenta[m]yea... so i'm not sure how all the farmOS files changed either... but that's not a big deal until you're working in the farmOS codebase itself...
20:45mstenta[m]oh this might be relevent: stackoverflow.com/questions/20496084/git
20:46shane_aldrich[m]I agree. I'll get my modules to switch over to `LF` and run some tests.
20:46mstenta[m]gotta run! ttyl
20:55shane_aldrich[m]FYI
20:55*uploaded an image: (119KiB) < libera.ems.host/_matrix/media/r0/downloa >
20:56shane_aldrich[m]From PhpStorm using "Inspect Code". More progress!
22:19*med65[m] has quit (*.net *.split)
22:19*wgardiner[m] has quit (*.net *.split)
22:19*skipper_is[m] has quit (*.net *.split)
22:19*symbioquine[m] has quit (*.net *.split)
22:19*JSimonGoodall[m] has quit (*.net *.split)
22:19*HarishankarEthir has quit (*.net *.split)
22:19*GerardoLisboa[m] has quit (*.net *.split)
22:19*cw28cycles[m] has quit (*.net *.split)
22:19*farmtech[m] has quit (*.net *.split)
22:19*kta[m] has quit (*.net *.split)
22:19*JulianF[m] has quit (*.net *.split)
22:19*NausiyanNyancurr has quit (*.net *.split)
22:19*irissc[m] has quit (*.net *.split)
22:19*kunigunde[m] has quit (*.net *.split)
22:19*NicholasPetrakak has quit (*.net *.split)
22:19*wirelessrpm[m] has quit (*.net *.split)
22:19*mstenta[m] has quit (*.net *.split)
22:19*paul121[m] has quit (*.net *.split)
22:19*ssoyrnoz[m] has quit (*.net *.split)
22:19*shane_aldrich[m] has quit (*.net *.split)
22:19*jgaehring[m] has quit (*.net *.split)
22:19*manikandanmanive has quit (*.net *.split)
22:19*IrfanAinuddin[m] has quit (*.net *.split)
22:19*jpeg[m] has quit (*.net *.split)
22:19*artu[m] has quit (*.net *.split)
22:21*artu[m] has joined
22:21*JSimonGoodall[m] has joined
22:21*HarishankarEthir has joined
22:21*GerardoLisboa[m] has joined
22:21*cw28cycles[m] has joined
22:21*med65[m] has joined
22:21*wgardiner[m] has joined
22:21*skipper_is[m] has joined
22:21*symbioquine[m] has joined
22:21*farmtech[m] has joined
22:22*irissc[m] has joined
22:23*cw28cycles[m] has quit (Ping timeout: 240 seconds)
22:23*NausiyanNyancurr has joined
22:23*kta[m] has joined
22:23*JulianF[m] has joined
22:23*artu[m] has quit (Ping timeout: 252 seconds)
22:23*shane_aldrich[m] has joined
22:23*ssoyrnoz[m] has joined
22:23*paul121[m] has joined
22:23*mstenta[m] has joined
22:23*wirelessrpm[m] has joined
22:23*NicholasPetrakak has joined
22:23*jpeg[m] has joined
22:23*IrfanAinuddin[m] has joined
22:23*manikandanmanive has joined
22:23*jgaehring[m] has joined
22:23*kunigunde[m] has joined
22:27*med65[m] has quit (Ping timeout: 240 seconds)
22:27*wgardiner[m] has quit (Ping timeout: 240 seconds)
22:27*skipper_is[m] has quit (Ping timeout: 240 seconds)
22:27*symbioquine[m] has quit (Ping timeout: 240 seconds)
22:27*JSimonGoodall[m] has quit (Ping timeout: 240 seconds)
22:27*HarishankarEthir has quit (Ping timeout: 240 seconds)
22:27*GerardoLisboa[m] has quit (Ping timeout: 240 seconds)
22:27*farmtech[m] has quit (Ping timeout: 244 seconds)
22:27*NicholasPetrakak has quit (Ping timeout: 244 seconds)
22:27*wirelessrpm[m] has quit (Ping timeout: 244 seconds)
22:27*mstenta[m] has quit (Ping timeout: 244 seconds)
22:27*ssoyrnoz[m] has quit (Ping timeout: 244 seconds)
22:27*jgaehring[m] has quit (Ping timeout: 244 seconds)
22:27*manikandanmanive has quit (Ping timeout: 244 seconds)
22:27*IrfanAinuddin[m] has quit (Ping timeout: 244 seconds)
22:27*jpeg[m] has quit (Ping timeout: 244 seconds)
22:28*kunigunde[m] has quit (Ping timeout: 272 seconds)
22:28*irissc[m] has quit (Ping timeout: 268 seconds)
22:28*kta[m] has quit (Ping timeout: 272 seconds)
22:28*JulianF[m] has quit (Ping timeout: 272 seconds)
22:28*NausiyanNyancurr has quit (Ping timeout: 272 seconds)

< 232021-06-24⋏25 >