Posted on

ApiGen versus phpDoc

So last night I went down the path of connecting phpDocumentor2 (phpDoc) to my code so I can find key elements in the classes and objects without having to search through the code editor. That works fine, but it is often faster for me to have an index of the classes, methods, and properties in a browser window. Even better, by publishing on the public CSA site I know can use Google to search my own docs. That is a nice bonus.

This morning, while researching custom templates, I came across a competing tool that threatened derailment of my phpDoc efforts. I came across comments that phpDoc was inferior, not updated, and had poor documentation. The project had been ignored for a few years. Turns out that much of that has been addressed since the phpDoc efforts have continued once again, though there are still plenty of gaps in the documentation of the phpDocumentor2 tool kit. After a brief run with ApiGen, I am back on the phpDoc trail.

Official Website

I was a bit apprehensive about ApiGen from the start. Why? The official website for ApiGen seems less polished than the phpDoc site. If they can’t make a great first impression on their website, what are the chances they can create decent HTML docs from my code comments? Turns out I liked the generated HTML better than their website. While phpDoc does have holes in their website presentation as far as features sets, command line options, etc. It is easier to find what I am looking for and seems to have much more documentation online than ApiGen. Maybe ApiGen has more documentation, but if it is not easy to find that doesn’t make me more efficient.

Winner: phpDoc

Installation

The installation of both products was about the same.   Use pear to setup a remote archive, and run pear to install the product.    However there was one or two fewer steps in installing phpDoc over ApiGen.   The big difference, however, was the facilitators required by ApiGen versus phpDoc.  phpDoc required far fewer libraries and add-on packs than ApiGen and produces better results.    phpDoc is either utilizing more of my CentOS 6 default PHP libraries or it just needs less in the “other frameworks” department to accomplish a similar goal.

Winner: phpDoc

NetBeans Integration

As for the NetBeans integration, they are both fairly similar.  Neither option functions very differently from the other.   They both need a target output directory set.  However, for some reason ApiGen requires you to locate the full path to the executable.  phpDoc just automatically worked.  Slight advantage: phpDoc.

Winner: phpDoc

Generated Site : Weight

This is one place where I think ApiGen wins out.  The overall “weight” of the produced site for the code documentation has less stuff to push around to and from the public server.  That also means that the stuff the pages have to load when people are viewing the site is less.   However I think there is a trade off on quality and possibly mobile-aware presentation.   Based on sheer “bits and bytes” to get the page online, ApiGen is lighter.

Winner: ApiGen

Generated Site : Quality

While I do like the search feature of ApiGen, I quickly discovered it is not a general “search any word” type of search we all are accustomed to on any site.  It is more of a “type a few characters and find a class name” search.  At least out of the box that is how it seems to be configured.   So while the search feature seemed like a plus, it really isn’t that useful to me.     Overall the look and feel plus ease of navigation of the phpDoc generate site works better for me.

Winner: phpDoc

Summary

Overall, I found phpDoc to be the best option at this point.   ApiGen isn’t bad, but today phpDoc edges out ApiGen in the areas that matter most to me.

You can compare the results of my simple Tagalong test here:

Tagalong Code Docs from ApiGen

Tagalong Code Docs from phpDoc

Posted on

Geeking Out With Netbeans and PHPDoc

I’ve been playing with phpDoc and NetBeans a lot lately.  I’ve found that having well documented code using the phpDocumentor 2 format makes for a much more efficient coding environment.   For one thing, if you have NetBeans setup properly and are using PHP classes that are fully documented, writing a line of code is as simple as typing a few characters.  NetBeans will find the objects you are looking for and list the properties and methods as you type.

That makes for some fast coding when typing something like $this->plugin->currentLocation->MakePersistent().  When everything is setup properly and the classes are properly documented I can type $t<tab>p<tab>c<down><tab>M<enter>.    While it may look like a lot of typing when spelled out essentially I am typing “$ttptcdtme”, or 10 characters instead of somewhere around 70.    Being 7x as efficient when writing thousands of lines of code is a HUGE bonus.

GitHub Markdown Docs for Code

Auto-complete shortcuts alone is one good reason to use a strong IDE like NetBeans along with a good code commenting/documentation solution like phpDocumentor2.   However tonight I found a cool new trick that I stumbled upon while trying to generate code documentation via GitHub.    I had learned a couple of weeks ago that I could use the command-line PHPDoc tool and a open source GitHub project called PHPDocMD to convert my code comments to XML and convert that to markdown (MD) that GitHub likes.   It creates OK results that are out on the public code repositories at Github.

