dev environment - GamingSamurai/wifL GitHub Wiki

overview

the recommended dev environment will be explained here, as thoroughly as possible, in order to facilitate the most broad possible range of experience levels. it is the intention of this document to try and assist even the newest developer in preparing to work with our team on the wifL project. while some requirements are strict, others are recommendations and an individual developer may choose to substitute with something appropriate. when doing so it is encouraged that, within reason, you document your alternative choices in order to assist other developers who may make similar choices.
(ex: if you use Eclipse as an alternative to Netbeans, please do document your setup and usage of Eclipse as an alternative.)
(ex: if documentation describes a process of using port 81 as an alternative to port 80, but you use port 82 instead of 81 then there is no need to document this as it would essentially be redundant)

now then, let's not waste time with banter. on with the show...

common terms and abbreviations
ps - Powershell for Windows
cmd - Command Prompt for Windows
app - Application
dev - Development or Developer
prod - Production
repo - Repository or Code Repository
config - Configure or Configuration

the (recommended) dev environment

currently we are using Windows for development. setup for development on Linux and Mac TBD. note: we are deploying to linux for staging and (when we are ready to release a public test build) linux for production.

base requirements:

environment setup

most setup is pretty straightforward but there can be a few stumbling blocks. devs, both new and veteran, should update the wiki to clarify and update general processes, troubleshooting and issues involved in all aspects of development.

install and verify Java
if have not installed Java, make sure you get the correct version of the Java SE Dev Kit (x86 for Windows 32bit and x64 for Windows 64bit.) if you are unsure of your Windows version, try this. use the link provided in the base requirements section at the top of this page to go to the Java downloads.
if you want check to see if you have Java already installed and if it is the current version, open a cmd or ps window and type
java -version
and if Java is installed you should get something like this in return

java version "1.8.0_161"  
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)  
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

if you are sure you have installed Java
and you don't get this information
or you get an error
then you need to set your environment variables like this.
if you are having other problems with Java you can start troubleshooting here. Also, Google.

install Git
using the link provided, choose a flavor of Git or find your own favorite brand. download and install. configure as desired. if you want to become more familiar with git before diving in, you can find documentation and tutorials here. Also, Google.

clone the code
time to clone the code repo. using whichever flavor of git you like, clone the repo from Github into your preferred project directory. open a git prompt and type
git clone [email protected]:GamingSamurai/wifL.git
now set up a dev and staging branch by typing
git branch staging
followed by
git branch dev
now to get the latest from the staging server. first we add a new repo where [repo_url] and [user_name] correspond to the appropriate information provided by the project lead.

git remote add staging ssh://[user_name]@[repo_url]/path/to/repo
git checkout staging
git pull staging staging

your lead and/or server admin may require that you provide a public key for ssh access to the staging server. if so, you can follow the instructions here to create a public/private key pair and then provide the public key to the lead or server admin.
now lets move to the dev branch for local development.
git checkout dev
you should now be on your own local dev branch. to check your branch at any time, just type
git status
and you will be provided with your current branch as well as plenty of other info.
now let's make sure the .gitignore has all the proper entries. in the wifL folder, open up the .gitignore file with Notepad or whatever text editor you like. it should look like this

/nbproject/
/lib/ven/

if so, you're good to go.
if it does not look like the code shown above, simply copy and paste the lines into the .gitignore document, then save and close it. if you would like to become more familiar with git you can find documentation and tutorials here. Also, Google.

install and configure WAMP
although it should be the correct version by default, be sure to download and install WAMP with PHP 5.6, as per the link above
moving on, installing WAMP is pretty straightforward, but you may run into an issue when you first run WAMP. if the WAMP icon in the system tray is orange and reporting 2 of 3 services started, then you likely need to either stop IIS or rebind the default web port for WAMP. you probably don't want to remove IIS entirely as you might be currently using it or have need for it in the future. i personally prefer to temporarily stop IIS by opening ps or cmd prompt as admin and typing
iisreset /stop
to stop it or
iisreset /start
to start it back up again. be aware that after any shutdown or reboot, iis will start again automatically with Windows and you will have to run the command again to stop it before you can use WAMP. rebinding the default port is possible, but solutions seem varied and with differing levels of success.
for other issues, you can start troubleshooting here.
provided that the WAMP icon in your system tray is green, it is time to make a quick config setting. open a browser and go to localhost. you should get a page full of information about, and links to, various config options. what you want is in the bottom left corner, "Add a Virtual Host". in the first field, type in whatever virtual url you want to use (ex: dev.localhost OR dev.wifL.local) and in the second field type in the REAL and ABSOLUTE PATH to your project (ex: C:\Projects\wifL\serveme or Z:\MyProjects\Git\Repos\wifL\serveme) making sure that you use "\wifL\serveme" as the end of the path as this is the true web directory for the project.

install composer
you should be able to use the link up there to download and install composer. that should be everything for this step. seriously, that is all.

install and configure Netbeans
using the link in the base requirements section above, you can download and run the Netbeans installer. you can follow the prompts and should be able to use mostly default settings. once it is up and running, make sure you have the PHP plugin by going to Tools >> Plugins and selecting the "Installed" tab and looking for "PHP" in the list on the left. If it is not listed, then go to the "Available" tab and search for "PHP". Select the option that is just "PHP" and then click the Install button under the list.
now go to the File menu and choose "New Project". in the window that comes up, choose PHP from the list on the left and on the right choose "PHP Application with Existing Sources" then click the Next button at the bottom. In the next window, click the Browse button next to the Sources Folder input field and navigate to your wifL repo. enter a project name, choose "PHP 5.6" for PHP Version and then click the Next button at the bottom. in this final window, choose "Local Web Site" for Run As and for Project URL, enter the URL you choose for your Virtual Host when you configured WAMP.
you should see your project appear in the Projects pane on the left side of the Netbeans window.