<commit_before>Copyright 2014 - 2015 Solinea, Inc.

Licensed under the Solinea Software License Agreement (goldstone),
Version 1.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at:

    http://www.solinea.com/goldstone/LICENSE.pdf

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Author: <NAME>


GOLDSTONE HACKING GUIDE
========================

Initial Setup
*************

If you're doing this on OS X, you need to install these packages::

    (Install Homebrew, per the instructions at http://brew.sh.)

    $ brew upgrade
    $ brew doctor            # Resolve any any errors or warnings before continuing.

    $ brew install caskroom/cask/brew-cask
    $ brew cask install java
    $ brew install python    # This puts a Python interpreter where mkvirtualenv expects to find it.
    
Create your virtual environment for goldstone. Virtualenvwrapper makes this easy
(see http://virtualenvwrapper.readthedocs.org/en/latest/install.html)::

    $ pip install virtualenvwrapper
    $ pip install tox

Add the following or similar to your .bash_profile::

    export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future # for Mavericks
    export JAVA_HOME="$(/usr/libexec/java_home)"
    export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
    export WORKON_HOME=$HOME/.virtualenvs
    export PROJECT_HOME=$HOME/devel
    source /usr/local/bin/virtualenvwrapper.sh

Create the virtual environment (this will also install virtualenv)::

    $ mkvirtualenv goldstone

.. Tip:: Customize your virtualenv postactive script to make it yours. I use the following commands in my virtualenv:

	 .. code:: bash
		   
	   #!/bin/bash
	   cd ~/devel/goldstone

	   export GOLDSTONE_SECRET="%ic+ao@5xani9s*%o355gv1%!)v1qh-43g24wt9l)gr@mx9#!7"
	   export DJANGO_SETTINGS_MODULE=goldstone.settings.local_dev

	   redis-server > /dev/null 2>&1 &
	   elasticsearch > /dev/null 2>&1 &
	   celery worker --app=goldstone --loglevel=info --beat > /dev/null 2>&1 &


	 This changes to my goldstone development git directory and sets my default django setting module so that I don't have
	 to include it on the command line every time.  It also starts all of the required software (which we will install in a minute).

Activating and deactivating the environment can be done with the following commands::

    $ workon goldstone
    $ deactivate

Install these packages locally::

    $ workon goldstone
    $ brew install elasticsearch
    $ brew install phantomjs
    $ brew install redis

Install postgresql and create development and test databases. Create a user goldstone with the role goldstone
(or edit your development.py setttings file)::
      <commit_msg>GOLD-615: Add to HACKING, per comments from JS.<commit_after>Copyright 2014 - 2015 Solinea, Inc.

Licensed under the Solinea Software License Agreement (goldstone),
Version 1.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at:

    http://www.solinea.com/goldstone/LICENSE.pdf

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Author: <NAME>


GOLDSTONE HACKING GUIDE
========================

Initial Setup
*************

If you're doing this on OS X, you need to install these packages::

    (Install Homebrew, per the instructions at http://brew.sh.)

    $ brew upgrade
    $ brew doctor            # Resolve any any errors or warnings before continuing.

    $ brew install caskroom/cask/brew-cask
    $ brew cask install java
    $ brew install python    # This puts a Python interpreter where mkvirtualenv expects to find it.
    
Create your virtual environment for goldstone. Virtualenvwrapper makes this easy
(see http://virtualenvwrapper.readthedocs.org/en/latest/install.html)::

    $ pip install virtualenvwrapper
    $ pip install tox

Add the following or similar to your .bash_profile::

    export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future # for Mavericks
    export JAVA_HOME="$(/usr/libexec/java_home)"
    export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
    export WORKON_HOME=$HOME/.virtualenvs
    export PROJECT_HOME=$HOME/devel
    source /usr/local/bin/virtualenvwrapper.sh

Create the virtual environment (this will also install virtualenv)::

    $ mkvirtualenv goldstone

.. Tip:: Customize your virtualenv postactive script to make it yours. This is a suggested virtualenv/postactivate:

	 .. code:: bash
		   
	   #!/bin/bash
	   cd ~/devel/goldstone

	   export GOLDSTONE_SECRET="%ic+ao@5xani9s*%o355gv1%!)v1qh-43g24wt9l)gr@mx9#!7"

	   # For example, export DJANGO_SETTINGS_MODULE=goldstone.settings.local_oak_c2
	   export DJANGO_SETTINGS_MODULE=goldstone.settings.local_<datacenter>_<cloud_instance>

	   redis-server > /dev/null 2>&1 &
	   elasticsearch > /dev/null 2>&1 &
	   celery worker --app=goldstone --loglevel=info --beat > /dev/null 2>&1 &


	 This changes to my goldstone development git directory and sets my default django setting module so that I don't have
	 to include it on the command line every time.  It also starts all of the required software (which we will install in a minute).

	 This is a suggested virtualenv/deactivate:

	 .. code:: bash
		   
	    #!/bin/bash

	    echo "shutting down redis"
	    pkill -f redis

	    echo "shutting down elasticsearch"
	    pkill -f elasticsearch

	    # If you start postgres in your activate, you'll want to shut it down here.
	    # echo "shutting down postgres"
	    # pkill -f postgres

Activating and deactivating the environment can be done with the following commands::

    $ workon goldstone
    $ deactivate

Install these packages locally::

    $ workon goldstone
    $ brew install elasticsearch
    $ brew install phantomjs
    $ brew install redis

Install postgresql and create development and test databases. Create a user goldstone with the role goldstone
(or edit your development.py setttings file)::
      
{'fraction_non_alphanumeric': 0.08052347959969207, 'fraction_numerical': 0.00985373364126251, 'mean_word_length': 3.6902527075812275, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1138205', 'n_tokens_mistral': 1937, 'n_tokens_neox': 1785, 'n_words': 717}