Skip to content
This repository was archived by the owner on Jul 2, 2020. It is now read-only.

Commit 3a6b30c

Browse files
author
oraclejet
committed
Release 2.2.0
1 parent 580cd64 commit 3a6b30c

30 files changed

+251
-139
lines changed

README.md

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
1-
# generator-oraclejet 1.1.0
2-
3-
## About the generator
4-
This Yeoman generator for Oracle JET lets you quickly set up a project for use as a Web application or mobile-hybrid application for Android and iOS.
5-
6-
This is an open source project maintained by Oracle Corp.
7-
8-
### Installation
9-
For step-by-step instructions on using Yeoman and this generator to build an Oracle JET application, including possible pre-requisites for installation, please see the [Oracle JET Developers Guide](http://docs.oracle.com/middleware/jet210/jet/)
10-
```bash
11-
npm install -g generator-oraclejet
12-
```
13-
14-
### Usage
15-
Once you have the generator installed, the following commands will scaffold up a JET based application. See the [Oracle JET Developers Guide](http://docs.oracle.com/middleware/jet210/jet/) for information about all of the available Command Line options as well as details on pre-requisites for installation and usage with Mobile-Hybrid applications.
16-
17-
```bash
18-
# Generate a web based application with default blank template
19-
yo oraclejet <app name>
20-
```
21-
```bash
22-
# Generate a web based application with QuickStart_Basic template
23-
yo oraclejet <app name> --template=basic
24-
```
25-
```bash
26-
# Generate a mobile hybrid application for Android with default navdrawer template
27-
yo oraclejet:hybrid myApp --appid=com.oracle.samples --appname=MyApp --template=navdrawer --platforms=android
28-
```
29-
30-
### [Contributing](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
31-
Oracle JET is an open source project. Pull Requests are currently not being accepted. See
32-
[CONTRIBUTING](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
33-
for details.
34-
35-
### [License](https://github.com/oracle/generator-oraclejet/tree/master/LICENSE.md)
36-
Copyright (c) 2014, 2016 Oracle and/or its affiliates
1+
# generator-oraclejet 2.2.0
2+
3+
> Yeoman generator for Oracle JET web and mobile applications
4+
5+
## About the generator
6+
This Yeoman generator for Oracle JET lets you quickly set up a project for use as a web application or hybrid mobile application for Android, iOS or Windows 10.
7+
8+
This is an open source project maintained by Oracle Corp.
9+
10+
## Installation
11+
For step-by-step instructions on using Yeoman and this generator to build an Oracle JET application, including possible pre-requisites for installation, please see the [Oracle JET Developers Guide](http://docs.oracle.com/middleware/jet210/jet/)
12+
```bash
13+
npm install -g generator-oraclejet
14+
```
15+
16+
## Usage
17+
Once you have the generator installed, the following commands will scaffold up a JET based application. See the [Oracle JET Developers Guide](http://docs.oracle.com/middleware/jet210/jet/) for information about all of the available command line options as well as details on pre-requisites for installation.
18+
19+
```bash
20+
# Generate a web application with default blank template
21+
yo oraclejet <app name>
22+
```
23+
```bash
24+
# Generate a web application with default basic template
25+
yo oraclejet <app name> --template=basic
26+
```
27+
```bash
28+
# Generate a hybrid mobile application for Android with default navdrawer template
29+
yo oraclejet:hybrid myApp --appid=com.oracle.samples.myapp --appname=MyApp --template=navdrawer --platform=android
30+
```
31+
32+
## [Contributing](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
33+
Oracle JET is an open source project. Pull Requests are currently not being accepted. See
34+
[CONTRIBUTING](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
35+
for details.
36+
37+
## [License](https://github.com/oracle/generator-oraclejet/tree/master/LICENSE.md)
38+
Copyright (c) 2014, 2016 Oracle and/or its affiliates
3739
The Universal Permissive License (UPL), Version 1.0

RELEASENOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## Release Notes for generator-oraclejet ##
2+
3+
### 2.2.0 (Oct 21, 2016)
4+
* Provide help page for generator

common/restore.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,17 @@ module.exports =
3131

3232
fs.stat(configPath, function(err,stats)
3333
{
34+
var generatorVersion = _getOracleJetGeneratorVersion(generator);
3435
if (err)
3536
{
36-
generator.log(commonMessages.appendJETPrefix() + "No config file...writing the default config...");
37-
var generatorVersion = _getOracleJetGeneratorVersion(generator);
37+
generator.log(commonMessages.appendJETPrefix() + "No config file...writing the default config...");
3838
fs.writeJSONSync(configPath, {"generatorVersion": generatorVersion});
3939
}
4040
else
4141
{
42+
var configJson = fs.readJSONSync(configPath);
43+
configJson.generatorVersion = generatorVersion;
44+
fs.writeJSONSync(configPath, configJson);
4245
generator.log(commonMessages.appendJETPrefix() + ORACLE_JET_CONFIG_FILE +" file exists...checking config...");
4346
}
4447
});
@@ -83,7 +86,8 @@ module.exports =
8386
*/
8487
function _getOracleJetGeneratorVersion(generator)
8588
{
86-
var generatorJSON = generator.sourceRoot("package.json");
87-
return fs.readJSONSync(generatorJSON).version;
88-
}
89-
89+
// We intend to read the top level package.json for the generator-oraclejet module.
90+
// Note this path to package.json depends on the location of this file within the module (common/restore.js)
91+
var generatorJSON = require('../package.json');
92+
return generatorJSON.version;
93+
}

common/template/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var _WEB = "web";
1515

1616
var BLANK_TEMPLATE = blankTemplate.BLANK_TEMPLATE;
1717

18-
var _TEMPLATES_NPM_URL = "oraclejet-templates@2.1.0";
18+
var _TEMPLATES_NPM_URL = "oraclejet-templates@~2.2.0";
1919

2020
var _TEMPLATES = [BLANK_TEMPLATE, 'basic', 'navbar', 'navdrawer'];
2121

@@ -55,7 +55,7 @@ module.exports =
5555

5656
function _isUrl(url)
5757
{
58-
return /^https?:\/\/?([\da-z\.-]+)(:\d{2,4})?([\/\w \.-]*)*\/?$/.test(url);
58+
return /^https?:\/\/[^\s\/$.?#].[^\s]*$/i.test(url);
5959
}
6060

6161
function _toTemplateUrl(template)

generators/add-hybrid/index.js

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@ var OracleJetAddHybridGenerator = generators.Base.extend(
2323
{
2424
generators.Base.apply(this, arguments);
2525

26-
this.option("platforms");
27-
this.option("platform");
28-
this.option("appid");
29-
this.option("appId");
30-
this.option("appname");
31-
this.option("appName");
32-
26+
this.option('platforms', {
27+
desc: 'Specify the platforms to be supported by the scaffolded hybrid app [android, ios, windows]',
28+
});
29+
this.option('platform', {
30+
desc: 'Alias for --platforms if the user wishes to specify a single hybrid platform [android, ios, windows]'
31+
});
32+
this.option('appid', {
33+
desc: 'Specify the app ID for scaffolded hybrid app'
34+
});
35+
// Deprecated version
36+
this.option("appId",{desc:"Deprecated. Use --appid instead."});
37+
this.option('appname', {
38+
desc: 'Specify the app name for scaffolded hybrid app'
39+
});
40+
// Deprecated version
41+
this.option("appName", {desc:"Deprecated. Use --appname instead."});
3342
},
3443

3544
initializing: function()
@@ -70,6 +79,7 @@ var OracleJetAddHybridGenerator = generators.Base.extend(
7079
.then(cordovaHelper.create.bind(this))
7180
.then(commonHybrid.copyHooks.bind(this))
7281
.then(commonHybrid.copyResources.bind(this))
82+
.then(_copyCordovaMocks.bind(this))
7383
.then(commonHybrid.removeExtraCordovaFiles.bind(this))
7484
.then(platformsHelper.addPlatforms.bind(this))
7585
.then(commonHybrid.updateConfigXml.bind(this))
@@ -149,3 +159,29 @@ function _validateHybridDirDoesNotExist(generator)
149159
}
150160
return Promise.resolve(generator);
151161
}
162+
163+
function _copyCordovaMocks(generator)
164+
{
165+
var source = generator.templatePath("../../hybrid/templates/common/src/js/");
166+
var dest = generator.destinationPath("./src-hybrid/js/");
167+
168+
return new Promise(function (resolve, reject)
169+
{
170+
if (common.fsExistsSync(source))
171+
{
172+
fs.copy(source, dest, function (err)
173+
{
174+
if (err)
175+
{
176+
reject(err);
177+
return;
178+
}
179+
resolve(generator);
180+
});
181+
}
182+
else
183+
{
184+
reject('Missing file \'/js/cordovaMocks.js\'.')
185+
}
186+
});
187+
}

generators/add-theme/index.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ var OracleJetAddThemeGenerator = generators.Base.extend(
4242
this.env.error(commonMessages.prefixError(err));
4343
}
4444
if(this.themeName === constants.DEFAULT_THEME) {
45-
this.env.error(commonMessages.prefixError("Theme " + constants.DEFAULT_THEME + " is reserved.")); }
45+
this.env.error(commonMessages.prefixError("Theme " + constants.DEFAULT_THEME + " is reserved.")); }
46+
47+
if(!_isValidThemeName(this.themeName)) {
48+
this.env.error(commonMessages.prefixError(`Special characters invalid in theme name ${this.themeName}.`));
49+
}
4650
},
4751

4852
writing: function()
@@ -74,7 +78,6 @@ module.exports = OracleJetAddThemeGenerator;
7478

7579
function _addSassTheme(generator) {
7680
var themeName = generator.themeName;
77-
7881
const srcPath = generator.destinationPath(constants.APP_SRC_DIRECTORY);
7982
const themeDestPath = path.join(srcPath, 'themes', themeName);
8083
fs.ensureDirSync(themeDestPath);
@@ -130,6 +133,10 @@ function _isScssFile(file) {
130133
return /scss/.test(path.extname(file));
131134
}
132135

136+
function _isValidThemeName(string) {
137+
return !(/[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]/.test(string));
138+
}
139+
133140
function _getJetVersion(generator) {
134141
let bowerJSON = generator.destinationPath('bower_components/oraclejet/bower.json');
135142
bowerJSON = fs.readJsonSync(bowerJSON);
@@ -155,7 +162,7 @@ function _copySettingsFilesFromJETSrc(themeName, dest, generator) {
155162
const srcSettingFileName = _getSrcSettingFileName(platform);
156163
const srcPath = path.join(JET_SCSS_SRC_PATH, platformPath, srcSettingFileName);
157164

158-
const destSettingFileName = _getDestSettingFileName(themeName, platform);
165+
const destSettingFileName = _getDestSettingFileName(DEFAULT_THEME, platform);
159166
const destPath = path.join(dest, platform, destSettingFileName);
160167

161168
fs.copySync(srcPath, destPath);
@@ -187,27 +194,23 @@ function _copySettingsFilesFromJETSrc(themeName, dest, generator) {
187194
function _getValuePairsArray() {
188195
return [
189196
{
190-
str:'@import "../utilities/oj.utilities.urls";',
191-
newStr: '@import "../../../../bower_components/oraclejet/dist/scss/utilities/oj.utilities.urls";',
192-
},
193-
{
194-
str: '@import "../utilities/oj.utilities.math";',
195-
newStr: '@import "../../../../bower_components/oraclejet/dist/scss/utilities/oj.utilities.math";',
197+
str: new RegExp('@import\ \"\.\.\/utilities', 'g'),
198+
newStr: '@import "../../../../bower_components/oraclejet/dist/scss/utilities',
196199
},
197200
{
198-
str: new RegExp('.*\\$themeName.*'),
201+
str: new RegExp('.*\\$themeName.*', 'g'),
199202
newStr: `$themeName: ${THEMENAME_TOKEN} !default;`,
200203
},
201204
{
202-
str: new RegExp('.*\\$imageDir.*'),
205+
str: new RegExp('.*\\$imageDir.*', 'g'),
203206
newStr: `$imageDir: "../../../alta/${JET_VERSION_TOKEN}/${PLATFORM_TOKEN}/images/" !default;`,
204207
},
205208
{
206-
str: new RegExp('.*\\$fontDir.*'),
209+
str: new RegExp('.*\\$fontDir.*', 'g'),
207210
newStr: `$fontDir: "../../../alta/${JET_VERSION_TOKEN}/${PLATFORM_TOKEN}/fonts/" !default;`,
208211
},
209212
{
210-
str: new RegExp('.*\\$commonImageDir.*'),
213+
str: new RegExp('.*\\$commonImageDir.*', 'g'),
211214
newStr: `$commonImageDir: "../../../alta/${JET_VERSION_TOKEN}/common/images/" !default;`,
212215
},
213216
];

generators/app/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ var OracleJetWebCreateGenerator = generators.Base.extend(
5050
defaults: ".",
5151
desc: "Application directory to contain the scaffold content"
5252
});
53+
54+
this.option('template', {
55+
desc: 'blank, basic[:web|:hybrid], navbar[:web|:hybrid], navdrawer[:web|:hybrid], or <URL to zip file>'
56+
});
5357
},
5458

5559
writing: function ()

generators/app/templates/blank/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<meta name="apple-mobile-web-app-title" content="Oracle JET">
3333

3434
<!-- injector:theme -->
35-
<link rel="stylesheet" href="css/libs/oj/v2.1.0/alta/oj-alta-min.css" id="css" />
35+
<link rel="stylesheet" href="css/libs/oj/v2.2.0/alta/oj-alta-min.css" id="css" />
3636
<!-- endinjector -->
3737

3838
<!-- This is where you would add any app specific styling -->

generators/app/templates/blank/js/main-release-paths.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"promise": "libs/es6-promise/es6-promise.min",
66
"hammerjs": "libs/hammer/hammer-2.0.8.min",
77
"ojdnd": "libs/dnd-polyfill/dnd-polyfill-1.0.0.min",
8-
"ojs": "libs/oj/v2.1.0/min",
9-
"ojL10n": "libs/oj/v2.1.0/ojL10n",
10-
"ojtranslations": "libs/oj/v2.1.0/resources",
8+
"ojs": "libs/oj/v2.2.0/min",
9+
"ojL10n": "libs/oj/v2.2.0/ojL10n",
10+
"ojtranslations": "libs/oj/v2.2.0/resources",
1111
"text": "libs/require/text",
1212
"signals": "libs/js-signals/signals.min"
1313
}

generators/app/templates/blank/js/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ requirejs.config(
2626
'promise': 'libs/es6-promise/es6-promise',
2727
'hammerjs': 'libs/hammer/hammer-2.0.8',
2828
'ojdnd': 'libs/dnd-polyfill/dnd-polyfill-1.0.0',
29-
'ojs': 'libs/oj/v2.1.0/debug',
30-
'ojL10n': 'libs/oj/v2.1.0/ojL10n',
31-
'ojtranslations': 'libs/oj/v2.1.0/resources',
29+
'ojs': 'libs/oj/v2.2.0/debug',
30+
'ojL10n': 'libs/oj/v2.2.0/ojL10n',
31+
'ojtranslations': 'libs/oj/v2.2.0/resources',
3232
'text': 'libs/require/text',
3333
'signals': 'libs/js-signals/signals'
3434
}

0 commit comments

Comments
 (0)