Skip to content

Commit

Permalink
Merge pull request #27 from gengojs/v1.0.0-alpha.5
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
iwatakeshi committed Nov 7, 2015
2 parents 89f23e5 + 62c0d2d commit ade1ab5
Show file tree
Hide file tree
Showing 25 changed files with 170 additions and 225 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,9 +1,8 @@
language: node_js

node_js:
- 4.2
- 4.1
- 0.12
- 0.11
- 0.10
- 4.0

before_install: npm install -g gulp
19 changes: 6 additions & 13 deletions README.md
Expand Up @@ -10,19 +10,12 @@ gengo.js
[![Version](http://img.shields.io/npm/v/gengojs.svg)](https://www.npmjs.com/package/gengojs)


## News
## Progress:

Greetings! Just wanted to say thanks for those who have tried gengo.js. The official Docs is still a work in progress
but this update (**v1.0.0-alpha.4**) introduces support for [TOML](https://github.com/toml-lang/toml). This means that the
locales/dictionaries can be written in toml-lang instead of JSON.

Also, if you haven't noticed yet, the examples directory is the best place to view the examples. It also includes a sails
app that you can try as well. :)

Hey! Sorry for any delays! gengo.js has been through some transitions and hopefully it will lead it to becoming a better library but here's what happened:
* gengo.js has moved into [a dedicated GitHub account](https://github.com/gengojs)
* All official plugins have been updated and can be found at the dedicated account.
* All plugins and the core have been documented.
- [x] Updated to Koa v2.0.0-alpha.3
- [x] Dropped support for Node.js < 4.0
(Sorry, but most servers are moving beyond 4. In theory, gengojs should still work below 4.0)
- [ ] Writing docs.


### *Help wanted*:
Expand Down Expand Up @@ -66,7 +59,7 @@ app.use(gengo(options));

// Koa
var gengo = require('gengojs/koa');
var app = require('koa')();
var app = new require('koa')();
// Use gengo
app.use(gengo(options));

Expand Down
5 changes: 2 additions & 3 deletions examples/express/index.js
@@ -1,8 +1,7 @@
var express = require('express'),
app = express(),
gengo = require('../../express/');
gengo = require('../../express/').default;
var path = require('path');
var root = require('app-root-path');

app.set('view engine', 'jade');
app.set('views', path.normalize(__dirname + '/'));
Expand All @@ -12,7 +11,7 @@ app.use(gengo({
type: '*'
},
backend: {
directory: path.join(root.path, '/tests/locales/unrouted/dest/')
directory: path.join(path.resolve(), 'examples/locales')
},
header: {
supported: ['en-US', 'ja']
Expand Down
5 changes: 2 additions & 3 deletions examples/hapi/index.js
@@ -1,7 +1,6 @@
var Hapi = require('hapi');
var server = new Hapi.Server();
var gengo = require('../../hapi/');
var root = require('app-root-path');
var gengo = require('../../hapi/').default;
var path = require('path');

server.connection({
Expand Down Expand Up @@ -29,7 +28,7 @@ server.register(gengo({
type: '*'
},
backend: {
directory: path.join(root.path, '/tests/locales/unrouted/dest/')
directory: path.join(path.resolve(), 'examples/locales')
},
header: {
supported: ['en-US', 'ja']
Expand Down
14 changes: 7 additions & 7 deletions examples/koa/index.js
@@ -1,15 +1,14 @@
var koa = require('koa'),
app = koa(),
gengo = require('../../koa/');
var Koa = require('koa'),
app = new Koa(),
gengo = require('../../koa/').default;
var path = require('path');
var jade = require('koa-jade-render');
var root = require('app-root-path');
app.use(gengo({
parser: {
type: '*'
},
backend: {
directory: path.join(root.path, '/tests/locales/unrouted/dest/')
directory: path.join(path.resolve(), 'examples/locales')
},
header: {
supported: ['en-US', 'ja']
Expand All @@ -18,11 +17,12 @@ app.use(gengo({

app.use(jade(path.normalize(__dirname + '/')));

app.use(function*() {
app.use(function(self, next) {
'use strict';
yield this.render('index', {
self.render('index', {
title: 'My home page'
});
return next();
});

app.listen(3000);
6 changes: 6 additions & 0 deletions examples/locales/en-us.json
@@ -0,0 +1,6 @@
{
"Hello": "Hello",
"msgformat":{
"photos": "You have {numPhotos, plural, =0 {no photos.} =1 {one photo.} other {# photos.} }"
}
}
6 changes: 6 additions & 0 deletions examples/locales/ja.json
@@ -0,0 +1,6 @@
{
"Hello": "こんにちは",
"msgformat":{
"photos": "あなたは {numPhotos, plural, =0 {写真を持っていません。} =1 {一枚の写真を持っています。} other {# 枚の写真を持っています。} }"
}
}
2 changes: 1 addition & 1 deletion express/index.js
@@ -1 +1 @@
module.exports = require('../src/express/');
module.exports = require('../lib/express/');
28 changes: 15 additions & 13 deletions gulpfile.js
Expand Up @@ -18,21 +18,21 @@ var
/** Backs up the files in case of emergency! */
gulp.task('backup', function () {
return gulp
.src('lib/**/**/**.js')
.src('src/**/**/**.js')
.pipe(gulp.dest('./.backup'));
});

gulp.task('recover', function () {
return gulp
.src('./.backup/**/**/*.js')
.pipe(gulp.dest('lib/'));
.pipe(gulp.dest('src/'));
});

/* Formats the files */
gulp.task('beautify', ['backup'], function () {
return gulp.src('./lib/**/**/*.js')
return gulp.src('./src/**/**/*.js')
.pipe(beautify(config.beautify))
.pipe(gulp.dest('./lib'));
.pipe(gulp.dest('./src'));
});

/*
Expand All @@ -52,25 +52,27 @@ gulp.task('gh-pages', ['doc'], function () {


/* Checks the coding style and builds from ES6 to ES5*/
gulp.task('lib', ['beautify'], function () {
return gulp.src('./lib/**/**/*.js')
gulp.task('src', ['beautify'], function () {
return gulp.src('./src/**/**/*.js')
.pipe(jshint(config.jshint))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(babel({
presets: ['es2015']
}))
.pipe(sourcemaps.write('./source maps/'))
.pipe(gulp.dest('./src/'));
.pipe(gulp.dest('./lib/'));
});

/* Watches for changes and applies the build task*/
gulp.task('watch', function () {
return gulp.watch('./lib/**/**/*.js', ['build']);
return gulp.watch('./src/**/**/*.js', ['build']);
});

/* Runs tests */

gulp.task('test', ['lib'], function (cb) {
gulp.task('test', ['src'], function (cb) {
if (isHarmony)
return gulp.src('./test/harmony/index.js')
.pipe(shell(['mocha --harmony <%= file.path %>']));
Expand All @@ -93,7 +95,7 @@ gulp.task('doc', ['build'], shell.task([
(function(){
var doc = 'node_modules/mr-doc/bin/mr-doc',
cmd = {
source: ' -s lib/',
source: ' -s src/',
output: ' -o docs/',
name:' -n "gengo.js/plugin/header"',
theme:' -t cayman'
Expand All @@ -102,8 +104,8 @@ gulp.task('doc', ['build'], shell.task([
})()
]));

gulp.task('default', ['backup', 'beautify', 'lib', 'watch']);
gulp.task('default', ['backup', 'beautify', 'src', 'watch']);

gulp.task('build', ['backup', 'beautify', 'lib', 'test']);
gulp.task('build', ['backup', 'beautify', 'src', 'test']);

gulp.task('docs', ['build', 'doc', 'gh-pages', 'clean-docs']);
2 changes: 1 addition & 1 deletion hapi/index.js
@@ -1 +1 @@
module.exports = require('../src/hapi/');
module.exports = require('../lib/hapi/');
2 changes: 1 addition & 1 deletion koa/index.js
@@ -1 +1 @@
module.exports = require('../src/koa/');
module.exports = require('../lib/koa/');
29 changes: 18 additions & 11 deletions lib/express/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 22 additions & 15 deletions lib/hapi/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ade1ab5

Please sign in to comment.