So what is that new trick?  Well, there are 2 distinct parts.

Autogenerated HTML Docs for Code

Turns out there is a plugin for NetBeans that I’ve been ignoring.  For some reason I just happened to figure out that the “Generate Documentation” menu that appears when I right-click on a project in NetBeans actually has some use.

Yeah, I’m slow like that sometimes.

Turns out that under that menu is a submenu that has “ApiGen” and “PHPDoc” listed there.    Interesting.    That could be useful.

I went to the project, right-click, and select properties.  Sure enough, there is a setting for “PHPDoc” and it asks for a destination directory.  Basically asking “where do you want me to dump all the auto-generated documentation for your project?”.    Well it turns out that during my journey toward publishing code documentation on GitHub with MD, I had cloned the GitHub documentation repository to a local path on my development system.   I already had a folder full of code docs for my main plugin as well as several add-on packs.   So I pointed the output for my Netbeans “PHPDoc” setting to go there.

I go back, right click on the project, and select the Generate Documenation/PHPDoc.

Sure enough, NetBeans crunched my code comments and a few minutes later my Firefox browser window pops open and I see a pretty darn cool HTML site on my local box that has a full navigation menu for all of the classes I am using in my project, the properties, the To Do lists from my comments and more.  All this created because I’ve been taking a bit more time to fully comment the code.  Nice!

Settings Up For Auto-Publishing

Ok, so now on my dev box I have some pretty nice code docs that I can generate with a couple of mouse clicks.   That is helpful with a large project with multiple add-on packs.   But then I start thinking, why just keep it local?   The code is open source.  I have other developers that want to learn how to tweak the code for their own purposes.  I have third party developers looking for documentation and examples on how to do things so they can write efficient add-on packs.    Why keep the info all locked up on my dev box?

Well, I learned a neat trick a couple months ago with NetBeans.    I can have a local git repository on my development system but setup NetBeanswith a new “remote source” project.

So here I am with my commented code in my WordPress plugin directory that is fully commented and connected to a GitHub repository.   In another “docs only” directory outside of WordPress I have my PHPDoc generated HTML and MD files that I was previously only publishing to GitHub Wiki Pages, but now thanks to NetBeans I am also surfing locally on my dev desktop.     I realize I can auto-publish these code docs to my public website.

I create a new NetBeans project right next to my plugin code project.   I call it “store-locator-plus-codedocs” and set it up as a new PHP Remote Source project.   I tell it the local source on my box is the folder that I was storing the PHPDoc and MD files in for GitHub, which now contains my NetBeans-generated HTML files as well.    For a remote location I tell it to use my SFTP connection to the Charleston Software Associates website.  I jump on my website and make sure there is a new codedoc directory with a blank readme.txt file there.  If you don’t have SOMETHING for NetBeans to download from the remote source it thinks you screwed up and won’t continue…. minor flaw IMO, but easily remedied.    I then click OK.  It shows me the readme.txt with a checkbox to download it.    Click OK and BAM… there is a new project with the blank readme.txt plus all of the MD and HTML documents that were already on my local dev box.

OK, so kind of “so what” at this point, but here is where it starts getting cool… at least from a geek perspective.

Push The Initial Content

Now I need to “seed” the public website with the already-created content.   In NetBeans it is easy enough. Just highlight all the files in the project, right click and select upload.    Within a few minutes the entire HTML sub-site is uploaded to the server.   Just like any FTP program.   Nothing to it.

However now if I make any changes to those file with the editor two things happen, it saves a local copy on my dev box and it auto-publishes that updated to the live server in near-real time.    Since my local dev box has version control via GitHub, I can also quickly commit and push those edits also from inside NetBeans and make sure they are saved to the code repo.

But… I’m not going to ever edit those docs by hand.  They are auto-generated code documents that come from my well-formatted comments.  So the RIGHT way to edit them is to continue cleaning up and augmenting the code comments to make sure they are PHPDoc compliant.

So that is kind of cool.  My code docs are now auto-posting to my live server, saving on my dev server, and are one click from being saved and committed back to GitHub.  I can even add on more step and create a second copy in MD format for publication right next to the source code on GitHub.

