This README outlines the details of collaborating on this Ember application. A short introduction of this app could easily go here.
You will need the following things properly installed on your computer.
- Get this repository on to your computer with
git clone <repository-url>- if you already have it then skip this step. - Go to the terminal and move to this the new directory.
- Run
npm install - Run
bower install
- Run
ember serverorember s(these are the same) - Visit your app at http://localhost:4200.
app.jsis the entry point for the application.config/environment.jsis the main Ember configuration file for the frontend. However for the most part you won't have to touch this file.- In many cases, this file reads a hidden file in the main directory called
.envthat contains the most common options, like the translation files to use (DEFAULT_LOCALEandOTHER_LOCALE) and the address where the API will be (API_URL) and the downloads files will be (DOWNLOAD_URL). /app/localescontains all of the translation keys./app/variables/data-variables.jscontains most of the configuration related to website data, e.g. which products to show on the homepage dropdown, how many years of trade data there are, what logos to show on the homepage, what paths underDOWNLOAD_URLto find each download file etc. This is read byservices/feature-toggle.js.instance-initializers/locale-setter.jshandles the locale / translation settings.mixins/table-map.jsincludes many table related settings, including the widths of each column and what columns to show in what page.- The main application logic is contained in the
routes/controllers/andtemplates/. The routes determine what data to fetch and how, the controllers handle display-related logic (and user events like clicks) and the templates handle the actual HTML structure that ends up on the page. Read the ember.js documentation for more on this. router.jshas the mapping from URLs to files inroutes/blah.js.
Current .env files
colombia.envmexico.envperu.env
To use a country
- run
ember build -e <enviroment>e.g.ember build -e colombia
OR
- copy
.env.<country>as.env
To add a country env.
- Create
.env.<country> - Add to
Brocfile.jsdotEnv path to country
SUB-FOLDERS
-
Set
ROOT_URLto what the sub dir should be in the correct.envfile before building -
ember build(development) defaults to.env -
ember build --environment production(production) defaults to.env -
To build the app, have the correct
.envfile in the root dir see '.env.example' -
run
ember build -e <enviroment>e.g.ember build -e colombia -
By default the built app is in the
dist/folder -
Locales follow
country-langsyntax. e.g.usa-en,usa-esormex-en,mex-es -
ember cli i18n is used for the internalization.
-
Required
ENVvars- GA (for Google Analytics)
- DEFAULT_LOCALE
- OTHER_LOCALE
- API_URL
- DOWNLOAD_URL(root name for file downloads)
- use [ember-cli-buildpack] (https://github.com/QuinnLee/heroku-buildpack-ember-cli)
- set
ENVvars - push to instance