Seizing the Automation Opportunity!
- running the gulp command to build my angular.js project.
- drilling down into the output build folder and zipping up the files.
- renaming the zip file to v127 (or v + next version number).
- moving the zip onto a drive shared between coworkers.
I should be noted that I could have done this by adding a gulp task at the end of everything it does to zip up the proper files so that everything would happen from the gulp command. However, I didn't want to have to keep opening up the gulp files in order to change the version number. I was also already in the terminal window to run gulp so I figured I'd just do it with normal linux commands.
It's a bit scary, but I'll just throw it out there and then explain it:
gulp; cd dist; zip -r /Volumes/ai_temp/Jim\ Lynch/latest\ build/v128.zip *; cd ..;
The first thing to realize is that we can chain commands one after another by separating them with a semicolon. We can see the first part of this command is the good old gulp command as usual. Then we have another straightforward command, cd dist, which drills down into the dist folder creates by gulp (so that we don't include the dist folder in the zip we're about to do). Next we're going to zip up everything in the current folder. We use the zip command with the recursive -r flag, point to the exact path and name of the zip we're creating (you should change this to reflect the place on your computer where'd you'd like to save the zip file), and finally tell it to zip everything in this folder with the * character. I then cd out of the dist folder, bringing back where I started. If I then check in my "latent builds" folder, I'll see the zip there smiling at me!