But this is what really made me think “shit this is kind of cool”…

Auto-Publishing Code Comments

So I have all this stuff setup, my code project and my documentation project are both open at the same time in Netbeans.    I forget all about it as I start getting back into code writing.     I edit a method for one of the add-on packs and of course I go and update the comments about that method to reflect the latest changes.  I see another comment that is not complete and fill that out.

Save the code.  Commit the code so it publishes to GitHub.

A few more edits to code and comments later I decide… let’s generate the documentation before I sign off tonight…

I right click on my code project and select “generate documentation”.

Auto-magically the documentation project updates itself.   It saves a copy locally to my dev box with the new docs in place then auto-publishes to the public website with no intervention on my part.   As I setup the rest of my plugins with this system you will be able to find all the code docs on the bottom of the Technical Docs page on my site.   You can see my first auto-published work for Tagalong here, though I’m nowhere near done cleaning up the comments and naming conventions on my method to make this all “gussied up” for public consumption, but it’s a good start.

Maybe I’m just extra-geeky, but I thought that was cool… especially when the code docs actually look pretty darn good IMO, especially since they were created from nothing but /** This method does something.  @var string $this – does that **/ comments in the code.

I also know that with a few lines of script I can not only save locally and publish nice looking docs to my public site but also commit the code back to the GitHub repository while auto-generating the duplicate MD docs for the GitHub Wiki.

Yeah, I’m a Code Geek… and I’m not ashamed to admit it.

Posted on

Netbeans, phpDoc, and WordPress

A posting from our private “Tech List”, a list I share with select tech geeks mostly from the days at Cyber Sprocket Labs.   We tend to share high end tech tips that only geeks would find interesting.    I am posting here for easy reference for “The Tech List” groupies.

My Intro To Netbeans

9 months ago Chase was showing me NetBeans on his desktop.   It had some cool features for PHP like auto-complete and some very handy code lookup tools that reminded me of Visual Studio without all the weight.

 I wish I had learned about the NetBeans environment a long time ago.    NetBeans+ GitHub + SmartGit have made my coding at least twice a productive when it comes to PHP work, especially with complex WordPress plugin code.
In the past few months, while working in NetBeans, I’ve been refining my phpDoc skills.  This is EXTREMELY handy in making coding far more productive.    Here are some of the things I’ve learned that I wish we had all known about at Cyber Sprocket.    With the right tools it makes coding for people with senility (me) easier.

Effectively Using Netbeans for WP Dev

1) Wrap your ENTIRE plugin into a single instantiated object.
My plugin invocation now is basically something along these lines:
DEFINE(blah,blah) // a few of these help with WordPress stuff, like plugin version
class MP {
}
class MP_Error extends WP_Error {}
add_action('init', array('MP','init');
That is pretty much it other than the singleton.
2) Learn how to create and use singletons PROPERLY in WordPress
It must be a static method.
It should return itself as an instantiated object.
Set minimal properties as needed, not the entire WPCSL object here.
public static function init() {
    static $instance = false;
    if (!$instance) {
        $instance = new MP;
    }
    return $instance;
}
3) phpDoc the class
In netbeans you go back to just above class MP {} and type /** after starting the frame of the class with properties and methods in place.
It will AUTO-CREATE the template PHP docs.
First line of comment = 1 line description
Lines 3..m = a longer description if you’d like
Lines m+1..n = the properties defined with @property, @property-read, @property-write    (the setters/getters with r/w, r, w status)
These property lines, like variable lines are simple:
@property-read <type> name  description
for example
@property-read string plugin_name the plugin name
This indicates a read-only property for the object.
4) phpDoc the methods
 
Like classes, but NetBeans is even better with the docs, you write the function first.   Then go before the function foo() line and type /**.   NetBeans will create the entire phpDoc template.   You update it to give it the “hints”.
This is something I use a LOT now and you’ll see why in a moment.   Here is an example from WPCSL_Settings add_section:
Old school:
/**
* method: add_section
*
* does stuff
*
* params:
*     [0] - named array, blah blah
**/
New:
/**
 * Create a settings page panel.
 *
 * Does not render the panel.  Simply creates a container...
 *
 * <pre><code>
 *   $mySettings->add_section(array('name'='general'));
 * </code></pre>
 *
 * @param array $params named array of the section properties, name is required.
 **/
5) If your phpDoc property/variable type is a specific OBJECT then NAME THE OBJECT. 
For example:
class MP {

