README
Tucana Core app
It's a main, core app. All tucana modules depends on this core.
- Before start
- Getting started
- Additional info
- Additional node and bower modules installation
- Pluralization and localization
Before start
- Remember to follow styleguide with your code: https://github.com/johnpapa/angularjs-styleguide You can add plugins to your editor to help you with that: https://github.com/johnpapa/angularjs-styleguide#file-templates-and-snippets
- NEVER commit to master branch. Master can be touched only by 'Merge request'. Always work on branches (even on 'very small changes').
- Prefix your branches names for easily grouping. Current prefixes are:
featureandhotfixe.g.,
feature/your-feature-name
or
hotfix/your-hotfix-name
- You should use issue number (from Jira) in your branch name. e.g.,
feature/TS-36-panel-logowania
- Use gitlab markdown in your documentation .md files, merge requests and so on: https://gitlab.tt.com.pl/help/markdown/markdown TIP: It easier to edit markdown files in gitlab gui because you have preview feature. You can commit your initial readme file and if it doesn't look as should you can edit it in gitlab
- You should use prettifier which use .jsbeautifyrc e.g., https://packagecontrol.io/packages/HTML-CSS-JS%20Prettify TIP: enable 'beautify on save'
- You should use jshint plugin in your IDE (.jshintrc is included in repo)
Getting started
- Clone repository,
- install Ruby and sass gem - Windows 8 instruction
- run (in repository directory):
npm start
On first start all dependecies (npm and bower packages) will be installed.
3. open browser on http://your_ip:9001/app/ ex http://localhost:9001/app/
Additional info
Grunt tasks and livereload
npm start runs grunt dev task which runs http server and injects livereload script.
You don't need to install livereload web browser addon or inject livereload script manually.
Linking new files/module
When you create new js/scss files you should:
- Link your js files in
app/index.htmlfor example:<script src="src/core/services/auth/auth.module.js"></script>Remember to link your module file first (and later controller file, config file). - include your scss file in
app/src/core/template/scss/default.scss(main scss file) for example:@import 'app/src/systems/users/users.scss' - Add localization to the model by adding this line of code in the module config:
$translatePartialLoaderProvider.addPart('path/to/the/module');
e.g.,
$translatePartialLoaderProvider.addPart('systems/users');
- Create folder languages in the root of the module, and add there json files with translations. The naming of the files should be as follows: lang-{language}.json (e.g., lang-en.json)
Ruby and sass gem installation on Windows 8
- Download Ruby installer from http://rubyinstaller.org/downloads/ ex http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.1.5-x64.exe?direct
- install Ruby with
'Add Ruby executables to your PATH'option checked, - install sass gem
gem install sass
In case of error:
ERROR: Could not find a valid gem 'sass' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/latest_specs.4.8.gz)
- open
cmdand check ruby installation directory withgem which rubygemsIt will be for ex.C:/Ruby21-x64/lib/ruby/2.1.0/rubygems.rb - go to ruby ssl certs directory for ex.
C:/Ruby21-x64/lib/ruby/2.1.0/rubygems/ssl_certs/ - put inside cert file downloaded from https://raw.githubusercontent.com/rubygems/rubygems/master/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem
- try again to install sass gem
Additional node and bower modules installation
Adding more bower packages to app
If you need for example bootstrap package you should install it by bower:
bower install package_name --save
If you install new packages remember to remove ~ and ^ from package versions in bower.json
Adding more npm packages to app
If you would like to add more npm packages to app run:
npm install package_name --save
or:
npm install package_name --save-dev
If you install new packages remember to remove ~ and ^ from package versions in package.json
Pluralization and localization
Adding localization to the module.
In order to add localization files to the module You should add this line to the module config:
$translatePartialLoaderProvider.addPart('path/to/the/module');
e.g.,
$translatePartialLoaderProvider.addPart('systems/users');
If You need to add pluralization rules for a language, add the file from 'bower_components/messageformat/locale/' after the messageformat,js
When you want to add different plural variations of a sentence, you can do it as follows:
- Add to the json dictionary the entry
"BOOKS": "{NUM, plural, one{książka} few{książki} many{książek} other{książek}}"
Use your entry in the code as follows:
- with the directive:
Tutaj jest 1 <span translate="BOOKS" translate-values="{ NUM: '{{book.count}}'}" translate-interpolation="messageformat"></span>- At the moment I don't know how to make it work with the filter.
3 commandments during developing system
Dirs structure of template have to looks like:
/app/src/systems/system-name/template |--- img | |--- system-name | |--- images | |--- scss |--- scss filesDuring moving files from img dir of each systems, we can have some conflicts between files with the same name in different systems. "system-name" dir in img dir ensure no conflict on production server for different system.
All files with scss should be in
template/scssdir.If you edited
/app/index.htmlyou have to ensure the same HTML code between body tag in/app/index.htmland/index.html- excluding script tags
Preparing files for production
In systems which are included into the core, you have to ensure there are 2 files in main dir of each system:
bower.list- list of bower libraries dedicated for certain system, for example:"library-first": "1.3.14", "library-second": "2.8.15", "library-third": "1.2.44",package.list- list of NODE libraries dedicated for certain system, for example:"library-first": "1.3.14", "library-second": "2.8.15", "library-third": "1.2.44",
Releasing new version on production server
- Login into
http://ci.tt.com.pl/using domain login and domain password - Chose
webtab - Click on
Schedule a buildnext toTucana-Core_completejob - Select systems which should be included on production
- Select
deployand type deploy name if you want to deploy your system on TT's internal web server:http://192.168.210.100/deploy-name