{"id":719,"date":"2005-03-10T01:23:55","date_gmt":"2005-03-09T16:23:55","guid":{"rendered":"http:\/\/unknowngenius.com\/blog\/archives\/2005\/03\/10\/automating-package-releases\/"},"modified":"2005-07-23T17:41:21","modified_gmt":"2005-07-23T08:41:21","slug":"automating-package-releases","status":"publish","type":"post","link":"https:\/\/unknowngenius.com\/blog\/archives\/2005\/03\/10\/automating-package-releases\/","title":{"rendered":"Automating Package Releases"},"content":{"rendered":"<p>This is one of these \u00fcber-geek entry about shell scripting that will only be pertinent to a tiny fraction of this blog&#8217;s readership. I just wanted to consign this to the <a href=\"http:\/\/google.com\"> biggest technical library in the world<\/a>.<\/p>\n<p><!--more-->Silly as it is, up until recently, I was manually packaging and uploading upgrades for all my <a href=\"https:\/\/unknowngenius.com\/blog\/wordpress\/\">WP plugins<\/a>. Zipping (after removing OS X invisible breadcrumb files if I felt like it), getting my ftp client fired up, browsing to the right location, uploading&#8230; The whole process never took more than a minute or so, but was becoming painstakingly repetitive. Especially when you notice you missed a small typo somewhere and have to redo it again 10 seconds later.<\/p>\n<p>I knew there were a thousands way to automate this with a shell script or otherwise, just never bothered&#8230; And I probably should have.<\/p>\n<p>This is a typical example of how a small effort could save you a lot of efforts afterward: laziness <i>is<\/i> a quality in software development, provided it&#8217;s used with some foresight.<\/p>\n<p>Anyway, the script turned out to be 4 line long, took 5 minutes to write, and I&#8217;m sure it could be of some use for people out there who regularly have to zip and upload a package on a specific website:<\/p>\n<blockquote><p><code>cd <b>\/path\/to\/whatever\/dir\/you\/want\/to\/send\/<\/b><\/p>\n<p>rm <b>your_package<\/b>.zip<\/p>\n<p>zip -r <b>your_package<\/b>.zip <b>your_package<\/b>\/ -x \\*\/.\\*<\/p>\n<p>ftp -u ftp:\/\/<b>ftp_username<\/b>:<b>ftp_password<\/b>@<b>ftp_server\/path\/to\/destination\/ftp\/dir\/<\/b> <b>your_package<\/b>.zip<br \/>\n<\/code><\/p><\/blockquote>\n<p>Replace text in bold with your own values and save as file.<br \/>\nThis will work with most Unix shells I can think of, provided you have <code>zip<\/code> and <code>ftp<\/code> installed (OS X does, by default).<br \/>\nIf you are using OS X, add the <i>.command<\/i> extension to the script name and you will be able to run it by simply double-clicking it.<\/p>\n<p><strong>Note:<\/strong> don&#8217;t forget to make your script executable (run <code>chmod a+x your_script.command<\/code>).<br \/>\n<strong>Note 2:<\/strong> in the script above, mind the space (not a carriage return) between the path and the zip file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A small but useful script to zip and upload a folder to your website.<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-719","post","type-post","status-publish","format-standard","hentry","category-geek"],"_links":{"self":[{"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/posts\/719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/comments?post=719"}],"version-history":[{"count":0,"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/posts\/719\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/media?parent=719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/categories?post=719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknowngenius.com\/blog\/wp-json\/wp\/v2\/tags?post=719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}