   /**
    * The WPCSL settings object, shortcut to the parent instantiated object.
    *
    *  @var wpCSL_settings__mp
    */
    private $wpcSettings = null;

}

Why I Am More Productive

Now here is why all these tips with phpDoc are useful and how I’ve slowly made my coding at least twice as efficient.
NetBeans defaults to having code hints and auto-fill turned on.   The cool part about this is it will do a few things like tell you when a required param is missing and flag the line as an error, the same way it does with blatant PHP syntax errors.    If you are creating some new code and you pause for a second with a partially written invocation then it will show you the possible options from a list of PHP functions, custom functions, or methods from objects you’ve phpDoc’ed properly.
Thus, I do something like this:
$this->wpcSettings->a   <pause>
It now shows me all the methods and properties in the WPCSL Settings Class that start with a in an in-place drop down list.
I cursor down to add_section and pause.
It shows me the full documentation on the method including my code example, the required parameters and more.
I press enter, it drops the completed method along with the first prototype in place, I cursor down to select from the various templates, for example if secondary parameters are optional, press enter and if fills out the entire code block.
I then modify the prototype to fill in my settings and I’m done.
If you do this right you can be ANYWHERE in your code as deep as you need to be.   You never have to go looking for the source, especially if you’ve written decent phpDoc comments.
I used to find myself split-screen looking at the source method or property code to see what it did or how it worked.    Now I spend time documenting the methods or properties in a verbose phpDoc comment and I never have to look at the code again.

Key Points

If you do NOT wrap everything inside a parent class it takes a lot longer to pop up the help.
If you just use the lazy @property object $myvar (or ‘mixed’) syntax you do not get to see all of the methods whenever you newly instantiated object is referenced by the variable name.
If you use things like public, private, setters, getters and use the matching phpDoc elements like @property-read  then NetBeans warns you if you do something illegal like try to directly SET that property.

A Day Older, A Day Smarter

I know some of you probably had productivity helpers like this while at Cyber Sprocket, but if I had known then what I know now I’d have been insisting that we all learn and properly implement phpDocs as our commenting standard.
An as you all know the other “freebie” with this is I could easily generate a full HTML (or markdown) site with all the classes, methods, and properties of any plugin with a few short commands.   I’ve not done that yet but will play with that sometime in the near future.    I need to figure out how to bake it into WordPress content at charlestonsw.com but I think it would be cool to have an entire plugin + wpCSL documented in an easy-to-browse format on the web.
Posted on

Speed Coding With phpStorm and WASD Keyboards

WASD Keyboard In Action

I’ve been coding a LOT more than usual over the past 3 weeks.    So much so that I’ve started having issues with my wrist, likely early onset of carpal tunnel which I would prefer to avoid.    I did a few things today to help offset that.

WASD Keyboard

The first was to buy an 87-key CODE keyboard from WASD.   This allows me to move my mouse a lot closer to “center” on my desktop.  Since I rarely use the numeric keypad or media keys, this is a good trade-off.  “Cut off” the numeric keypad and make the keyboard a lot narrower.   I’m not sure if I like the old-school clackety-clack of the Cherry MX Brown switches, but it has a great feel so I may get used to it.     Great backlighting as well.

WASD Keyboard In Action
WASD Keyboard In Action

One downside that I’ve already discovered is that the CTRL key through ALT key on the left side are more than a half-key position to the left of my old keyboard.  That makes the “reach” for CTRL-V (paste) keystrokes further apart than I like.    On the plus side, the full size / full travel keys have me looking down to validate my keystrokes far less often.  Overall I feel like I am typing much more quickly on this keyboard.  Amazing how much the tactile feel makes a difference in that regard.

New keyboard, less right-wrist travel especially for the mouse.   With another service launch coming this fall I expect a lot more coding; hopefully this change will eliminate the potential for carpal tunnel.

phpStorm Tricks

The other thing I did when getting the new keyboard, mostly due to changes in the keys that OSX recognizes, is setup some keyboard shortcuts in phpStorm.    I also learned some neat shortcuts I need to add to my daily routines.  Here are two of the most productive shortcuts that have my hitting a LOT fewer keys.

^Y = delete a line

This is going to save me from the old-habit ctrl-left-arrow , ctrl-shift-right-arrow, delete keystroke.   8 keystrokes down to 2.  Wish I discovered that one long ago.

