 William McDaniel, shipping content of the PCLI and Long Beach testing, and why that is awesome. William McDaniel is a developer advocate at Pantico. He has had the privilege of presenting dozens of community events for Barist, Iceland, and for MIT to stand with. He is a manager of Curio and Crochet. Today he is sharing this content deployment pipeline that lets you write and markdowns and automatically test and publishes to his WordPress blog and the lessons he learned along the way. He looks at the curve to see if you can keep up with some of these technologies and leverage them in your own work. Please find the slides online at www.gmail.com and follow along. Now clap your hands together and tell us what we're doing. Hello everyone, I'm Wayne, and this is where I introduce myself to good people. I work at Pantico, I'm good back to that in a second. I enjoy a lot of things. I definitely enjoy tech. That's why I work in industry, but I'll appreciate it. I'm really into it right now. If you want to talk about comic books or Curio, hit me up. Twitter is my preferred medium, just like Bridget over here. I really appreciate people following me or tweeting at me. In fact, I have a project at home this year, a Twitter-based project. I'll talk to you, so you can bear with me for a second. If someone can take a picture of me in portrait mode, stand with me here. Portrait me in front of this picture and tweet it at me, I would greatly appreciate it. This is my inception project 2018. So far, this is the 25th talk I've given. I've got a lot of meetings. Alright, we'll get back to the residents' present program now. I'm going to run around the stairs. Don't worry, I'm trying to get there. Alright, so I work at Pantheon. We have a booth out there. Two of them talk about automation, scale, and doing things in a professional way. To make them very scalable, collaborate with large groups of people. That's a word we'd love to talk to you about all of those things. Automation to the limit. In fact, that's really good for my talk today. It's automation. So I want to know what's in the room. Who came in this room because they saw this on the schedule and said, I want to know that talk. Alright, feel the three of you. Here's why you're here, but we'll get to that. Who here is a developer full-time? Who here is a designer? Alright, designers, current developers, vice versa. Who here does project management? Who here writes content on a regular basis? This talk's actually for you. I think everyone knows we get something out of it. Okay, come on in. I guess not. Alright, is anybody here, any business owner or anything else that I've missed in that? You might get something out of this too. So I have sold this as a talk about should-be content with WPC live. And that's true. It's very much the heart of what I'm doing here. But let me show you exactly what I'm doing here before we go any further. And it's a little bit hard to see with the bright lights in here. This is a YouTube video. Again, you can find all my slides online and watch this later in time. In the future. WPC.com. I have a development environment for it. And I wrote this little tool called Post-It Now. And I can feed it files or I can just have it grab it straight from a GitHub account or I can sync all my docs to. Give it a permalink. Give it a picture. Name the picture. The picture actually fails to be all tags. All tags. A tag it. And then all the machines run it from there. It's sped up a little bit. Especially at one quarter toward the end. But there, I've just successfully built that content to my database. What we're seeing there is Backstop. Or not Backstop. It was a behavioral testing to see if it broke when I wrote that. Now I'm shooting that content over to my test environment. Should have done that. Now I'm running something called Backstop. Which I'm looking at Pixel from Pixel. Between the test environment and the data environment. It's at the same site. If it's the same site as Backstop, it should be in here. Pixel. I'm going to go into production. I do have an able stuff there because I do a lot of testing with it. And I don't want to push all of my tests to production. So there's building to the lab environment. And watch this in a long time. So it was a good, fast-streaming brain. You go to the actual site. And there it is. That's the thing I just created from a text file on my desktop. And if you're a normal person, or never seen this before, you're probably thinking, what the heck just happened? I came in here to talk about moving content around. You got to show a weird video. And you did. This is what you just saw. You just saw me take content that I wrote locally. It doesn't matter the text that I wrote. Pump it a little bit of data around it. And push it to the development environment. Then test that behavior of the content that got loaded into the development environment. See if it didn't break. How many people have ever published something and realized that Twitter didn't unfurl? Because you didn't select your own. Yeah. Or that your YouTube video did not work at all. Yeah. These things happen all the time. So then if that all works, then I push it to my staging environment. Or my test environment in this case. And then I test it again to see if Pixel to Pixel is at the same site on depth. Then it didn't break upon transport. Because I can think of the same between these environments. And if it is, well, I trust it. That means it's probably going to work when I push it to another environment. And then I'll show it to the prod. And the prod is where it actually looks. That's where you can go to see that actual post on ncgoing.com. The person who actually named this talk, by the way, would give. He's not here this weekend, I don't know what she was. But he said I'm like 0.02% of users. And I don't think he's wrong. Why would I build something like this? Ultimately because I'm kind of lazy. I know that sounds very counterintuitive. But I read a blog. I'm just eating away.com. I read about my travels. If you want to see where I do at all the word camps I go to, I'm going to do 30 events this year. So I'm going to blog. And maintaining a blog requires you to launch a little things. A lot of it. None of them are fatal. None of them are undoable. None of them are unsurmountable. But it's like a death-level of paper cuts. Who really likes going in and selecting H1s? Or H2s? Yeah. And then maintaining that stuff over time. Well, for maintaining my website, I thought I needed a bunch of stuff already. So I said, why not? I just applied that good thing to my website. It doesn't just a good and bad thing happen. And then we'll talk about some of those pluses. But there's one minus that I wanted to sidestep. And I'll come back to that a little bit later. So I had a set of goals. Funnily, a lazy person who doesn't want to spend all my time building posts and mainly testing things and doing things. So I said, OK, what do I actually care about? What do I actually honestly care about? First, I want to get the right road where I want to ride. I want airplanes a lot. This is 27, 28th round trip. So I'm in a lot of planes. Google Docs does not work on airplanes. Offline mode kind of does. But I never know. I'm going to actually use a lot. In fact, this is the blog post I'm writing right now about the event we're at at the moment. It just works. I think the admin is really slow. And if I can avoid logging into WP Admin, I do. Most things, this is beautiful. For most things, you can do things like... Well, the allies arrow, it does a couple of commands against a series of websites that I maintain. It shows me, oh, here, OK, I'm up to date on this website. And there's the themes that's up to date. I don't have any junk in there. And I don't even like that a lot faster. Just a lot faster. But moving data around, moving content around, which is an exceptionally cool thing WPC like can actually do, gets pretty complex. And if you just manually are doing this, you're actually doing way more work than just logging into WP Admin and just doing it there. Or so I found out. When I first found out that WPC like could ship content around, I started playing with it. And the essence is actually how I made this real close. You can go copy and paste this. It won't work for you because you don't have the same GitHub, but actually it probably wouldn't work for you if you want access to the site that you're in now. So that let me believe that if I'm going to do all this stuff, I should monetize it. I should make something out of it. I should build a tool that I can further extend as I'm going further with my user case. And I can reuse over and over and over again. So instead of handwriting something that looks this crazy, I can just tell it what the kernel link is and feed it some alt tags to all the different tags. And I'm going to make less mistakes. The pain in my existence is posting something and then realizing that a day later that it's been wrong since I posted it. And there are just some things that break when you do them like Twitter and YouTube are the biggest ones. And I don't want you guys to hover over my machine just looking for every possible error. Now I have a single blog site but I'm looking at one post at a time. I can't imagine meeting every single post if I was like working with a lot of people. So that's in the back of my mind as well. So these are my basic goals. I want to write the text editor of my choosing. Goober is the fine content editor. Adelaide is a great text editor. I'll get to that in a minute. And then we're all under my WPA then ever again. That means I can automate things because I can start doing things through command line. I can use extend and share and make less mistakes. So what I ended up building was this. Don't worry. This looks like the giant pile of Legos. I'll go through it and make this make a lot more sense. And what I discovered in the process is that yes it is a giant pile of Legos but Legos you can build anything out of. And WordPress is an amazingly powerful tool that helps in this giant pile of Legos do amazing things because there's one technology among hundreds of technologies that you could be applying to your daily lives to make your lives better. It's a central piece for what is WordPress at its very core. A CNS, content management system. In the title it tells you what it literally is. It's not designed or initially conceptually to be anything besides a CNS. We've extended it to do those things. But as we're seeing the couple's run-ins take hold and Gutenberg honestly is a couple editing product experience. That WordPress's role in all of this becomes well super critical to what we're building next. And I firmly believe this. This is why we're going to be such a large part of the web. It's not because we're going to have more websites it's because we're going to have more rich interactive web experiences through things that we can't imagine right now. The next two years it's how fast technology changes and probably come up with new experiences. There's VR out there right now that's fun and games but who knows what that's next. And WordPress can serve a very critical role there. If we embrace it as part of the gears, as part of the systems. That's not one thing. You spend all your time worrying about just WordPress. You're missing the bigger picture. And that's with this experience for the top. So let's talk about how I do it. And I don't think for you to walk out of the show and go grab the tool that I built and go run with that as the way you do everything. But hopefully it will see, well I didn't know that existed. Or wow, that's how you show that. And my opinion to my opinion is one of the things I firmly believe in and Bridget actually mentioned earlier in her talk is I believe in Markdown. Markdown is super hyper-transportable. It works everywhere. Reddit uses Markdown. GitHub uses Markdown. And Aspera, like a laundry list of other websites basically wants you to write Markdowns. It's super-transportable. And it's way faster. So I can write things in the left that turn out like they are on the right. In H1 it's one hashtag. In H2 it's two hashtags. If I want to make a link, it's open-close square bracket followed by parentheses. And that's the text that I'm linking. It's that simple. It's that quick. So this blog post that I'm writing right now, as I'm at the event, that's the link to where that talk lives on, on the site. And there is the Twitter name of the person who gave the talk. I have a very formal link with this stuff. A lot of Twitter links. I've got to have myself talking about that. Go definitely go with PDI. And then this is a match with a thing called Gutenberg. Gutenberg can do things. You just get some raw URLs. And it knows what that raw URL is. It will just turn it into a block. That's pretty magical. Like if I just fed a line into most text editors, it's going to sit there as a line of text. But I'll feed that same URL to Gutenberg. It's like, oh, what's the deal with this? You don't want to have Twitter blocks. This is Twitter. Great. We're all good. And these two things work together very beautifully because, as Matt Baldwin said from stage before Camp Hero, his favorite part about all Gutenberg is that you can copy paste into it and it will take whatever you're pasting as how it's supposed to be pasted. Meaning you can probably say markdown. You can mention markdown by name. Posting markdown means you transform upon rate. Plus that other cool ability of links just transform and I'm not worried about how to build a block. I'm worried about giving the naked URL to the tweet that I want to expose. The copy paste is manual. And again, I'm trying to avoid logging in and using an editor that I have to copy paste into because I don't want machines to do the work for me. Because again, fundamentally I'm lazy here. It doesn't sound like I am, but I swear that's why I do this. That means I can create my content anywhere in the world and move it to any other place in the world. I'm personally in love with WPCLI. It is an amazing tool. You can do so much with it. It's so powerful. You can script with it. But one of the things you can do that I'm not a lot of other CMS, command line for a CMS I know of other than WPCLI can do this lets you actually create manipulated content directly. That's an extremely powerful feature. Which means I can create content to put it somewhere and then have the CMS itself correctly build it into another environment. Which means I never accidentally blow up a database ever again. Because a tool that was meant to do the job did the job in a way that was meant to be done by the WordPress way. I didn't accidentally touch a database I wasn't supposed to. I didn't accidentally wipe out a table. I'm really bad at writing simple. WPCLI on my server of choice my server of choice is happening. It turns out that it actually solved a whole set of problems. When I was doing all this I was trying to go around with the REST API. And it turns out that the problem to use the REST API to do content manipulation around the world is authentication. Which makes sense. You can authenticate to be able to do a thing. It's not quite in the REST API not really yet. You can build your own low off routes but that's not what I want to do. Terms like side stuff that since I was authenticating to my host I could just piggyback on that authentication to do all this stuff from the database and from the install that I wanted to using the command line. As far as this idea of transform upon. So if my copy paste goes through the editing experience it knows what to do. You copy paste it in and you're good. If you just tell Hooper here's data shove it in through the API it's like well I guess you wanted me to display it directly as it was shown. What will happen soon in something that Jetpack and WP Markdown already solved you can go in in your editing function and just click the button and if you've got Jetpack where it just installed this and you want the lightweight version of all this it will do something called transform upon rate. Which means you shove in data and it's like oh I know what to do with this. You shove in the data that you want me to transform. It's a special hook in there that it runs. That all means that this which is pretty much the text file that I showed in that video becomes this when I push text that I store on K-Bub that I get everything Markdown can give me which is everything HTML can give me because Markdown is just ultimately a shortcut to HTML. Who likes writing tags I can't manually write in tags? Yeah, well I kind of do too but it's slow. It's way slow. And then forgetting to close a tag I don't want my IDE yelling at me any more than it needs to. But that seems really airing doesn't it? Like there's a lot of moving pieces now. Like I'm writing over here and I'm pushing over here and I hope it works right? And I'm not learning the visual experience so I can't see I'm really excited and I'm losing that. That's what Behad comes in. Behad is a behavioral testing framework. Does anybody here use or have heard of Behad before? It's a really simple one. It's written for the business user. It says let me write a test in plain English and let me run that test in plain English and give me the results back in plain English. There's an extension for it called WordHap that lets it work with WordPress like that that you don't have to write almost a drop of PHP. Actually in a perfect scenario I'm just filling in blanks pulling off a list off of recipes combining the ingredients and the word around them and that's how I write tests and this is actually what a Behad test looks like this is the actual feature of what a test inside of Behad is called it's called the feature and that is the scenario at the bottom. So I as a special word that is saying me as a user. Scenario I'm searching for everything in Twitter links given that I am on the homepage and I follow a bookmark an ID for one specific section of my website I follow that with some latest posts I should not ever see slasheshquitter.com because that means I didn't know the world between I'm located right in Behad Test Action News like I am a person given this information when I do this this should happen in this world this happens I should see this pretty fast to write this stuff so I'm slowly over time adding more and more features to my repository as I go as I see this because it means that I can not just test what I originally thought I was going to test but over time improve based on the errors I've seen and eventually test for everything that could go wrong on my site slowly over time then there's backstop the other half of my testing suite is inside so behavioral testing is awesome for testing to see when to curl and whatnot backstop says pixel to pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel pixel and showing purple where it's at and it solves this problem. It works here, but it doesn't work over there. How many people ever push something from a local to a server and it screws everything up? Yeah, that's how local development environments work. There are ways you can improve that, but that's the nature of the beast. So that's why I'm allowed to develop a server in this because my web server is the exact same environment as my station server. It's the exact same environment as my live environment. Because these things happen. And this last one is one that concerns me the most and where I hope everyone walks out of their own thinking about Gutenberg with this in mind. The whole point of where we got to up till now in the CMS world is separating the concern of configuration from content itself. We shouldn't have to worry that my configuration is going to blow up because I changed a bit of content. Gutenberg, for all the pluses and minuses of it, reintroduced the concept of marrying together configuration-specific content and letting put configuration-specific content inside of configuration-specific content called the messy block. They don't use this yet. It's an extremely powerful tool. You can build columns like that that do various cool things, literally dragging and dropping. You better know what the configuration doesn't mess up with that. That's where the testing comes in, why this is important. If it works here and it works here, I know it's going to work over here, but if it works here, for some reason when I shift it over, the configuration is screwed up. Uh-oh. What do I got to fix? I'm doing this all before it gets to my life's sake. And then ultimately, what I discovered, what this talk really honestly is, but Matt Cromwell actually said that was a bad name for a talk, this is the general song of the batch. Who here uses the command line in another machine? Yes. You already know what I'm talking about. The other people open up your terminals, go get batch, install get on your machine, and open up get batch, the batch, the bargain shell. It's super, super, super powerful. Let's do things like this, without a lot of work. Let's me do things like this is all alias, but I'm just going to look at SFO. What's weather like back home? I see someone who agrees, a lot of smoke, they're on fire right now. The city isn't, but the present state is. Let's do things where I can make scripts and write really complex ideas. Without a lot of work, without a lot of, once I've processed and processed the thought, you can write new scripts that do fun things in matters of events. How many people have found themselves clicking the same buttons in the same order multiple times to fix the problem? Every hand should go up, because that's how you fix problems. I do this, then I do this, then I do this, then I do this, then I do this, then I do this, and it takes you five minutes, and you do it a hundred times a month. Turns out with WPCLI, you can write a script and run the script and have it on the machine, run that script to certain intervals with a crown job, and now you know how to interact with it as well as again. You do a little work up front, and it just does it all for you. Makes the robots go to work. Robots are really, really good at doing super complex things. I can't make this dinosaur. I can buy a major body, have it make a formula, print your body make a formula, and it can make the same dinosaur a billion times. And never get attacked. It'll run out of battery, actually. I don't have to do all those little things. I don't have to go in and smash the draft, but I'm going to have to mainly look at how to make sure that a robot is published. I don't have to make sure that so much of this stuff by going in and manually looking at it. I think my time is more valuable than that. I just wanted to write my content around it or write it, shove it somewhere, let somebody else test it for me, shove it somewhere else, let somebody else test it for me, and then leave it to me, you and me, to make a decision if I push that direction better. Those are my goals. That's exactly what I set out to do. Fly out, that's what I did. I'm also open-source-less. With all the good projects, you should share your knowledge. And this isn't meant, again, you can use this verbatim. I'm not going to stop you, but you can go get posted now, right now. It's in the slide section of my website. I also open-source all the other components I built because what I found from doing this was not just that I wrote one utility, but at a certain point, like, wait a minute, I'm not going to do the same thing again and again, instead of starting a function that does this, why don't I just extract that into its own tool that I can use to run some of the projects. So, if you're using Pantheon, there's a Terminus wp-quam-content thing I released. Terminus is our command on our face with Pantheon, where I can simply move content from .8.p, from this site to that site, from this environment to that environment. Very simply, while I'm typing in the command, it moves it all for me, including the metadata, including the pictures, including the post, like, everything. It's verbatim. It does not touch the database. Indirectly it does, because we're building new information there. Which means I can be on e-commerce site, be taking 100 orders a minute, and still building new posts in the same way. Again, first it just logged in, and I wrote it to live. But things broke on my production site all the time. And unless somebody told me, I'd just like to stay that way. It's got to be a better way. That's why I'm CLI's. Post all my blog content to my site, and I'll test along the way, because I'm sure I'm going to make mistakes. I'll ever CLI's. Yeah, yeah. I'm going to do a little bit of shorter talk, but I'm going to work Pantheon. I have a conversation with you now. And this is a shorter talk on purpose. Not that much shorter. Happy to answer your questions on this. We do the things you do the way you do them. Because this might be completely wrong for you. Again, I'm a 0.2% user. It's a problem. So that's why I'm getting out of the conversation with you here. So thanks. Can you talk a little bit more about BEHAT? Sure. BEHAT is behavioral testing, which means I'm going to test the behavior of my site. It's written in this thing called Gherkin, the Gherkin language, which is what Gherkin looks like. It's made specifically to be English, kind of principle business logic English. And it's pretty straightforward. And I'm doing something that's very trivial, like I'm looking for a specific piece of text on a file and seeing did it happen or not. I can also behave as an admin. So when I look at this page and fill in this form, this should happen. This should be displayed. I should be taking this page. You can write this for any scenario you can bring up. Which means you can write super big suites of tests that will happen literally every time you push a code. Andrew Taylor, if you can talk this morning about this particular subject of automating your testing, says it really, really succinctly. As a developer, I want to spend my time solving important problems and responding to alerts from the automation systems of what I need to fix to make sure I don't have to go again to fix those things. That's paraphrase. That's basically it. I was really going to solve fun problems and build fun things. Like the tool I built for this listless list. How am I sharing it? Yeah, this is my listless list tool. This is going to be my plug-in listing list against the list of sites. I hope it's worth it. This is just the fun I tweeted about a couple of days ago. But I'll really be building stuff like this to make my life even easier or even better and more scalable. I'll be going in and testing to see when I click the button did a thing happen. Or if you've got pains, I'm going to do it. That's the old way. Let them have better jobs. Let them do better things. What Mr. Fuller would say. At some point we will replace all work for humanity through automation. When that happens, we'll get back to doing whatever it was we were doing before they told us to go to work. Your problem's all around work. That'll work. We're all free. Hold on. Hi. So as a developer, why do you feel that crochet is your kind of outlet? Do you feel like that's a more tangible product of your time? Can you talk a little bit about how you have other habits that aren't marketable for downtime? No. The point is you're saving a crap load of time. So now you have time to be doing something else that makes you feel satisfied. So I thought maybe you could address that as a semi-mental health issue and have this talk. I'm sorry to take that. It's not marketable skill. In fact, if the internet just goes away, crocheting will still be a work of its own. But that's a good point. So yeah, I crochet a lot. Because I don't have to worry about how my websites are maintained. I mean, why I crochet specifically? It's one. Small repetitive motions are really good for the brain. They're really good for the brain. And as soon as the form is in therapy, I'm like, meditating? I can't get past the point that I'm just sitting there. But I can't appreciate it. I have something in me. So that's a personal thing. But yeah, I have that free time to do because I'm not spending two to three hours a week chasing bugs on stuff that I'm like breaking my hand. I'm letting the robots break it. Then we'll fix what they broke and so the more you automate the more free time you get. I'll see you back to your early schedule programs and thank you for watching.