Skip to content

Commit

Permalink
Merge pull request #1 from devtotvs/109_aplicando_modificacoes_thf
Browse files Browse the repository at this point in the history
ionic-team#109 - alteracoes para thf mobile
  • Loading branch information
rafaelquines authored May 5, 2017
2 parents fd407ec + 95ca53f commit 16bc42f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 71 deletions.
74 changes: 38 additions & 36 deletions lib/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ var DEFAULT_APP = {
};

var V2_STARTERS = {
blank: { repoName: 'ionic2-starter-blank' },
tabs: { repoName: 'ionic2-starter-tabs' },
sidemenu: { repoName: 'ionic2-starter-sidemenu' },
conference: { repoName: 'ionic-conference-app' },
tutorial: { repoName: 'ionic2-starter-tutorial' },
super: { repoName: 'ionic-starter-super' }
blank: { repoName: 'thf-mobile-template-blank' },
// tabs: { repoName: 'ionic2-starter-tabs' },
// sidemenu: { repoName: 'ionic2-starter-sidemenu' },
// conference: { repoName: 'ionic-conference-app' },
// tutorial: { repoName: 'ionic2-starter-tutorial' },
// super: { repoName: 'ionic-starter-super' }
};

Start.runSpawnCommand = function runSpawnCommand(cmd, args) {
Expand Down Expand Up @@ -88,7 +88,7 @@ Start.startApp = function startApp(options) {

ioLib.warnMissingData();

var createMessage = ['Creating an Ionic', options.v2 ? ' 2.x' : '', ' app in ', options.targetPath, ' based on the ',
var createMessage = ['Creating an THF Mobile app in ', options.targetPath, ' based on the ',
chalk.bold(options.template), ' template.\n'].join('');
var errorWithStart = false;

Expand Down Expand Up @@ -172,13 +172,15 @@ Start.addDefaultPlatforms = function addDefaultPlatforms(options) {

Start.fetchWrapper = function fetchWrapper(options) {
var q = Q.defer();
var wrapperRepoName = options.v2 ? 'ionic2-app-base' : 'ionic-app-base';
var wrapperBranchName = options.wrapperBranchName ? options.wrapperBranchName : 'master';
var repoUrl = 'https://github.com/driftyco/' + wrapperRepoName + '/archive/' + wrapperBranchName + '.zip';

// var wrapperRepoName = options.v2 ? 'thf-mobile-template-base' : 'ionic-app-base';
// var wrapperBranchName = options.wrapperBranchName ? options.wrapperBranchName : 'master';
var wrapperRepoName = 'thf-mobile-template-base';
var repoUrl = 'https://thf.totvs.com.br/templates/' + wrapperRepoName + '.zip';

Utils.fetchArchive(options.targetPath, repoUrl)
.then(function() {
var repoFolderName = wrapperRepoName + '-' + wrapperBranchName;
var repoFolderName = wrapperRepoName;

// Copy contents of starter template into base, overwriting if already exists
shelljs.cp('-R', options.targetPath + '/' + repoFolderName + '/.', options.targetPath);
Expand Down Expand Up @@ -244,7 +246,7 @@ Start.fetchSeed = function(options) {
}

// Ionic Github Repo
seedType = 'ionic-starter';
seedType = 'thf-mobile-starter';
return Start.fetchIonicStarter(options);
};

Expand Down Expand Up @@ -499,9 +501,9 @@ Start.fetchIonicStarter = function(options) {
}

// Get the URL for the starter project repo:
var repoUrl = 'https://github.com/driftyco/' + repoName;
var repoUrl = 'https://thf.totvs.com.br/templates/' + repoName + '.zip';

return Start.fetchGithubStarter(options, repoUrl);
return Start.fetchGithubStarter(options, repoUrl, repoName);
};

Start.mergePackageJson = function(starterPackageJson, targetPath) {
Expand Down Expand Up @@ -530,28 +532,28 @@ Start.mergePackageJson = function(starterPackageJson, targetPath) {
}
}

Start.fetchGithubStarter = function(options, repoUrl) {
Start.fetchGithubStarter = function(options, repoUrl, repoFolderName) {
var q = Q.defer();

// https://github.com/driftyco/ionic-starter-tabs/
var urlParse = parseUrl(repoUrl);
var pathSplit = urlParse.pathname.replace(/\//g, ' ').trim().split(' ');
if (!urlParse.hostname || urlParse.hostname.toLowerCase() !== 'github.com' || pathSplit.length !== 2) {
log.error('Invalid Github URL: ' + repoUrl);
log.error('Example of a valid URL: https://github.com/driftyco/ionic-starter-tabs/');
Utils.fail('');
q.reject();
return q.promise;
}
var starterRepoName = pathSplit[1];
var starterBranchName = options.starterBranchName ? options.starterBranchName : 'master';
var repoFolderName = starterRepoName + '-' + starterBranchName;
// var urlParse = parseUrl(repoUrl);
// var pathSplit = urlParse.pathname.replace(/\//g, ' ').trim().split(' ');
// if (!urlParse.hostname || urlParse.hostname.toLowerCase() !== 'github.com' || pathSplit.length !== 2) {
// log.error('Invalid Github URL: ' + repoUrl);
// log.error('Example of a valid URL: https://github.com/driftyco/ionic-starter-tabs/');
// Utils.fail('');
// q.reject();
// return q.promise;
// }
// var starterRepoName = pathSplit[1];
// var starterBranchName = options.starterBranchName ? options.starterBranchName : 'master';
// var repoFolderName = starterRepoName + '-' + starterBranchName;

// ensure there's an ending /
if (repoUrl.substr(repoUrl.length - 1) !== '/') {
repoUrl += '/';
}
repoUrl += 'archive/' + starterBranchName + '.zip';
// if (repoUrl.substr(repoUrl.length - 1) !== '/') {
// repoUrl += '/';
// }
// repoUrl += 'archive/' + starterBranchName + '.zip';

Utils.fetchArchive(options.targetPath, repoUrl).then(function() {

Expand Down Expand Up @@ -1161,14 +1163,14 @@ Start.finalize = function(options) {
};

Start.printQuickHelp = function() {
log.info(chalk.bold('\n♬ ♫ ♬ ♫ Your Ionic app is ready to go! ♬ ♫ ♬ ♫'));
log.info(chalk.bold('\n♬ ♫ ♬ ♫ Your THF Mobile app is ready to go! ♬ ♫ ♬ ♫'));
log.info(chalk.bold('\nSome helpful tips:'));
log.info(chalk.bold('\nRun your app in the browser (great for initial development):'));
log.info(' ionic serve');
log.info(' thf-mobile serve');
log.info(chalk.bold('\nRun on a device or simulator:'));
log.info(' ionic run ios[android,browser]');
log.info(chalk.bold('\nShare your app with testers, and test on device easily with the Ionic View companion app:'));
log.info(' http://view.ionic.io');
log.info(' thf-mobile run ios[android,browser]');
// log.info(chalk.bold('\nShare your app with testers, and test on device easily with the Ionic View companion app:'));
// log.info(' http://view.ionic.io');
};

Start.promptForOverwrite = function promptForOverwrite(targetPath) {
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Utils.fetchArchive = function fetchArchive(targetPath, archiveUrl, isGui) {
log.info(message);

var tmpFolder = os.tmpdir();
var tempZipFilePath = path.join(tmpFolder, 'ionic-starter-' + new Date().getTime() + '.zip');
var tempZipFilePath = path.join(tmpFolder, 'thf-mobile-starter-' + new Date().getTime() + '.zip');

var proxy = Utils.getProxy();
var request = require('request');
Expand Down
45 changes: 11 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,18 @@
{
"name": "ionic-app-lib",
"name": "thf-mobile-app-lib",
"version": "2.2.1",
"description": "A library for creating and developing Ionic Framework mobile apps.",
"homepage": "http://ionicframework.com/",
"description": "A library for creating and developing THF Mobile Framework apps.",
"homepage": "https://thf.totvs.com.br/",
"main": "index.js",
"keywords": [
"ionic",
"ionic framework",
"ionicframework",
"mobile",
"app",
"hybrid",
"cordova",
"phonegap"
],
"repository": {
"type": "git",
"url": "https://github.com/driftyco/ionic-app-lib.git"
},
"contributors": [
{
"name": "Max Lynch",
"email": "[email protected]",
"web": "https://twitter.com/maxlynch"
},
{
"name": "Adam Bradley",
"web": "https://twitter.com/adamdbradley"
},
{
"name": "Tim Lancina",
"web": "https://twitter.com/timlancina"
},
{
"name": "Josh Thomas",
"web": "https://twitter.com/jthoms1"
}
// "ionic",
// "ionic framework",
// "ionicframework",
// "mobile",
// "app",
// "hybrid",
// "cordova",
// "phonegap"
],
"license": "MIT",
"dependencies": {
Expand Down

0 comments on commit 16bc42f

Please sign in to comment.