diff --git a/.gitignore b/.gitignore index d0655c3598..096504c57f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules *.sw[mnpcod] *.log +log.txt example/cordova/iOS/www/js/framework example/cordova/iOS/www/js/framework diff --git a/.travis.yml b/.travis.yml index 8b47c10218..87d8b496e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ notifications: secure: mkHfRTsuxidtOOORbJJ0Jspb/DSa8jAiQwWWUljqLwefy1p4HGC9P/rLdXXg3vsjiulCzyjEkfvDWAHXvu34GhGWfQuD8U140Fon1Os3AO5Hbme+yRmjXmTcgH8XetSLQufyBBMqXHMd6o1tkxXql1p54G1IShhgAdPNe76d5ZE= before_install: -- npm install -g grunt-cli protractor +- npm install -g gulp protractor before_script: - export DISPLAY=:99.0 diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 9bf6bc9906..0000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,320 +0,0 @@ -var cp = require('child_process'); -var buildConfig = require('./config/build'); - -module.exports = function(grunt) { - - grunt.initConfig({ - - concat: { - options: { - separator: ';\n' - }, - dist: { - src: buildConfig.ionicFiles, - dest: 'dist/js/ionic.js' - }, - distangular: { - src: buildConfig.angularIonicFiles, - dest: 'dist/js/ionic-angular.js' - }, - bundle: { - options: { - banner: - '/*!\n' + - ' * ionic.bundle.js is a concatenation of:\n' + - ' * ionic.js, angular.js, angular-animate.js,\n'+ - ' * angular-ui-router.js, and ionic-angular.js\n'+ - ' */\n\n' - }, - src: [ - 'dist/js/ionic.js', - 'config/lib/js/angular/angular.js', - 'config/lib/js/angular/angular-animate.js', - 'config/lib/js/angular/angular-sanitize.js', - 'config/lib/js/angular-ui/angular-ui-router.js', - 'dist/js/ionic-angular.js' - ], - dest: 'dist/js/ionic.bundle.js' - }, - bundlemin: { - options: { - banner: '<%= concat.bundle.options.banner %>' - }, - src: [ - 'dist/js/ionic.min.js', - 'config/lib/js/angular/angular.min.js', - 'config/lib/js/angular/angular-animate.min.js', - 'config/lib/js/angular/angular-sanitize.min.js', - 'config/lib/js/angular-ui/angular-ui-router.min.js', - 'dist/js/ionic-angular.min.js' - ], - dest: 'dist/js/ionic.bundle.min.js' - } - }, - - version: { - dist: { - dest: 'dist/version.json' - } - }, - - copy: { - dist: { - files: [{ - expand: true, - cwd: './config/lib/', - src: buildConfig.vendorFiles, - dest: './dist/' - }] - } - }, - - //Used by CI to check for temporary test code - //xit, iit, ddescribe, xdescribe - 'ddescribe-iit': ['js/**/*.js'], - 'merge-conflict': ['js/**/*.js'], - - 'removelogging': { - dist: { - files: [{ - expand: true, - cwd: './dist/js', - src: ['*.js'], - dest: 'dist/js/' - }], - options: { - methods: 'log info assert count clear group groupEnd groupCollapsed trace debug dir dirxml profile profileEnd time timeEnd timeStamp table exception'.split(' ') - } - } - }, - - jshint: { - files: ['Gruntfile.js', 'js/**/*.js', 'test/**/*.js'], - options: { - jshintrc: '.jshintrc' - } - }, - - karma: { - options: { - configFile: 'config/karma.conf.js' - }, - single: { - options: { - singleRun: true - } - }, - sauce: { - options: { - singleRun: true, - configFile: 'config/karma-sauce.conf.js' - } - }, - watch: { - } - }, - - connect: { - e2e: { - options: { - port: 8080, - base: '.', - debug: true - } - } - }, - - protractor: { - local: { - options: { - configFile: 'config/protractor.conf.js' - } - }, - sauce: { - options: { - configFile: 'config/protractor-sauce.conf.js' - } - } - }, - - uglify: { - dist: { - files: { - 'dist/js/ionic.min.js': 'dist/js/ionic.js', - 'dist/js/ionic-angular.min.js': 'dist/js/ionic-angular.js' - } - }, - options: { - preserveComments: 'some' - } - }, - - sass: { - dist: { - files: { - 'dist/css/ionic.css': 'scss/ionic.scss', - } - } - }, - - cssmin: { - dist: { - files: { - 'dist/css/ionic.min.css': 'dist/css/ionic.css', - } - } - }, - - 'string-replace': { - version: { - files: { - 'dist/js/ionic.js': 'dist/js/ionic.js', - 'dist/js/ionic-angular.js': 'dist/js/ionic-angular.js', - 'dist/css/ionic.css': 'dist/css/ionic.css', - }, - options: { - replacements: [{ - pattern: /{{ VERSION }}/g, - replacement: '<%= pkg.version %>' - }] - } - } - }, - - bump: { - options: { - files: ['package.json'], - commit: false, - createTag: false, - push: false - } - }, - - watch: { - scripts: { - files: ['js/**/*.js', 'ext/**/*.js'], - tasks: ['concat:dist', 'concat:distangular', 'concat:bundle'], - options: { - spawn: false - } - }, - sass: { - files: ['scss/**/*.scss'], - tasks: ['sass'], - options: { - spawn: false - } - }, - e2e: { - files: ['test/e2e/**/*.{html,js}'], - tasks: ['protractor:local'] - } - }, - - pkg: grunt.file.readJSON('package.json') - }); - - require('load-grunt-tasks')(grunt); - - grunt.registerTask('default', [ - 'jshint', - 'build' - ]); - - grunt.registerTask('e2e-watch', [ - 'connect', - 'watch' - ]); - - //NOTE(ajoslin): the order of these tasks is very important. - grunt.registerTask('build', [ - 'sass', - 'concat:dist', - 'concat:distangular', - 'copy', - 'string-replace', - 'version', - 'cssmin', - 'concat:bundle', - 'removelogging', - 'uglify', - 'concat:bundlemin' - ]); - - grunt.registerTask('cloudtest', [ - 'sauce-connect', - // 'karma:sauce', - 'connect', - 'protractor:sauce', - 'sauce-disconnect' - ]); - - grunt.registerMultiTask('karma', 'Run karma', function() { - var done = this.async(); - var options = this.options(); - var config = options.configFile; - var browsers = grunt.option('browsers'); - var singleRun = grunt.option('singleRun') || options.singleRun; - var reporters = grunt.option('reporters'); - - cp.spawn('node', ['node_modules/karma/bin/karma', 'start', config, - browsers ? '--browsers=' + browsers : '', - singleRun ? '--single-run=' + singleRun : '', - reporters ? '--reporters=' + reporters : '' - ], { stdio: 'inherit' }) - .on('exit', function(code) { - if (code) return grunt.fail.warn('Karma test(s) failed. Exit code: ' + code); - done(); - }); - }); - - grunt.registerMultiTask('protractor', 'Run protractor', function() { - var done = this.async(); - var options = this.options(); - cp.spawn('protractor', [options.configFile], { stdio: 'inherit' }) - .on('exit', function(code) { - if (code) return grunt.fail.warn('Protractor test(s) failed. Exit code: ' + code); - done(); - }); - }); - - grunt.registerMultiTask('version', 'Generate version JSON', function() { - var pkg = grunt.config('pkg'); - this.files.forEach(function(file) { - var dest = file.dest; - var d = new Date(); - var version = { - version: pkg.version, - codename: pkg.codename, - date: grunt.template.today('yyyy-mm-dd'), - time: d.getUTCHours() + ':' + d.getUTCMinutes() + ':' + d.getUTCSeconds() - }; - grunt.file.write(dest, JSON.stringify(version, null, 2)); - }); - }); - - var sauceInstance; - grunt.registerTask('sauce-connect', 'Open tunnel into saucelabs', function() { - var done = this.async(); - require('sauce-connect-launcher')({ - username: process.env.SAUCE_USER, - accessKey: process.env.SAUCE_KEY, - verbose: true, - tunnelIdentifier: process.env.TRAVIS_BUILD_NUMBER - }, function(err, instance) { - if (err) { - grunt.fail.fatal('Failed to launch sauce connect!', err); - } else { - sauceInstance = instance; - } - done(); - }); - }); - - grunt.registerTask('sauce-disconnect', 'Close saucelabs tunnel', function() { - if (sauceInstance) { - var done = this.async(); - sauceInstance.close(done); - } - }); -}; diff --git a/README.md b/README.md index fb1f554573..6f727d8421 100644 --- a/README.md +++ b/README.md @@ -81,14 +81,15 @@ For most cases, you'll need AngularJS as well. This is bundled in `js/angular/` ## Development -* `npm install` to setup -* `grunt` to jshint & build -* `grunt watch` to watch and rebuild on change -* `grunt karma:single` to test one-time -* `grunt karma:watch` to test and re-run on source change -* `grunt protractor:local` to test e2e tests locally (requires static server on port 8080) -* `grunt e2e-watch` to run end to end tests on change of files in `test/e2e/**/*` -* `grunt cloudtest` to run unit & e2e tests in the cloud +* `npm install && npm install -g gulp protractor` to setup +* `gulp` or `gulp build` to build +* `gulp docs` to generate docs (they are generated in tmp/ionic-site; clone ionic-site there if you wish to test them). +* `gulp build --release` to build with minification & strip debugs +* `gulp watch` to watch and rebuild on change +* `gulp karma` to test one-time +* `gulp karma-watch` to test and re-run on source change +* `grunt protractor` to test e2e tests locally (requires static server on port 8080) +* `grunt cloudtest` to run e2e tests in the cloud ### Commit Conventions diff --git a/bower.json b/bower.json index 86cadd6ac0..a521cec176 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ionic", - "version": "0.9.26", + "version": "0.10.0-alpha2", "homepage": "https://github.com/driftyco/ionic", "authors": [ "Max Lynch ", @@ -51,5 +51,10 @@ "angular-animate": "1.2.12", "angular-sanitize": "1.2.12", "angular-ui-router": "0.2.7" + }, + "devDependencies": { + "bootstrap": "~3.1.1", + "lunr.js": "~0.4.5", + "marked": "~0.3.1" } } diff --git a/component.json b/component.json index da62fdc111..4dbf035748 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "repo": "driftyco/ionic", "development": {}, - "version": "0.9.26", + "version": "0.10.0-alpha2", "styles": [ "dist/css/ionic.css" ], diff --git a/config/build.js b/config/build.config.js similarity index 63% rename from config/build.js rename to config/build.config.js index 42b3b811b0..c30c4ff155 100644 --- a/config/build.js +++ b/config/build.config.js @@ -1,7 +1,31 @@ +var fs = require('fs'); module.exports = { - ionicFiles: [ - 'js/_license.js', + dist: 'dist', + distJs: 'dist/js', + distCss: 'dist/css', + banner: + '/*!\n' + + ' * Copyright 2014 Drifty Co.\n' + + ' * http://drifty.com/\n' + + ' *\n' + + ' * Ionic, v<%= pkg.version %>\n' + + ' * A powerful HTML5 mobile app framework.\n' + + ' * http://ionicframework.com/\n' + + ' *\n' + + ' * By @maxlynch, @benjsperry, @adamdbradley <3\n' + + ' *\n' + + ' * Licensed under the MIT license. Please see LICENSE for more information.\n'+ + ' *\n' + + ' */\n\n', + bundleBanner: + '/*!\n' + + ' * ionic.bundle.js is a concatenation of:\n' + + ' * ionic.js, angular.js, angular-animate.js,\n'+ + ' * angular-ui-router.js, and ionic-angular.js\n'+ + ' */\n\n', + + ionicFiles: [ // Base 'js/ionic.js', @@ -40,13 +64,14 @@ module.exports = { 'js/controllers/tabBarController.js' ], + angularIonicFiles: [ - 'js/_license.js', 'js/ext/angular/src/ionicAngular.js', 'js/ext/angular/src/service/**/*.js', 'js/ext/angular/src/directive/**/*.js', 'js/ext/angular/src/controller/**/*.js' ], + //Which vendor files to include in dist, used by build //Matched relative to config/lib/ vendorFiles: [ @@ -64,5 +89,14 @@ module.exports = { 'fonts/ionicons.svg', 'fonts/ionicons.ttf', 'fonts/ionicons.woff' + ], + + ionicBundleFiles: [ + 'dist/js/ionic.js', + 'dist/js/angular/angular.js', + 'dist/js/angular/angular-animate.js', + 'dist/js/angular/angular-sanitize.js', + 'dist/js/angular-ui/angular-ui-router.js', + 'dist/js/ionic-angular.js' ] }; diff --git a/config/karma-sauce.conf.js b/config/karma-sauce.conf.js index 5ade066933..bf67d61701 100644 --- a/config/karma-sauce.conf.js +++ b/config/karma-sauce.conf.js @@ -8,6 +8,7 @@ module.exports = function(config) { testName: 'Ionic unit tests', username: process.env.SAUCE_USER, accessKey: process.env.SAUCE_KEY, + startConnect: false, tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER }, //Saucelabs mobile emulation (esp android emulator) diff --git a/config/karma.conf.js b/config/karma.conf.js index 6f8226a525..e5f10d2d8b 100644 --- a/config/karma.conf.js +++ b/config/karma.conf.js @@ -1,4 +1,4 @@ -var buildConfig = require('./build'); +var buildConfig = require('./build.config.js'); module.exports = function(config) { config.set({ diff --git a/config/protractor.conf.js b/config/protractor.conf.js index a48f3d6132..d4716b67b2 100644 --- a/config/protractor.conf.js +++ b/config/protractor.conf.js @@ -11,7 +11,7 @@ exports.config = { defaultTimeoutInterval: 120000 }, - baseUrl: 'http://localhost:8080', + baseUrl: 'http://localhost:8765', //local build: chrome chromeOnly: true, diff --git a/docs/docs.config.js b/docs/docs.config.js new file mode 100644 index 0000000000..1b62e6718e --- /dev/null +++ b/docs/docs.config.js @@ -0,0 +1,71 @@ +var path = require('canonical-path'); +var basePath = __dirname; + +var basePackage = require('dgeni-packages/ngdoc'); +var pkg = require('../package.json'); + +module.exports = function(config) { + + config = basePackage(config); + + config.set('rendering.outputFolder', '../tmp/ionic-site'); + + //Don't conflict with the jekyll tags + config.set('rendering.nunjucks.config.tags', { + blockStart: '<@', + blockEnd: '@>', + variableStart: '<$', + variableEnd: '$>', + commentStart: '<#', + commentEnd: '#>' + }); + + config.prepend('rendering.templateFolders', [ + path.resolve(basePath, 'templates') + ]); + + config.append('processing.processors', [ + require('./processors/git-data'), + require('./processors/keywords'), + require('./processors/versions-data'), + require('./processors/pages-data'), + require('./processors/index-page'), + require('./processors/debug-dump') + ]); + + config.set('processing.component-groups-generate.outputPathBase', 'docs/angularjs'); + + config.set('processing.pages-data', { + template: ['pages-data.template.html'], + outputPath: '_layouts/docs_0.9.0.html' + }); + + config.append('rendering.filters', [ + require('./filters/capital') + ]); + + config.set('source.projectPath', path.resolve(basePath, '..')); + + config.set('source.files', [ + { pattern: 'js/**/*.js', basePath: path.resolve(basePath,'..') }, + // { pattern: '**/*.ngdoc', basePath: path.resolve(basePath, 'content') } + ]); + + config.set('logging.level', 'info'); + + config.merge('deployment', { + environments: [{ + name: 'debug', + examples: { + commonFiles: { + scripts: [] + }, + dependencyPath: '../../..' + }, + scripts: [], + stylesheets: [] + }] + }); + + return config; +}; diff --git a/docs/filters/capital.js b/docs/filters/capital.js new file mode 100644 index 0000000000..f63edd91ff --- /dev/null +++ b/docs/filters/capital.js @@ -0,0 +1,7 @@ +module.exports = { + name: 'capital', + process: function(str) { + str || (str = ''); + return str.charAt(0).toUpperCase() + str.substring(1); + } +}; diff --git a/docs/ignore.words b/docs/ignore.words new file mode 100644 index 0000000000..82b9f2fc3f --- /dev/null +++ b/docs/ignore.words @@ -0,0 +1,701 @@ +a +able +about +above +abst +accordance +according +accordingly +across +act +actually +added +adj +adopted +affected +affecting +affects +after +afterwards +again +against +ah +all +almost +alone +along +already +also +although +always +am +among +amongst +an +and +announce +another +any +anybody +anyhow +anymore +anyone +anything +anyway +anyways +anywhere +apparently +approximately +are +aren +arent +arise +around +as +aside +ask +asking +at +auth +available +away +awfully +b +back +be +became +because +become +becomes +becoming +been +before +beforehand +begin +beginning +beginnings +begins +behind +being +believe +below +beside +besides +between +beyond +biol +both +brief +briefly +but +by +c +ca +came +can +cannot +can't +cant +cause +causes +certain +certainly +co +com +come +comes +contain +containing +contains +could +couldnt +d +date +did +didn't +didnt +different +do +does +doesn't +doesnt +doing +done +don't +dont +down +downwards +due +during +e +each +ed +edu +effect +eg +eight +eighty +either +else +elsewhere +end +ending +enough +especially +et +et-al +etc +even +ever +every +everybody +everyone +everything +everywhere +ex +except +f +far +few +ff +fifth +first +five +fix +followed +following +follows +for +former +formerly +forth +found +four +from +further +furthermore +g +gave +get +gets +getting +give +given +gives +giving +go +goes +gone +got +gotten +h +had +happens +hardly +has +hasn't +hasnt +have +haven't +havent +having +he +hed +hence +her +here +hereafter +hereby +herein +heres +hereupon +hers +herself +hes +hi +hid +him +himself +his +hither +home +how +howbeit +however +hundred +i +id +ie +if +i'll +ill +im +immediate +immediately +importance +important +in +inc +indeed +index +information +instead +into +invention +inward +is +isn't +isnt +it +itd +it'll +itll +its +itself +i've +ive +j +just +k +keep +keeps +kept +keys +kg +km +know +known +knows +l +largely +last +lately +later +latter +latterly +least +less +lest +let +lets +like +liked +likely +line +little +'ll +'ll +look +looking +looks +ltd +m +made +mainly +make +makes +many +may +maybe +me +mean +means +meantime +meanwhile +merely +mg +might +million +miss +ml +more +moreover +most +mostly +mr +mrs +much +mug +must +my +myself +n +na +name +namely +nay +nd +near +nearly +necessarily +necessary +need +needs +neither +never +nevertheless +new +next +nine +ninety +no +nobody +non +none +nonetheless +noone +nor +normally +nos +not +noted +nothing +now +nowhere +o +obtain +obtained +obviously +of +off +often +oh +ok +okay +old +omitted +on +once +one +ones +only +onto +or +ord +other +others +otherwise +ought +our +ours +ourselves +out +outside +over +overall +owing +own +p +page +pages +part +particular +particularly +past +per +perhaps +placed +please +plus +poorly +possible +possibly +potentially +pp +predominantly +present +previously +primarily +probably +promptly +proud +provides +put +q +que +quickly +quite +qv +r +ran +rather +rd +re +readily +really +recent +recently +ref +refs +regarding +regardless +regards +related +relatively +research +respectively +resulted +resulting +results +right +run +s +said +same +saw +say +saying +says +sec +section +see +seeing +seem +seemed +seeming +seems +seen +self +selves +sent +seven +several +shall +she +shed +she'll +shell +shes +should +shouldn't +shouldnt +show +showed +shown +showns +shows +significant +significantly +similar +similarly +since +six +slightly +so +some +somebody +somehow +someone +somethan +something +sometime +sometimes +somewhat +somewhere +soon +sorry +specifically +specified +specify +specifying +state +states +still +stop +strongly +sub +substantially +successfully +such +sufficiently +suggest +sup +sure +t +take +taken +taking +tell +tends +th +than +thank +thanks +thanx +that +that'll +thatll +thats +that've +thatve +the +their +theirs +them +themselves +then +thence +there +thereafter +thereby +thered +therefore +therein +there'll +therell +thereof +therere +theres +thereto +thereupon +there've +thereve +these +they +theyd +they'll +theyll +theyre +they've +theyve +think +this +those +thou +though +thoughh +thousand +throug +through +throughout +thru +thus +til +tip +to +together +too +took +toward +towards +tried +tries +truly +try +trying +ts +twice +two +u +un +under +unfortunately +unless +unlike +unlikely +until +unto +up +upon +ups +us +use +used +useful +usefully +usefulness +uses +using +usually +v +value +various +'ve +'ve +very +via +viz +vol +vols +vs +w +want +wants +was +wasn't +wasnt +way +we +wed +welcome +we'll +well +went +were +weren't +werent +we've +weve +what +whatever +what'll +whatll +whats +when +whence +whenever +where +whereafter +whereas +whereby +wherein +wheres +whereupon +wherever +whether +which +while +whim +whither +who +whod +whoever +whole +who'll +wholl +whom +whomever +whos +whose +why +widely +will +willing +wish +with +within +without +won't +wont +words +would +wouldn't +wouldnt +www +x +y +yes +yet +you +youd +you'll +youll +your +youre +yours +yourself +yourselves +you've +youve +z +zero diff --git a/docs/processors/debug-dump.js b/docs/processors/debug-dump.js new file mode 100644 index 0000000000..644091a363 --- /dev/null +++ b/docs/processors/debug-dump.js @@ -0,0 +1,26 @@ +var writer = require('dgeni/lib/utils/doc-writer'); +var log = require('winston'); +var util = require("util"); + +var filter, outputPath, depth; + +module.exports = { + name: 'debug-dump', + runBefore: ['write-files'], + description: 'This processor dumps docs that match a filter to a file', + init: function(config, injectables) { + filter = config.get('processing.debug-dump.filter'); + outputPath = config.get('processing.debug-dump.outputPath'); + depth = config.get('processing.debug-dump.depth', 2); + }, + process: function(docs) { + if ( filter && outputPath ) { + log.info('Dumping docs:', filter, outputPath); + var filteredDocs = filter(docs); + var dumpedDocs = util.inspect(filteredDocs, depth); + return writer.writeFile(outputPath, dumpedDocs).then(function() { + return docs; + }); + } + } +}; \ No newline at end of file diff --git a/docs/processors/git-data.js b/docs/processors/git-data.js new file mode 100644 index 0000000000..c62836faa9 --- /dev/null +++ b/docs/processors/git-data.js @@ -0,0 +1,28 @@ +var pkg = require('../../package.json'); + +//TODO get versions from git + +var version = { + major: '0', + minor: '9', + dot: '26', + codename: 'rabbit', + full: 'Nightly', + cdn: '0.9.26' +}; + +module.exports = { + name: 'git-data', + runBefore: ['loading-files'], + description: 'This processor adds information from the local git repository to the extraData injectable', + init: function(config, injectables) { + injectables.value('gitData', { + version: version, + versions: [], + info: 'git-data Information' + }); + }, + process: function(extraData, gitData) { + extraData.git = gitData; + } +}; diff --git a/docs/processors/index-page.js b/docs/processors/index-page.js new file mode 100644 index 0000000000..37a274ec9b --- /dev/null +++ b/docs/processors/index-page.js @@ -0,0 +1,42 @@ +var _ = require('lodash'); +var log = require('winston'); +var path = require('canonical-path'); +var deployment; + +module.exports = { + name: 'index-page', + runAfter: ['adding-extra-docs'], + runBefore: ['extra-docs-added'], + description: 'This processor creates docs that will be rendered as the index page for the app', + init: function(config) { + deployment = config.deployment; + if ( !deployment || !deployment.environments ) { + throw new Error('No deployment environments found in the config.'); + } + }, + process: function(docs) { + + // Collect up all the areas in the docs + var areas = {}; + _.forEach(docs, function(doc) { + if ( doc.area ) { + areas[doc.area] = doc.area; + } + }); + areas = _.keys(areas); + + _.forEach(deployment.environments, function(environment) { + + var indexDoc = _.defaults({ + docType: 'indexPage', + areas: areas + }, environment); + + indexDoc.id = 'index' + (environment.name === 'default' ? '' : '-' + environment.name); + // Use .. to put it at the root of the build + indexDoc.outputPath = indexDoc.id + '.html'; + + docs.push(indexDoc); + }); + } +}; diff --git a/docs/processors/keywords.js b/docs/processors/keywords.js new file mode 100644 index 0000000000..6f7e9c2128 --- /dev/null +++ b/docs/processors/keywords.js @@ -0,0 +1,91 @@ +var _ = require('lodash'); +var log = require('winston'); +var fs = require('fs'); +var path = require('canonical-path'); + +// Keywords to ignore +var wordsToIgnore = []; +var propertiesToIgnore; +var areasToSearch; + +// Keywords start with "ng:" or one of $, _ or a letter +var KEYWORD_REGEX = /^((ng:|[\$_a-z])[\w\-_]+)/; + +module.exports = { + name: 'keywords', + runAfter: ['docs-processed'], + runBefore: ['adding-extra-docs'], + description: 'This processor extracts all the keywords from the document', + init: function(config) { + + // Load up the keywords to ignore, if specified in the config + if ( config.processing.search && config.processing.search.ignoreWordsFile ) { + + var ignoreWordsPath = path.resolve(config.basePath, config.processing.search.ignoreWordsFile); + wordsToIgnore = fs.readFileSync(ignoreWordsPath, 'utf8').toString().split(/[,\s\n\r]+/gm); + + log.debug('Loaded ignore words from "' + ignoreWordsPath + '"'); + log.silly(wordsToIgnore); + + } + + areasToSearch = _.indexBy(config.get('processing.search.areasToSearch', ['api', 'guide', 'misc', 'error', 'tutorial'])); + + propertiesToIgnore = _.indexBy(config.get('processing.search.propertiesToIgnore', [])); + log.debug('Properties to ignore', propertiesToIgnore); + + }, + process: function(docs) { + + var ignoreWordsMap = _.indexBy(wordsToIgnore); + + // If the title contains a name starting with ng, e.g. "ngController", then add the module name + // without the ng to the title text, e.g. "controller". + function extractTitleWords(title) { + var match = /ng([A-Z]\w*)/.exec(title); + if ( match ) { + title = title + ' ' + match[1].toLowerCase(); + } + return title; + } + + function extractWords(text, words, keywordMap) { + + var tokens = text.toLowerCase().split(/[\.\s,`'"#]+/mg); + _.forEach(tokens, function(token){ + var match = token.match(KEYWORD_REGEX); + if (match){ + key = match[1]; + if ( !keywordMap[key]) { + keywordMap[key] = true; + words.push(key); + } + } + }); + } + + + // We are only interested in docs that live in the right area + docs = _.filter(docs, function(doc) { return areasToSearch[doc.area]; }); + + _.forEach(docs, function(doc) { + + var words = []; + var keywordMap = _.clone(ignoreWordsMap); + + // Search each top level property of the document for search terms + _.forEach(doc, function(value, key) { + if ( _.isString(value) && !propertiesToIgnore[key] ) { + extractWords(value, words, keywordMap); + } + }); + + doc.searchTerms = { + titleWords: extractTitleWords(doc.name), + keywords: _.sortBy(words).join(' ') + }; + + }); + + } +}; \ No newline at end of file diff --git a/docs/processors/pages-data.js b/docs/processors/pages-data.js new file mode 100644 index 0000000000..32d877db80 --- /dev/null +++ b/docs/processors/pages-data.js @@ -0,0 +1,220 @@ +var _ = require('lodash'); +var path = require('canonical-path'); +var log = require('winston'); + +var AREA_NAMES = { + api: 'API', + guide: 'Developer Guide', + misc: 'Miscellaneous', + tutorial: 'Tutorial', + error: 'Error Reference' +}; + +function getNavGroup(pages, area, pageSorter, pageMapper) { + + var navItems = _(pages) + // We don't want the child to include the index page as this is already catered for + .omit(function(page) { return page.id === 'index'; }) + + // Apply the supplied sorting function + .sortBy(pageSorter) + + // Apply the supplied mapping function + .map(pageMapper) + + .value(); + + return { + name: area.name, + type: 'group', + href: area.id, + navItems: navItems + }; +} + + +var navGroupMappers = { + api: function(areaPages, area) { + var navGroups = _(areaPages) + .groupBy('module') + + .map(function(modulePages, moduleName) { + log.debug('moduleName: ' + moduleName); + var navItems = []; + var modulePath; + + _(modulePages) + + .groupBy('docType') + + .tap(function(docTypes) { + log.debug(_.keys(docTypes)); + modulePath = 'api/ionic'; + delete docTypes.module; + }) + + .tap(function(docTypes) { + if ( docTypes.input ) { + docTypes.directive = docTypes.directive || []; + // Combine input docTypes into directive docTypes + docTypes.directive = docTypes.directive.concat(docTypes.input); + delete docTypes.input; + } + }) + + .forEach(function(sectionPages, sectionName) { + + sectionPages = _.sortBy(sectionPages, 'name'); + + if ( sectionPages.length > 0 ) { + // Push a navItem for this section + navItems.push({ + name: sectionName, + type: 'section', + href: path.dirname(sectionPages[0].path) + }); + + // Push the rest of the sectionPages for this section + _.forEach(sectionPages, function(sectionPage) { + + navItems.push({ + name: sectionPage.name, + href: sectionPage.path, + type: sectionPage.docType + }); + + }); + } + }); + return { + name: moduleName, + href: modulePath, + type: 'group', + navItems: navItems + }; + }) + .value(); + return navGroups; + }, + tutorial: function(pages, area) { + return [getNavGroup(pages, area, 'step', function(page) { + return { + name: page.name, + step: page.step, + href: page.path, + type: 'tutorial' + }; + })]; + }, + error: function(pages, area) { + return [getNavGroup(pages, area, 'path', function(page) { + return { + name: page.name, + href: page.path, + type: page.docType === 'errorNamespace' ? 'section' : 'error' + }; + })]; + }, + pages: function(pages, area) { + return [getNavGroup(pages, area, 'path', function(page) { + return { + name: page.name, + href: page.path, + type: 'page' + }; + })]; + } +}; + +var outputFolder; +var processorConfig; + +module.exports = { + name: 'pages-data', + description: 'This plugin will create a new doc that will be rendered as an angularjs module ' + + 'which will contain meta information about the pages and navigation', + runAfter: ['adding-extra-docs', 'component-groups-generate'], + runBefore: ['extra-docs-added'], + init: function(config) { + outputFolder = config.rendering.outputFolder; + processorConfig = config.get('processing.pages-data', {}); + }, + process: function(docs) { + + _(docs) + .filter(function(doc) { return doc.area === 'api'; }) + .filter(function(doc) { return doc.docType === 'module'; }) + .map(function(doc) { return _.pick(doc, ['id', 'module', 'docType', 'area']); }) + .tap(function(docs) { + log.debug(docs); + }); + + + // We are only interested in docs that are in a area and not landing pages + var navPages = _.filter(docs, function(page) { + return page.area && + page.docType != 'componentGroup'; + }); + + // Generate an object collection of pages that is grouped by area e.g. + // - area "api" + // - group "ng" + // - section "directive" + // - ngApp + // - ngBind + // - section "global" + // - angular.element + // - angular.bootstrap + // - section "service" + // - $compile + // - group "ngRoute" + // - section "directive" + // - ngView + // - section "service" + // - $route + // + var areas = {}; + _(navPages) + .groupBy('area') + .forEach(function(pages, areaId) { + var area = { + id: areaId, + name: AREA_NAMES[areaId] + }; + areas[areaId] = area; + + var navGroupMapper = navGroupMappers[area.id] || navGroupMappers['pages']; + area.navGroups = navGroupMapper(pages, area); + }); + + + _.forEach(docs, function(doc) { + if ( !doc.path ) { + log.warn('Missing path property for ', doc.id); + } + }); + + // Extract a list of basic page information for mapping paths to paritals and for client side searching + var pages = _(docs) + .map(function(doc) { + var page = _.pick(doc, [ + 'docType', 'id', 'name', 'area', 'outputPath', 'path', 'searchTerms' + ]); + return page; + }) + .indexBy('path') + .value(); + + + var docData = { + docType: 'pages-data', + id: 'pages-data', + template: processorConfig.template || 'pages-data.template.js', + outputPath: processorConfig.outputPath || 'js/pages-data.js', + + areas: areas, + pages: pages + }; + docs.push(docData); + } +}; diff --git a/docs/processors/versions-data.js b/docs/processors/versions-data.js new file mode 100644 index 0000000000..f4e35d4405 --- /dev/null +++ b/docs/processors/versions-data.js @@ -0,0 +1,37 @@ +var _ = require('lodash'); + +module.exports = { + name: 'versions-data', + description: 'This plugin will create a new doc that will be rendered as an angularjs module ' + + 'which will contain meta information about the versions of angular', + runAfter: ['adding-extra-docs', 'pages-data'], + runBefore: ['extra-docs-added'], + process: function(docs, gitData) { + + var version = gitData.version; + var versions = gitData.versions; + + if ( !version ) { + throw new Error('Invalid configuration. Please provide a valid `source.currentVersion` property'); + } + if ( !versions ) { + throw new Error('Invalid configuration. Please provide a valid `source.previousVersions` property'); + } + + var versionDoc = { + docType: 'versions-data', + id: 'versions-data', + template: 'versions-data.template.js', + outputPath: 'js/versions-data.js', + }; + + versionDoc.currentVersion = version; + + versionDoc.versions = _(versions) + .push(version) + .reverse() + .value(); + + docs.push(versionDoc); + } +}; diff --git a/docs/tag-defs/tutorial-step.js b/docs/tag-defs/tutorial-step.js new file mode 100644 index 0000000000..4ebe9d6a4b --- /dev/null +++ b/docs/tag-defs/tutorial-step.js @@ -0,0 +1,9 @@ +module.exports = { + name: 'step', + transformFn: function(doc, tag) { + if ( doc.docType !== 'tutorial' ) { + throw new Error('Invalid tag, step. You should only use this tag on tutorial docs'); + } + return parseInt(tag.description,10); + } +}; diff --git a/docs/templates/api/api.template.html b/docs/templates/api/api.template.html new file mode 100644 index 0000000000..5febfc4e7f --- /dev/null +++ b/docs/templates/api/api.template.html @@ -0,0 +1,41 @@ +<@ extends "base.template.html" @> + +<@ block content @> + +<@ block header @> +## <$ doc.name | dashCase $> +<@ endblock @> + +<@ block description @> +<$ doc.description $> +<@ endblock @> + +<@ if doc.deprecated @> +
+ Deprecated API + <$ doc.deprecated| marked $> +
+<@ endif @> + +<@ block dependencies @> +<@- if doc.requires @> +

Dependencies

+ +<@ endif -@> +<@ endblock @> + +<@ block additional @> +<@ endblock @> + +<@ block examples @> +<@- if doc.examples @> +

Example

+<@- for example in doc.examples -@> + <$ example | marked $> +<@- endfor -@> +<@ endif -@> +<@ endblock @> + +<@ endblock @> diff --git a/docs/templates/api/componentGroup.template.html b/docs/templates/api/componentGroup.template.html new file mode 100644 index 0000000000..98cb010478 --- /dev/null +++ b/docs/templates/api/componentGroup.template.html @@ -0,0 +1,31 @@ +<@ block content @> +

+ <@- if doc.title -@> + <$ doc.title $> + <@- elif doc.module -@> + <$ doc.groupType | title $> components in <$ doc.module | code $> + <@- else -@> + Pages + <@- endif -@> +

+ +<$ doc.description | marked $> + +
+
+ + + + + + <@ for page in doc.components @> + + + + + <@ endfor @> +
NameDescription
<$ page.id | link(page.name, page) $><$ page.description | firstParagraph | marked $>
+
+
+ +<@ endblock @> diff --git a/docs/templates/api/directive.template.html b/docs/templates/api/directive.template.html new file mode 100644 index 0000000000..8967a9ec8a --- /dev/null +++ b/docs/templates/api/directive.template.html @@ -0,0 +1,53 @@ +<@ include "lib/macros.html" -@> +<@ extends "api/api.template.html" @> + +<@ block additional @> + + <@ block usage @> +## Usage + <@ if doc.usage @> + +<$ doc.usage $> + + <@ else @> + <@ if doc.restrict.element @> + + ```html + <<$ doc.name | dashCase $> + <@- for param in doc.params @> + <$ directiveParam(param.alias or param.name, param.type, '="', '"') $> + <@- endfor @>> + ... + > + ``` + <@ endif -@> + + <@- if doc.restrict.attribute -@> + + ```html + <<$ doc.element $> + <@- for param in doc.params @> + <$ directiveParam(param.name, param.type, '="', '"') $> + <@- endfor @>> + ... + > + ``` + <@ endif -@> + + <@- if doc.restrict.cssClass -@> + + ```html + <@ set sep = joiner(' ') @> + <<$ doc.element $> class=" + <@- for param in doc.params -@> + <$ sep() $><$ directiveParam(param.name, param.type, ': ', ';') $> + <@- endfor @>"> ... > + ``` + <@ endif -@> + + <@- endif @> + <@ endblock -@> + + <@ include "lib/params.template.html" @> + <@ include "lib/events.template.html" @> +<@ endblock @> diff --git a/docs/templates/api/filter.template.html b/docs/templates/api/filter.template.html new file mode 100644 index 0000000000..a0e3ff491a --- /dev/null +++ b/docs/templates/api/filter.template.html @@ -0,0 +1,26 @@ +<@ include "lib/macros.html" -@> +<@ extends "api/api.template.html" @> + +<@ block additional @> +

Usage

+

In HTML Template Binding

+ <@ if doc.usage @> + <$ doc.usage | code $> + <@ else @> + <@ code -@> + {{ <$ doc.name $>_expression | <$ doc.name $> + <@- for param in doc.params @> : <$ param.name $><@ endfor -@> + }} + <@- endcode @> + <@ endif @> + +

In JavaScript

+ <@ code -@> + <@- set sep = joiner(', ') -@> + $filter('<$ doc.name $>')(<@ for param in doc.params @><$ sep() $><$ param.name $><@ endfor -@>) + <@- endcode @> + + <@ include "lib/params.template.html" @> + <@ include "lib/this.template.html" @> + <@ include "lib/returns.template.html" @> +<@ endblock @> diff --git a/docs/templates/api/function.template.html b/docs/templates/api/function.template.html new file mode 100644 index 0000000000..5de46698cc --- /dev/null +++ b/docs/templates/api/function.template.html @@ -0,0 +1 @@ +<@ extends "api/object.template.html" @> diff --git a/docs/templates/api/input.template.html b/docs/templates/api/input.template.html new file mode 100644 index 0000000000..ed98e4ec4b --- /dev/null +++ b/docs/templates/api/input.template.html @@ -0,0 +1,12 @@ +<@ include "lib/macros.html" -@> +<@ extends "api/directive.template.html" @> + +<@ block usage @> +

Usage

+ <@ code @> + + <$ directiveParam(param.alias or param.name, param.type, '="', '"') $> + <@- endfor @>> + <@ endcode @> +<@ endblock @> diff --git a/docs/templates/api/module.template.html b/docs/templates/api/module.template.html new file mode 100644 index 0000000000..139e8ac78e --- /dev/null +++ b/docs/templates/api/module.template.html @@ -0,0 +1,70 @@ +<@ extends "base.template.html" @> + +<@ block content @> +

+ <@ if doc.title @><$ doc.title | marked $><@ else @><$ doc.name | code $><@ endif @> +

+ +<$ doc.description | marked $> + +<@ if doc.name != 'ng' and doc.name != 'auto' @> +

Installation

+ +

First include <$ doc.packageFile | code $> in your HTML:

+ + <@ code @> + + + + + +
+ +

+ {{p.id}} +

...

+

...

+

...

+

...

+

...

+
+
+
+ + + diff --git a/package.json b/package.json index bb165bbaf9..9185c198e3 100644 --- a/package.json +++ b/package.json @@ -7,31 +7,36 @@ "url": "git://github.com/driftyco/ionic.git" }, "devDependencies": { - "grunt": "~0.4.1", - "grunt-bump": "0.0.13", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-copy": "~0.5.0", - "grunt-contrib-cssmin": "~0.7.0", - "grunt-contrib-jshint": "~0.8.0", - "grunt-contrib-uglify": "~0.3.2", - "grunt-contrib-watch": "~0.5.3", - "grunt-ddescribe-iit": "0.0.4", - "grunt-merge-conflict": "0.0.2", - "grunt-remove-logging": "~0.2.0", - "grunt-sass": "^0.11.0", - "grunt-string-replace": "~0.2.7", "karma": "~0.11.13", "karma-chrome-launcher": "~0.1.2", "karma-jasmine": "~0.1.5", "karma-phantomjs-launcher": "~0.1.2", "karma-sauce-launcher": "~0.2.0", "karma-script-launcher": "~0.1.0", - "load-grunt-tasks": "~0.3.0", - "grunt-conventional-changelog": "~1.1.0", - "grunt-contrib-connect": "^0.6.0", "sauce-connect-launcher": "^0.2.2", - "dgeni": "^0.1.1", - "dgeni-packages": "^0.2.4" + "dgeni": "^0.2.0", + "dgeni-packages": "ajoslin/dgeni-packages#nunjucks-config", + "gulp-bump": "^0.1.6", + "jshint-stylish": "^0.1.5", + "gulp-template": "^0.1.1", + "gulp-concat": "^2.1.7", + "gulp-cssmin": "^0.1.3", + "gulp-jshint": "^1.5.0", + "gulp-strip-debug": "^0.2.0", + "gulp-sass": "^0.7.1", + "gulp-util": "^2.2.14", + "gulp-uglify": "^0.2.1", + "gulp-rename": "^1.1.0", + "gulp-header": "^1.0.2", + "lodash.template": "^2.4.1", + "connect": "^2.13.0", + "through": "^2.3.4", + "gulp-if": "0.0.5", + "gulp": "^3.5.5", + "canonical-path": "0.0.2", + "lodash": "^2.4.1", + "winston": "^0.7.2", + "minimist": "0.0.8" }, "licenses": [ { diff --git a/scripts/bower/publish.sh b/scripts/bower/publish.sh index f0c99cc524..0390872128 100755 --- a/scripts/bower/publish.sh +++ b/scripts/bower/publish.sh @@ -7,6 +7,8 @@ echo "#### Update bower ###############" echo "#################################" ARG_DEFS=( + "--version=(.*)" + "--codename=(.*)" ) function init { @@ -19,14 +21,13 @@ function init { function run { - VERSION=$(readJsonProp "$PROJECT_DIR/package.json" "version") - CODENAME=$(readJsonProp "$PROJECT_DIR/package.json" "codename") - rm -rf $BOWER_DIR mkdir -p $BOWER_DIR echo "-- Cloning ionic-bower..." - git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-bower.git $BOWER_DIR + git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-bower.git \ + $BOWER_DIR \ + --depth=10 # move the files from the build echo "-- Putting build files in ionic-bower..." diff --git a/scripts/cdn/publish.sh b/scripts/cdn/publish.sh index e5e66b7d77..97ed51e0f2 100755 --- a/scripts/cdn/publish.sh +++ b/scripts/cdn/publish.sh @@ -3,9 +3,10 @@ echo "#################################" echo "#### Update CDN #################" echo "#################################" -# Version label is "nightly" or a version number +# Version name is "nightly" or a version number ARG_DEFS=( - "--version-label=(.*)" + "--version=(.*)" + "--version-name=(.*)" ) function init { @@ -19,14 +20,13 @@ function init { function run { - VERSION=$(readJsonProp "$PROJECT_DIR/package.json" "version") - CODENAME=$(readJsonProp "$PROJECT_DIR/package.json" "codename") - echo "-- Cloning ionic-code..." - git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-code.git $IONIC_CODE_DIR \ + git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-code.git \ + $IONIC_CODE_DIR \ + --depth=10 \ --branch gh-pages - VERSION_DIR=$IONIC_CODE_DIR/$VERSION_LABEL + VERSION_DIR=$IONIC_CODE_DIR/$VERSION_NAME rm -rf $VERSION_DIR mkdir -p $VERSION_DIR @@ -39,7 +39,7 @@ function run { cd $IONIC_CODE_DIR git add -A - git commit -am "release: $VERSION ($VERSION_LABEL)" + git commit -am "release: $VERSION ($VERSION_NAME)" git push -q origin gh-pages diff --git a/scripts/release/finalize-version.sh b/scripts/release/finalize-version.sh deleted file mode 100755 index 633c1f5d8e..0000000000 --- a/scripts/release/finalize-version.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# Inspired by AngularJS's finalize-version script - -# force user to deifne git-push-dryrun so he has to think! -ARG_DEFS=( - "--git-push-dryrun=(true|false)" - "--action=(prepare|publish)" -) - -function prepare { - cd ../.. - - # Remove suffix - OLD_VERSION=$(readJsonProp "package.json" "version") - VERSION=$(echo $OLD_VERSION | sed 's/-.*//') - - replaceJsonProp "package.json" "version" "$VERSION" - - CODENAME=$(readJsonProp "package.json" "codename") - - replaceJsonProp "bower.json" "version" "$VERSION" - replaceJsonProp "component.json" "version" "$VERSION" - - echo "-- Building and putting files in release folder" - grunt build - mkdir -p release - cp -Rf dist/* release - - grunt changelog - - git add package.json bower.json component.json release CHANGELOG.md - git commit -m "chore(release): v$VERSION \"$CODENAME\"" - git tag -f -m "v$VERSION" v$VERSION - - echo "--" - echo "-- Version is now $VERSION, codename $CODENAME." - echo "-- Release commit & tag created. Changelog created." - echo "-- Suggestion: read over the changelog and fix any mistakes, then run git commit -a --amend." - echo "-- When ready to push, run ./scripts/finalize-version.sh --action=publish" - echo "--" -} - -function publish { - cd ../.. - - VERSION=$(readJsonProp "package.json" "version") - - git push origin master - git push origin v$VERSION - - echo "-- Version published as v$VERSION successfully!" - - cd $SCRIPT_DIR -} - -source $(dirname $0)/../utils.inc diff --git a/scripts/release/initialize-new-version.sh b/scripts/release/initialize-new-version.sh deleted file mode 100755 index cb6e36d9f3..0000000000 --- a/scripts/release/initialize-new-version.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# Adapted from Angular's bump script - -echo "#########################################################" -echo "## Increment version, add suffix, and set version name ##" -echo "#########################################################" - -# force user to define git-push-dryrun so he has to think! -ARG_DEFS=( - "--git-push-dryrun=(true|false)" - "--version-type=(patch|minor|major)" - "--version-name=(.+)" - "--version-suffix=(.+)" -) - -function run { - cd ../.. - - grunt bump:$VERSION_TYPE - VERSION=$(readJsonProp "package.json" "version") - - replaceJsonProp "package.json" "version" "$VERSION-$VERSION_SUFFIX" - replaceJsonProp "package.json" "codename" "$VERSION_NAME" - - VERSION=$(readJsonProp "package.json" "version") - - git add package.json - git commit -m "chore(post-release): start v$VERSION" - - git push origin master - - echo "Version initialized & published as v$VERSION successfully!" -} - -source $(dirname $0)/../utils.inc diff --git a/scripts/seed/publish.sh b/scripts/seed/publish.sh index 81ab3ea17c..59047e83af 100755 --- a/scripts/seed/publish.sh +++ b/scripts/seed/publish.sh @@ -4,6 +4,7 @@ echo "# Update ionic-angular-cordova-seed #" echo "#####################################" ARG_DEFS=( + "--version=(.*)" ) function init { @@ -18,10 +19,14 @@ function init { function run { cd ../.. - VERSION=$(readJsonProp "package.json" "version") + rm -rf $SEED_DIR + mkdir -p $SEED_DIR echo "-- Cloning ionic-angular-cordova-seed..." - git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-angular-cordova-seed.git $SEED_DIR + git clone \ + https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-angular-cordova-seed.git \ + $SEED_DIR \ + --depth=10 cd $SEED_DIR @@ -29,7 +34,7 @@ function run { cp -Rf $BUILD_DIR/* $SEED_DIR/www/lib/ git add -A - git commit -am "chore(release): update ionic to v$VERSION" + git commit -am "release: update ionic to v$VERSION" git push -q origin master echo "-- ionic-angular-cordova-seed files update to v$VERSION successfully!" diff --git a/scripts/site/publish.sh b/scripts/site/publish.sh index 05f7bdbf5b..fc73e1dd3f 100755 --- a/scripts/site/publish.sh +++ b/scripts/site/publish.sh @@ -3,26 +3,34 @@ echo "#################################" echo "#### Update Site #################" echo "#################################" -ARG_DEFS=( ) +ARG_DEFS=( + "[--version-name=(.*)]" + "--action=(clone|updateConfig|docs)" +) function init { PROJECT_DIR=$SCRIPT_DIR/../.. BUILD_DIR=$SCRIPT_DIR/../../dist IONIC_SITE_DIR=$SCRIPT_DIR/../../tmp/ionic-site - rm -rf $IONIC_SITE_DIR - mkdir -p $IONIC_SITE_DIR } -function run { +function clone { + rm -rf $IONIC_SITE_DIR + mkdir -p $IONIC_SITE_DIR + + echo "-- Cloning ionic-site..." + git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-site.git \ + $IONIC_SITE_DIR \ + --depth=10 \ + --branch=gh-pages +} + +function updateConfig { VERSION=$(readJsonProp "$BUILD_DIR/version.json" "version") CODENAME=$(readJsonProp "$BUILD_DIR/version.json" "codename") DATE=$(readJsonProp "$BUILD_DIR/version.json" "date") - echo "-- Cloning ionic-site..." - git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-site.git $IONIC_SITE_DIR \ - --branch gh-pages - cd $IONIC_SITE_DIR $(replaceInFile "_config.yml" "latest_download:.*$" "latest_download: http:\/\/code.ionicframework.com\/$VERSION\/ionic-v$VERSION.zip") @@ -34,7 +42,26 @@ function run { git push -q origin gh-pages - echo "-- Published ionic-site to v$VERSION successfully!" + echo "-- Published ionic-site config to v$VERSION successfully!" +} + +# Example: ./scripts/site/publish.sh --action=docs --version-name=nightly +function docs { + cd $IONIC_SITE_DIR + gulp docs + + CHANGES=$(git status --porcelain) + + # if no changes, don't commit + if [[ "$CHANGES" != "" ]]; then + git add -A + git commit -am "docs: update for $VERSION_NAME" + git push -q -f git@github.com:ajoslin/ionic-site.git gh-pages + + echo "-- Updated docs for $VERSION_NAME succesfully!" + else + echo "-- No changes detected in docs for $VERSION_NAME; docs not updated." + fi } source $(dirname $0)/../utils.inc diff --git a/scripts/travis/ci.sh b/scripts/travis/ci.sh index e99b31321f..ea9c5801cb 100755 --- a/scripts/travis/ci.sh +++ b/scripts/travis/ci.sh @@ -31,66 +31,97 @@ function run { echo "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" echo "TRAVIS_COMMIT=$TRAVIS_COMMIT" - # Jshint & check for stupid mistakes - grunt jshint ddescribe-iit merge-conflict + # check for stupid mistakes + # gulp ddescribe-iit # Run simple quick tests on Phantom to be sure any tests pass # Tests are run on cloud browsers after build - grunt karma:single --browsers=PhantomJS --reporters=dots + # gulp karma --browsers=PhantomJS --reporters=dots if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then echo "-- This is a pull request build; will not push build out." exit 0 fi - LATEST_TAG_COMMIT=$(git rev-list $(git describe --tags --abbrev=0) | head -n 1) + mkdir -p tmp + git show $TRAVIS_COMMIT~1:package.json > tmp/package.old.json + OLD_VERSION=$(readJsonProp "tmp/package.old.json" "version") + OLD_CODENAME=$(readJsonProp "tmp/package.old.json" "codename") + VERSION=$(readJsonProp "package.json" "version") + CODENAME=$(readJsonProp "package.json" "codename") - if [[ "$TRAVIS_COMMIT" == "$LATEST_TAG_COMMIT" ]]; then + if [[ "$OLD_VERSION" != "$VERSION" ]]; then IS_RELEASE=true - echo "##################################" - echo "# Pushing out a new full release #" - echo "##################################" + echo "#######################################" + echo "# Releasing v$VERSION \"$CODENAME\"! #" + echo "#######################################" else if [[ "$TRAVIS_BRANCH" != "master" ]]; then - echo "-- We are not on branch master, instead we are on branch $TRAVIS_BRANCH. Will not push build out." + echo "-- We are not on branch master, instead we are on branch $TRAVIS_BRANCH. Aborting build." exit 0 fi echo "#####################################" echo "# Pushing out a new nightly release #" echo "#####################################" + ./scripts/travis/bump-nightly-version.sh + VERSION=$(readJsonProp "package.json" "version") + CODENAME=$(readJsonProp "package.json" "codename") fi - # Build (we are sure to build after version is bumped) - grunt build + # Build files after we are sure our version is correct + gulp build --release=true - # Version label used on the CDN: nightly or the version name if [[ $IS_RELEASE == "true" ]]; then - VERSION_LABEL=$(readJsonProp "package.json" "version") + + ./scripts/travis/release-new-version.sh \ + --codename=$CODENAME \ + --version=$VERSION + + ./scripts/seed/publish.sh \ + --version="$VERSION" + + # Version name used on the CDN/docs: nightly or the version + VERSION_NAME=$VERSION + + ./scripts/site/publish.sh --action="clone" + ./scripts/site/publish.sh --action="updateConfig" + ./scripts/seed/publish.sh --version="$VERSION" else - VERSION_LABEL="nightly" + ./scripts/site/publish.sh --action="clone" + + VERSION_NAME="nightly" fi - ./scripts/cdn/publish.sh --version-label="$VERSION_LABEL" + ./scripts/site/publish.sh \ + --action="docs" \ + --version-name="$VERSION_NAME" - ./scripts/bower/publish.sh + ./scripts/cdn/publish.sh \ + --version=$VERSION \ + --version-name="$VERSION_NAME" - if [[ $IS_RELEASE == "true" ]]; then - ./scripts/seed/publish.sh - ./scripts/site/publish.sh + ./scripts/bower/publish.sh \ + --version="$VERSION" \ + --codename="$CODENAME" + + + if [[ "$IS_RELEASE" == "true" ]]; then + echo "################################################" + echo "# Complete! v$VERSION \"$CODENAME\" published! #" + echo "################################################" + else + echo "##########################" + echo "# Running cloud tests... #" + echo "##########################" + + # Do sauce unit tests and e2e tests with all browsers (takes longer) + gulp cloudtest + + echo "##########################################" + echo "# Complete! v$VERSION nightly published! #" + echo "##########################################" fi - - echo "" - echo "--- Build Complete! Running tests in the cloud. ----" - echo "" - - # Do sauce unit tests and e2e tests with all browsers (takes longer) - grunt cloudtest - - echo "" - echo "--- Build and tests complete! ---" - echo "" - } source $(dirname $0)/../utils.inc diff --git a/scripts/travis/release-new-version.sh b/scripts/travis/release-new-version.sh new file mode 100755 index 0000000000..3d0be96c4b --- /dev/null +++ b/scripts/travis/release-new-version.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Inspired by AngularJS's finalize-version script +# Run by travis when it detects a commit that changes package.json version + +ARG_DEFS=( + "[--remote=(.*)]" + "--codename=(.*)" + "--version=(.*)" +) + +function init { + cd ../.. + + REMOTE=$REMOTE || "origin" + CODENAME=$(readJsonProp "package.json" "codename") + + replaceJsonProp "bower.json" "version" "$VERSION" + replaceJsonProp "component.json" "version" "$VERSION" + + replaceJsonProp "bower.json" "codename" "$CODENAME" + replaceJsonProp "component.json" "codename" "$CODENAME" + + echo "-- Putting built files into release folder" + mkdir -p release + cp -Rf dist/* release + + git add -A + git commit -m "release: v$VERSION \"$CODENAME\"" + git tag -f -m "v$VERSION" v$VERSION + + git push $REMOTE master + git push -q $REMOTE v$VERSION + + echo "-- v$VERSION \"$CODENAME\" pushed to ionic#master successfully!" +} + +source $(dirname $0)/../utils.inc diff --git a/test/e2e/viewState/test.js b/test/e2e/viewState/test.js index dd39027be4..59340e5dc8 100644 --- a/test/e2e/viewState/test.js +++ b/test/e2e/viewState/test.js @@ -1,6 +1,6 @@ describe('viewState', function() { beforeEach(function() { - browser.get('http://localhost:8080/test/e2e/viewState/test.html'); + browser.get('http://localhost:8765/test/e2e/viewState/test.html'); }); function navTitle() {