Live Templates

This is HUGE.  Why didn’t I know about this 2 years ago?   What is a live template?   It can be a lot of things, but my simple version is using it as a permanently-saved copy & paste buffer for text I type frequently, especially during debugging.

What this does is sets up an auto-complete hint when you type in certain snippets of text (abbreviations).    For example, I have an echo statement I use when doing “quick & dirty debugging” in phpStorm.  It is faster than xdebug and all that complexity.    I have been manually typing in this long echo statement for years, something like echo “====== ” . get_class() . ‘::’ . __FUNCTION__ . “<br/>\n”;

I highlight that code, and select “Tools/Live Template”.    I then assign a shortcut, in my case I chose ‘ecof’ so it does not conflict with other PHP auto-complete hints.   Now I can simply type ecof-tab in phpStorm and it will auto-complete the line , replacing ecof with the entire echo statement above.

Cool, right?!

 

Now if phpStorm would just fix their newly-introduced “feature” in version 9 so I can get back the extra keystrokes I have to type every time I end a phpDoc comment line with a period (<sarcasm>which NEVER happens </sarcasm>) and they decide to auto-complete that as “.@deprecated”.

 

Coding Smarter…

Way less typing.  Faster code.  Less carpal tunnel.

I call that a win for today.

 

Posted on

Finding WordPress Programmers

WordPress Developer Banner

I am on a quest to find good programmers that are well versed in WordPress.   After speaking with multiple investors it is obvious that to bring Store Locator Plus to the next level I need to have talented self-sufficient staff.    I need to “up the game” from part-time support and coding positions to a senior-level PHP/WordPress expert that can be my “right hand man” when I’m not available.   This is especially important as my new media entertainment company is getting a lot of interest and starting to command more of my time every week.

The quest for a WordPress programmer is on.

Seeking :  Senior WordPress Programmer

Only apply for the position if:

  • You are an INDIVIDUAL, not a company and not an individual representing a company.
  • You have hands-on WordPress theme or plugin coding experience.
  • You write and speak English fluently.

Key skills I am seeking:

  • Well versed in WordPress coding.
  • Understand hooks and filters and have experience implementing them.
  • Possess extensive WordPress theme and/or plugin development experience.
  • Utilize proper object-oriented methodologies in their PHP implementations.
  • Use version control, git preferred, and comment documentation in phpDoc format.
  • Know and adhere to WordPress Core coding standards.

I will give preference to applicants that are geographically closest to Charleston SC USA.   Communications improve with fewer time zone differences.   They are even better when we can meet over coffee or beer on a routine basis.

Where I’m Looking

Rather than use my usual “go to” sources to find local programmers or low-to-mid-range programmers, I decided my current needs are best served by scouring the WordPress community for people that are going to be a better fit and require little training.   The usual suspects like Elance and Craigslist have failed to produce quality applicants in the past.  I’m going to completely forgo Elance as I don’t need to be spammed with 300 applicants that don’t read the requirements and are programming sweat-shops in India or some other low-cost/low-quality production shop.    (No hate mail please, I know they are not ALL like that but in my experience 9.5 of 10 of responses on these types of site are EXACTLY that).

Code Poet : WordPress Developers on G+

Code Poet links directed me off the site in fairly short order and landed me in the WordPress Developers Google group.  This is a discussion group about all kinds of WordPress “codish” topics.   There is a jobs section.  Not sure how much traffic it gets.  We’ll see.

Read my “seeking WordPress/PHP developer” post.

WordPress Developers on G+
WordPress Developers on G+

WP Hired

Free listings, quick and easy to setup.   You can upgrade to 30 day listings for $60/month.  I would post the job listing, but it takes a bit of time to be approved and listed.   They do allow for formatting of your listing and will link to your site and social media accounts.  That is a nice feature.  Not sure about the volume of traffic though.

Jobs.WordPress.net

Another free listing site that is WordPress-centric.  Requires some basic HTML if you want to format the listing.  Another waiting period so no links to that posting to see how it looks.

Jobs WordPress Net
Jobs WordPress Net
Posted on

Senior WordPress Plugin Developer Wanted

Evil Genius banner

Join Charleston Software Associates

Charleston Software Associates (CSA) is the company that has created the popular Store Locator Plus WordPress plugin.   The plugin is running on an estimated 45,000 sites and has 5,000 registered users of the premium add-on packs. CSA is a single-man operation based in Silicon Harbor, aka Charleston SC USA.

