Data Registry for the West Coast Governors Alliance
Install Jekyll site generator (may need to install ruby and gem first):
gem install jekyll
Install Bower package manager (may need to install node and npm first):
npm install -g bower
Install Grunt task runner:
sudo npm install -g grunt-cli
Clone this repository if you haven't already and cd into the top-level directory.
Install dev dependencies into node_modules directory:
npm install
Install frontend Javascript libraries into bower_components:
bower install
To successfully run tests you must implement the following workaround fix - http://stackoverflow.com/questions/24270389/angularjs-controller-unit-test-with-jasmine. In _includes/bower_components/angular-mocks/angular-mocks.js find the function isSpecRunning and change it as follows:
function isSpecRunning() {
//return currentSpec && (window.mocha || currentSpec.queue.running);
return !!currentSpec;
}
Now run the test suite
grunt test
The following Jekyll command will compile the source code from site_raw into _site_generated, and start serving the app locally on port 4000. It will also watch for file changes in site_raw and recompile automatically.
jekyll serve
NOTE if you have a version of Jekyll newer than v.2.5.3, (and you encounter errors), you can run an earlier version of Jekyll like this:
jekyll _2.5.3_ serve
You should now be able to view the home page in your browser at http://127.0.0.1:4000
Last step. If you don't have a local instance of Geoportal and SOLR running, for example if you are running a local development version, you will need to change where this app looks to connect to them.
To change the URL that the app connects to for Geoportal change scope.geoportalUrl in:
site_raw/_includes/js/directives/Results.js
To change the URL that the app connects to for SOLR change solrUrl in:
site_raw/_includes/js/services/Solr.js
If you set those URL's to a domain that is different than this application then you will get cross-domain AJAX errors. One workaround is to temporarily allow cross-domain AJAX requests using a CORS plugin such as the "Allow-Control-Allow-Origin" extension for Chrome. Make sure you turn this off when you're done.
The main stylesheet for this app is _site_raw/includes/css/main.css. If you want to edit it you should not make changes directly as it is generated by the LESS compiler. You shoule make edits to _site_raw/includes/less/main.less and compile it to CSS using the following command:
grunt styles
In addition to compiling the LESS files, this task will continue to watch the LESS files and recompile the CSS every time you save a change. To exit out of watch mode type Ctrl-C.
Altogether, the CSS and JS files for this app are quite large. We want the page to load as fast as possible for our users so we'll reduce their size by stripping out unneeded information. This makes them essentially unreadable but much smaller. To do this run the compress task:
grunt compress