-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See CHANGELOG.md Issues: ------ * fixes issue #2 - news page * fixes issue #6 - terms and conditions * fixes issue #9 - documentation * fixes issue #10 - more documentation
- Loading branch information
Showing
15 changed files
with
279 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# Hacking the Application | ||
|
||
Before proceeding any further, read the following documents: | ||
|
||
1. [CONTRIBUTING.md][contrib]: contributing source code | ||
1. [CODE\_OF\_CONDUCT.md][coc]: code of conduct | ||
1. [LICENSE][license]: software license | ||
|
||
[contrib]:https://github.com/forfuturellc/mmtc-ke/blob/master/CONTRIBUTING.md | ||
[coc]:https://github.com/forfuturellc/mmtc-ke/blob/master/CODE_OF_CONDUCT.md | ||
[license]:https://github.com/forfuturellc/mmtc-ke/blob/master/LICENSE | ||
|
||
|
||
## introduction: | ||
|
||
While Node.js applications are mostly platform-agnostic, we assume you're | ||
developing using a Unix system. Should some development script, tool, etc. | ||
**not** run in your windows (etc.) machine and you know how to make it | ||
compatible, consider sending a pull request. | ||
|
||
**Table of Contents** | ||
|
||
* [application architecture](#arch) | ||
* [starting the application](#start) | ||
* [data entry](#data-entry) | ||
* [deployment](#deploy) | ||
* [news](#news) | ||
|
||
|
||
<a name="arch"></a> | ||
### application architecture: | ||
|
||
The directory structure of the code repository: | ||
|
||
``` | ||
. | ||
|-- config/ # configurations | ||
|-- data/ # data files, particularly for the different networks | ||
|-- engine/ # business logic (the "heavy-lifting") | ||
|-- routes/ # routing logic | ||
|-- web/ # web interface (whatever you see in the browser) | ||
`-- app.js # main entry point, with bootstrap code | ||
``` | ||
|
||
The application is built using, mainly: | ||
|
||
* [express][express]: THE web framework | ||
* [node-config][node-config]: handles application configuration | ||
* [nunjucks][nunjucks]: for page templating | ||
|
||
[express]:http://expressjs.com/ | ||
[node-config]:https://github.com/lorenwest/node-config | ||
[nunjucks]:https://mozilla.github.io/nunjucks | ||
|
||
|
||
<a name="start"></a> | ||
### starting the application: | ||
|
||
The application can be started in either **development** or **production** mode. | ||
|
||
```bash | ||
$ npm start # start in production mode | ||
$ npm run start-dev # start in development mode | ||
``` | ||
|
||
|
||
<a name="data-entry"></a> | ||
### data entry: | ||
|
||
Data entry is a one-off task, that is crucial to this application, so as to | ||
ensure the data used does **not** end up being stale and inaccurate. This | ||
is one of the most simple yet cumbersome development task. **No** | ||
extensive programming knowledge is required. | ||
|
||
To get started: | ||
|
||
* read the existing data files in [`data/`][data] | ||
* understand thee [Data File Specification][spec] being used | ||
|
||
[data]:https://github.com/forfuturellc/mmtc-ke/blob/master/data/ | ||
[spec]:https://github.com/forfuturellc/mmtc-ke/blob/master/data/SPEC.md | ||
|
||
|
||
<a name="deploy"></a> | ||
### deployment: | ||
|
||
The application is currently being deployed on [OpenShift][openshift] | ||
**FOR FREE**. We highly recommend you get familiar with the platform. | ||
It is quite worthwhile. | ||
|
||
While we have set the CI to automatically deploy the application, | ||
particularly on pushing to **master** branch, we assign a developer | ||
in charge of any deployment issues that may arise. | ||
|
||
* developer-in-charge: [GochoMugo](https://github.com/GochoMugo) | ||
|
||
Feel free to contact the developer, should you want to submit sensitive | ||
information concerning the hosting server, etc. Also, CC the information | ||
to we@forfuture.co.ke, with a suitable subject line. | ||
|
||
[openshift]:http://openshift.redhat.com/ | ||
|
||
|
||
<a name="news"></a> | ||
### news: | ||
|
||
You can find major news concerning the application at | ||
http://mmtc.forfuture.co.ke/news/. | ||
|
||
Since we are avoiding restarting the application, just to reflect any | ||
recently-added news, the developer in-charge of deployment handles this | ||
process: | ||
|
||
* a new branch, from the **develop** branch is created with a name | ||
in a format, similar to `news/2016-04-23`. | ||
* new news are added to the beginning of `web/_raw/news.md` | ||
* while the new branch is reviewed and merged back, the updated news.md | ||
should be uploaded to the server, using SSH or similar tool. | ||
|
||
News are now updated! | ||
|
||
|
||
**HAPPY HACKING!** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* The MIT License (MIT) | ||
* Copyright (c) 2016 Forfuture LLC | ||
* | ||
* Pages | ||
*/ | ||
|
||
|
||
exports = module.exports = { | ||
getHTML: getHTML, | ||
}; | ||
|
||
|
||
// built-in modules | ||
var fs = require('fs'); | ||
|
||
|
||
// npm-installed modules | ||
var showdown = require('showdown'); | ||
|
||
|
||
// module variables | ||
var converter = new showdown.Converter(); | ||
|
||
|
||
/** | ||
* Load HTML content from a markdown file, usually to be inserted into | ||
* a shell page, as the main content. | ||
* | ||
* @todo Add caching | ||
* | ||
* @param {String} filepath - path to markdown file | ||
* @param {Function} done - callback | ||
*/ | ||
function getHTML(filepath, done) { | ||
return fs.readFile(filepath, 'utf8', function(readFileErr, markdown) { | ||
if (readFileErr) { | ||
return done(readFileErr); | ||
} | ||
|
||
var html = converter.makeHtml(markdown); | ||
return done(null, html); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"verbose": true, | ||
"watch": [ | ||
"app.js", | ||
"config/", | ||
"data/", | ||
"engine/", | ||
"routes/" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<section class="post"> | ||
<h2>Terms and Conditions <small>2016-04-23</small></h2> | ||
|
||
We have added a page detailing the Terms and Conditions, subject to | ||
application users. Please read through it and understand. It can be | ||
found at http://mmtc.forfuture.co.ke/tcs | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# terms and conditions | ||
|
||
Your usage of this application, at http://mmtc.forfuture.co.ke, assumes your | ||
acceptance of these terms and conditions. | ||
|
||
1. **Source Code**: The source code for this application is available on | ||
Github at https://github.com/forfuturellc/mmtc-ke. Proceed to the code | ||
repository for more information on licensing. Auditing of the source | ||
code is highly welcome. | ||
1. **Accuracy of Results**: We do **not** guarantee the accuracy of any | ||
information retrieved from this application. | ||
1. **Service Uptime**: Unexpected downtime may occur, due to various | ||
reasons such as software crashes and development work. | ||
1. **Privacy Policy**: We do **not** use cookies or collect any personal | ||
information, except that submitted directly in the various forms made | ||
available in the application itself. | ||
1. **Copyright**: Any brand names and trademarks used in the application | ||
belong to the respective companies. | ||
1. **Service Abuse**: Any actions you undertake against this application | ||
should be in the best interest of other users and Forfuture, LLC. Be | ||
good! | ||
|
||
For any copyright-related and other legal issues may be addressed to | ||
Forfuture, LLC at we {at} forfuture {dot} co {dot} ke. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@import "_main" | ||
|
||
|
||
.main-content | ||
text-align: left | ||
|
||
|
||
.post | ||
h2 small | ||
color: grey | ||
font-size: 12px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{# | ||
# Shell page for content, in markdown files | ||
#} | ||
{% extends '_layouts/page.html' %} | ||
|
||
{# variables #} | ||
{% set cssURL = '/css/content.css' %} | ||
|
||
{# blocks #} | ||
{% block main_content %} | ||
{{ content | safe }} | ||
{% endblock %} |
Empty file.
Empty file.
Empty file.