The Agenda

It is time to take the company to the next level.   I need a “right hand man” to help me drive Store Locator Plus quality and presentation up a notch.     Once we are don a re-tooling of WordPress to create a full-blown SaaS Store Locator Plus implementation is on the agenda.

If you’re up for a challenge and want to create something cool with WordPress, this is your chance.

Your Skills

  • Well versed in WordPress coding.
  • Understand hooks and filters and have experience implementing them.
  • Possess extensive WordPress theme and/or plugin development experience.
  • Utilize proper object-oriented methodologies in their PHP implementations.
  • Use version control, git preferred, and comment documentation in phpDoc format.
  • Know and adhere to WordPress Core coding standards.

The “geek check list”:

  • PHP
  • CSS
  • HTML
  • MySQL
  • jQuery
  • JavaScript
  • git

Bonus points:

  • Bitbucket
  • Grunt
  • VirtualBox
  • Vagrant
  • phpStorm
  • SmartGit
  • Selenium IDE

You Are A Fit If…

  • You are an INDIVIDUAL, not a company and not an individual representing a company.
  • You have hands-on WordPress theme or plugin coding experience.
  • You write and speak English fluently.

I will give preference to applicants that are geographically closest to Charleston SC USA.   Communications improve with fewer time zone differences.   They are even better when we can meet over coffee or beer on a routine basis.

Your Reward

This is my “first man on board” position.   That role will grow to be the “director and main man” over the coming months.   As the company grows the underlings will be under your control.   You will help set the technical direction and future release features.

The position will start at 20-30 hours per week through the end of 2014 as we build the relationship, you learn the code, and we get things organized.    By the time January 2015 gets started the goal is to make this a full time gig.

You tell me what your compensation should be.    I will do my best to make it work.   At the start you will be serving in a contractor/freelance role.   Once we start building the team this can transition to an employee role if that fits your needs.

Contact Me with your introduction.  When the dialogue begins you can email me your resume if you have one prepared.

 

Posted on

WordPress Development Fresh Start with Vagrant and Grunt

Banner Vagrant Cloud WP Dev Kit Box

HP finally did it.  They came out to replace a system board in my laptop and half of my files on my drive are corrupted.  Restoring the 70GB of corrupt files from the local USB3 backup will take some time and I am not 100% confident in the reliability of this system.   With 48 hours of downtime I decided it would be best to push forward with my Vagrant and Grunt setup for the WordPress Development Kit I’ve been working on.

Employing Vagrant

I am using VirutalBox and Vagrant to build a series of base boxes on which to layer my development environment.  Unlike most base boxes that are plain vanilla OS installs that then use provisioners to install all the software layers on top of the OS, my custom base boxes are going to be installed with all the base tools I need to develop WordPress plugins using my WordPress Development Kit tools.

Why?

Because it is far faster to download a compressed virtual machine image with most of my stuff installed  than to download a very similar image with no tools then have Vagrant go and download  a few dozen install kits.   Sure, the standard method is more flexible and ensures everything is up-to-date, but that is not what I am trying to accomplish here.    I am building a “fast start” box that has most of what you need pre-installed in a known environment.

I also want to have a method to deploy new virtual boxes with everything in place on my OS/X system, a different laptop, or even a cloud-based server the next time my HP laptop is smoked.  Which will probably be tomorrow.      As I’ve found, restoring a large image even from a local USB3 drive is not a quick process and it is not foolproof.   Especially when going from a Windows 8.1 based backup and restoring on an OS/X system that has not been patched or updated in 8 months.

How…

Since I already have Vagrant installed and have a published base box I am able to get started quickly.   Once Vagrant is installed I only need to set my Vagrantfile, a script that tells Vagrant what to do, to pull down the base box from the URL I have published on Vagrant Cloud:

  • Create a folder on my host system named “C65 WP Devkit  Box Setup”.
  • Create the Vagrantfile, in that directory with the config.vm.box pointing to charlestonsw/centos6.5-wordpress-dev-kit-base-box.
  • Open the command line for Windows and go to that C65 WP Devkit Box Setup directory.
  • Run the vagrant up command.
My new Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don’t touch unless you know what you’re doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "charlestonsw/centos6.5-wordpress-dev-kit-base-box"
config.vm.provider "virtualbox" do |vb|
vb.gui = true
end
end

What…

When you boot the WordPress Dev Kit Base Box with Vagrant you will find that the full CentOS GUI is active. You can login to the GUI using the standard vagrant username with a password of vagrant.

WordPress 3.9

You will find a Firefox icon on the menu bar. Opening Firefox will open the http://localhost/ URL which brings up the local copy of WordPress 3.9 that has been installed.

MySQL for WordPress

The MySQL database has been configured for WordPress.

Database name: wordpress
MySQL User: vagrant
MySQL Password: vagrant

NetBeans 8.0

NetBeans 8.0 has been installed with the PHP and HTML 5 support packages.   NetBeans is a great no-cost IDE that I have found to be very useful for editing structured WordPress PHP code.   Write your code using an object oriented design and add a good amount of phpDoc commenting and NetBeans becomes a coding power tool for WordPress plugin coding.

Firefox

Firefox is installed along with several add-on packs that I use for every day code management and development.  It includes Firebug to look at JavaScript, CSS, and HTML construction.   Selenium IDE is included which allows me to download and execute my web-interface based test scripts for Store Locator Plus.   LastPass is installed to provide unique long-string passwords to all of my web services.

WordPress Development Kit

My command line WordPress Development Kit is installed on the system under the vagrant user home directory in ~/wp-dev-kit. This comes with the basic Grunt build tasks I use to manage my plugins. While you can edit the ~/wp-dev-kit/grunt/plugins.json file and configure this for your site it is recommended that you create a fork of my WordPress Development Kit on the Bitbucket site and work from your forked repository. I would remove the wp-dev-kit directory with rm -rf and clone your forked copy into the same location.

The easiest method for cloning a public repository is to use git clone with the https repository path. If you have a private repository you may want to create a SSH key pair by going to ~/.ssh and running ssh-keygen. The key will need to be added as an authorized SSH key in your Bitbucket account access management list.  Since I will be pushing and pulling content from my various Bitbucket git repositories I will use this method when setting up my clone of the WP Dev Kit Basic Box.

Bitbucket HTTPS Path
Bitbucket HTTPS Path

Similar methods can be employed with Github repositories.

Preparing For Development

These are elements that will eventually go into a provisioner setup for the Vagrant box, assuming that at least one of the Vagrant provisioning services can hand user prompts and communication with third party services.

Create Your SSH Key

This will make it easier to push & pull content from your repositories.

cd ~/.ssh
ssh-keygen
xclip -sel clip &lt; ~/.ssh/id_rsa.pub
Setting A Vagrant SSH Key
Setting A Vagrant SSH Key

Login to your Bitbucket account, go to my account / access management, add the copied SSH key.

Bitbucket Add Vagrant Key
Bitbucket Add Vagrant Key

 Configure Your Git ID

git config –global user.name “Lance Cleveland”
git config –global user.email lance@thisdomain.com

Add SmartGit

I like the GUI interface that SmartGit provides over the git command line and gitk branch rendering.  I find SmartGit to be twice as efficient for my method of work flow over the built-in IDE and command line, so I always install this next and clone my base projects like the WP Dev Kit and my Selenium IDE scripts.   Today I am using the SmartGit 6 beta release as I find the project grouping and new interface design to be a big help in managing my projects.

SmartGit UI
SmartGit UI

I immediately setup SmartGit and clone my Selenium IDE repository so I can complete the next step with a script.

SmartGit Bitbucket Setup
SmartGit Bitbucket Setup

Complete The WordPress Install

Open Firefox and go to http://localhost/

Enter the WordPress local site information for your test site.  I use my Selenium IDE new site install script to handle this for me.

Selenium IDE setting up a  new WordPress install.
Selenium IDE setting up a new WordPress install.

Ready To Go

Now my system is ready to go.   I can start cloning my plugin code repositories into the ./wp-content/plugins directory, edit code with NetBeans, commit changes with SmartGit, and publish to my server or the WordPress plugin directory using my Grunt scripts.

With the current configuration it takes me 15 minutes to pull down a new clone and get the box booted then 5 minutes to install and configure SmartGit, clone my repository, run the WordPress install script, and fetch my first plugin repo.   20 minutes from “nothingness” to writing code.    With a local .box file on my system that time is cut down to about 8 minutes by avoiding the 1.5GB download of the box.

Not bad.

Now on to the code…