From ceb26da2dd124ff77c490ad154ecbf2c758fcae0 Mon Sep 17 00:00:00 2001 From: Andrew Joslin Date: Thu, 22 May 2014 16:45:57 -0600 Subject: [PATCH] chore(build): reorganization for local testing & demos --- .gitignore | 1 + bower.json | 2 +- config/build.config.js | 2 - {docs => config/dgeni}/README.md | 0 config/dgeni/demos.config.js | 19 +++ {docs => config/dgeni}/docs.config.js | 52 +++----- {docs => config/dgeni}/filters/capital.js | 0 {docs => config/dgeni}/generate-versions.js | 0 {docs => config/dgeni}/ignore.words | 0 .../dgeni}/inline-tag-defs/link.js | 0 {docs => config/dgeni}/processors/demos.js | 0 .../dgeni}/processors/index-page.js | 16 +-- {docs => config/dgeni}/processors/jekyll.js | 0 config/dgeni/processors/version-data.js | 51 +++++++ {docs => config/dgeni}/tag-defs/index.js | 3 +- .../dgeni}/templates/api/api.template.html | 0 .../api/componentGroup.template.html | 0 .../templates/api/controller.template.html | 0 .../templates/api/directive.template.html | 0 .../dgeni}/templates/api/filter.template.html | 0 .../templates/api/function.template.html | 0 .../dgeni}/templates/api/object.template.html | 0 .../dgeni}/templates/api/page.template.html | 0 .../templates/api/provider.template.html | 0 .../templates/api/service.template.html | 0 .../dgeni}/templates/api/type.template.html | 0 .../templates/api/utility.template.html | 0 .../dgeni/templates/api_index.template.html | 6 +- .../dgeni}/templates/api_menu.template.html | 0 .../templates/api_menu_version.template.html | 0 .../api_version_select.template.html | 0 .../dgeni/templates/demo/app.template.js | 0 .../templates/demo/doc.contents.template | 0 .../dgeni/templates/demo/index.template.html | 0 .../templates/demo/pages-data.template.js | 0 .../dgeni}/templates/lib/events.template.html | 0 .../dgeni}/templates/lib/macros.html | 0 .../templates/lib/methods.template.html | 0 .../templates/lib/properties.template.html | 0 .../templates/lib/returns.template.html | 0 .../dgeni}/templates/lib/this.template.html | 0 .../dgeni}/templates/lib/yaml.template.html | 0 docs/processors/keywords.js | 91 ------------- docs/processors/latest-version.js | 22 ---- docs/processors/version-data.js | 8 -- docs/templates/demo/css.template.css | 1 - docs/templates/demo/html.template.html | 1 - docs/templates/demo/javascript.template.js | 1 - docs/templates/demo/scenario.template.js | 1 - docs/templates/demo/spec.template.js | 1 - gulpfile.js | 30 +++-- scripts/app-base/publish.sh | 33 ++--- scripts/bower/publish.sh | 28 ++-- scripts/cdn/publish.sh | 29 ++-- scripts/seed/publish.sh | 43 ------ scripts/site/publish.sh | 68 +++------- scripts/travis/build.sh | 16 +++ scripts/travis/bump-nightly-version.sh | 22 ---- scripts/travis/ci.sh | 53 ++++---- scripts/travis/release-new-version.sh | 124 +++--------------- 60 files changed, 242 insertions(+), 482 deletions(-) rename {docs => config/dgeni}/README.md (100%) create mode 100644 config/dgeni/demos.config.js rename {docs => config/dgeni}/docs.config.js (63%) rename {docs => config/dgeni}/filters/capital.js (100%) rename {docs => config/dgeni}/generate-versions.js (100%) rename {docs => config/dgeni}/ignore.words (100%) rename {docs => config/dgeni}/inline-tag-defs/link.js (100%) rename {docs => config/dgeni}/processors/demos.js (100%) rename {docs => config/dgeni}/processors/index-page.js (65%) rename {docs => config/dgeni}/processors/jekyll.js (100%) create mode 100644 config/dgeni/processors/version-data.js rename {docs => config/dgeni}/tag-defs/index.js (93%) rename {docs => config/dgeni}/templates/api/api.template.html (100%) rename {docs => config/dgeni}/templates/api/componentGroup.template.html (100%) rename {docs => config/dgeni}/templates/api/controller.template.html (100%) rename {docs => config/dgeni}/templates/api/directive.template.html (100%) rename {docs => config/dgeni}/templates/api/filter.template.html (100%) rename {docs => config/dgeni}/templates/api/function.template.html (100%) rename {docs => config/dgeni}/templates/api/object.template.html (100%) rename {docs => config/dgeni}/templates/api/page.template.html (100%) rename {docs => config/dgeni}/templates/api/provider.template.html (100%) rename {docs => config/dgeni}/templates/api/service.template.html (100%) rename {docs => config/dgeni}/templates/api/type.template.html (100%) rename {docs => config/dgeni}/templates/api/utility.template.html (100%) rename docs/templates/index.template.html => config/dgeni/templates/api_index.template.html (89%) rename {docs => config/dgeni}/templates/api_menu.template.html (100%) rename {docs => config/dgeni}/templates/api_menu_version.template.html (100%) rename {docs => config/dgeni}/templates/api_version_select.template.html (100%) rename docs/templates/demo_script.template.js => config/dgeni/templates/demo/app.template.js (100%) create mode 100644 config/dgeni/templates/demo/doc.contents.template rename docs/templates/demo_index.template.html => config/dgeni/templates/demo/index.template.html (100%) rename docs/templates/demo_list.template.js => config/dgeni/templates/demo/pages-data.template.js (100%) rename {docs => config/dgeni}/templates/lib/events.template.html (100%) rename {docs => config/dgeni}/templates/lib/macros.html (100%) rename {docs => config/dgeni}/templates/lib/methods.template.html (100%) rename {docs => config/dgeni}/templates/lib/properties.template.html (100%) rename {docs => config/dgeni}/templates/lib/returns.template.html (100%) rename {docs => config/dgeni}/templates/lib/this.template.html (100%) rename {docs => config/dgeni}/templates/lib/yaml.template.html (100%) delete mode 100644 docs/processors/keywords.js delete mode 100644 docs/processors/latest-version.js delete mode 100644 docs/processors/version-data.js delete mode 100644 docs/templates/demo/css.template.css delete mode 100644 docs/templates/demo/html.template.html delete mode 100644 docs/templates/demo/javascript.template.js delete mode 100644 docs/templates/demo/scenario.template.js delete mode 100644 docs/templates/demo/spec.template.js delete mode 100755 scripts/seed/publish.sh create mode 100755 scripts/travis/build.sh delete mode 100755 scripts/travis/bump-nightly-version.sh diff --git a/.gitignore b/.gitignore index 400c39629a..acd2e1e6b0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules *.sw[mnpcod] *.log +*.tmp log.txt example/cordova/iOS/www/js/framework diff --git a/bower.json b/bower.json index aad8d456b2..4271c15388 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "ionic", "version": "1.0.0-beta.6", - "codename": "cadmium-camel", + "codename": "gadolinium-gator", "homepage": "https://github.com/driftyco/ionic", "authors": [ "Max Lynch ", diff --git a/config/build.config.js b/config/build.config.js index 1afbf0487d..4b714ba505 100644 --- a/config/build.config.js +++ b/config/build.config.js @@ -3,8 +3,6 @@ var fs = require('fs'); module.exports = { dist: 'dist', - distJs: 'dist/js', - distCss: 'dist/css', releasePostUrl: fs.readFileSync('config/RELEASE_POST_URL'), banner: diff --git a/docs/README.md b/config/dgeni/README.md similarity index 100% rename from docs/README.md rename to config/dgeni/README.md diff --git a/config/dgeni/demos.config.js b/config/dgeni/demos.config.js new file mode 100644 index 0000000000..5ebdb5ca8d --- /dev/null +++ b/config/dgeni/demos.config.js @@ -0,0 +1,19 @@ +var path = require('canonical-path'); +var _ = require('lodash'); + +var projectBase = path.resolve(__dirname, '../..'); + +module.exports = function(config) { + + config.set('logging.level', 'info'); + + config.set('rendering.templateFolders', [ + path.resolve(__dirname, 'templates/demo') + ]); + + config.set('basePath', __dirname); + config.set('source.projectPath', '.'); + + config.set('rendering.outputFolder', path.resolve(projectBase, 'temp/ionic-demo')); + +}; diff --git a/docs/docs.config.js b/config/dgeni/docs.config.js similarity index 63% rename from docs/docs.config.js rename to config/dgeni/docs.config.js index 437c87c9d3..6f958aa846 100644 --- a/docs/docs.config.js +++ b/config/dgeni/docs.config.js @@ -1,13 +1,11 @@ var path = require('canonical-path'); -var basePath = path.resolve(__dirname, '..'); - var _ = require('lodash'); - var basePackage = require('dgeni-packages/ngdoc'); -var pkg = require('../package.json'); + +var projectBase = path.resolve(__dirname, '../..'); +var pkg = require('../../package.json'); module.exports = function(config) { - config.set('currentVersion', process.env.DOC_VERSION || 'nightly'); config = basePackage(config); @@ -19,36 +17,35 @@ module.exports = function(config) { config.set('basePath', __dirname); config.set('source.projectPath', '.'); - config.set('rendering.outputFolder', '../temp/ionic-site'); - var versionData = require('./generate-versions')(config); - config.set('versionData', versionData); - config.set('rendering.contentsFolder', path.join('docs', versionData.current.folder)); - - config.set('demos.outputFolder', path.join(__dirname, '../temp/ionic-demo')); + config.set('rendering.outputFolder', path.resolve(projectBase, 'dist/ionic-site')); + //contentsFolder is set in the version-data processor config.set('processing.api-docs', { outputPath: 'api/${docType}/${name}/index.md', path: 'api/${docType}/${name}/', moduleOutputPath: 'api/module/${name}/index.md', - modulePath: 'api/module/${name}/', - mergeableTypes: { - demo: 'demos' - } + modulePath: 'api/module/${name}/' }); - config.append('rendering.filters', [ - require('./filters/capital') - ]); - - config.set('source.files', [ - { pattern: 'js/**/*.js', basePath: basePath } - ]); - config.append('processing.inlineTagDefinitions', [ require('./inline-tag-defs/link') ]); + config.set('source.files', [ + { pattern: 'js/**/*.js', basePath: projectBase } + ]); + + config.append('processing.processors', [ + require('./processors/version-data'), + require('./processors/index-page'), + require('./processors/jekyll'), + ]); + + config.append('rendering.filters', [ + require('./filters/capital') + ]); + config.append('processing.tagDefinitions', require('./tag-defs')); //Don't conflict with the jekyll tags @@ -61,14 +58,5 @@ module.exports = function(config) { commentEnd: '#>' }); - config.append('processing.processors', [ - require('./processors/latest-version'), - require('./processors/keywords'), - require('./processors/index-page'), - require('./processors/version-data'), - require('./processors/jekyll'), - require('./processors/demos') - ]); - return config; }; diff --git a/docs/filters/capital.js b/config/dgeni/filters/capital.js similarity index 100% rename from docs/filters/capital.js rename to config/dgeni/filters/capital.js diff --git a/docs/generate-versions.js b/config/dgeni/generate-versions.js similarity index 100% rename from docs/generate-versions.js rename to config/dgeni/generate-versions.js diff --git a/docs/ignore.words b/config/dgeni/ignore.words similarity index 100% rename from docs/ignore.words rename to config/dgeni/ignore.words diff --git a/docs/inline-tag-defs/link.js b/config/dgeni/inline-tag-defs/link.js similarity index 100% rename from docs/inline-tag-defs/link.js rename to config/dgeni/inline-tag-defs/link.js diff --git a/docs/processors/demos.js b/config/dgeni/processors/demos.js similarity index 100% rename from docs/processors/demos.js rename to config/dgeni/processors/demos.js diff --git a/docs/processors/index-page.js b/config/dgeni/processors/index-page.js similarity index 65% rename from docs/processors/index-page.js rename to config/dgeni/processors/index-page.js index 0681e621bf..7129ba0621 100644 --- a/docs/processors/index-page.js +++ b/config/dgeni/processors/index-page.js @@ -1,31 +1,29 @@ var path = require('canonical-path'); var log = require('winston'); -var currentVersion; -var contentsFolder; module.exports = { name: 'index-page', runAfter: ['adding-extra-docs'], runBefore: ['extra-docs-added'], description: 'Create documentation index page', - init: function(config) { - currentVersion = config.get('currentVersion'); - contentsFolder = config.get('rendering.contentsFolder'); - }, process: function(docs, config) { + var currentVersion = config.get('currentVersion'); + var contentsFolder = config.get('rendering.contentsFolder'); + var latestVersion = config.get('versionData.latest'); + docs.push({ docType: 'index-page', id: 'index-page', currentVersion: currentVersion, - template: 'index.template.html', + template: 'api_index.template.html', outputPath: contentsFolder + '/api/index.md' }); - if (config.get('versionData').latest.name !== currentVersion) { + if (latestVersion.name !== currentVersion) { docs.push({ docType: 'index-page', id: 'index-page', currentVersion: currentVersion, - template: 'index.template.html', + template: 'api_index.template.html', outputPath: contentsFolder + '/api/index.md' }); } diff --git a/docs/processors/jekyll.js b/config/dgeni/processors/jekyll.js similarity index 100% rename from docs/processors/jekyll.js rename to config/dgeni/processors/jekyll.js diff --git a/config/dgeni/processors/version-data.js b/config/dgeni/processors/version-data.js new file mode 100644 index 0000000000..1d2a62e5d2 --- /dev/null +++ b/config/dgeni/processors/version-data.js @@ -0,0 +1,51 @@ +var _ = require('lodash'); +var fs = require('fs'); +var semver = require('semver'); +var path = require('canonical-path'); + +module.exports = { + name: 'version-data', + runBefore: ['reading-files'], + description: 'Expose version data to templates', + process: function(extraData, config) { + var basePath = config.get('basePath'); + var outputFolder = config.get('rendering.outputFolder'); + var currentVersion = config.get('currentVersion'); + + var docsBaseFolder = path.resolve(basePath, outputFolder, 'docs'); + + var versions; + try { + versions = fs.readdirSync(docsBaseFolder) + .filter(semver.valid) + .sort(semver.rcompare); + } catch(e) { + versions = []; + } + + !_.contains(versions, currentVersion) && versions.unshift(currentVersion); + !_.contains(versions, 'nightly') && versions.unshift('nightly'); + + //First semver valid version is latest + var latestVersion = _.find(versions, semver.valid); + versions = versions.map(function(version) { + //Latest version is in docs root + var folder = version == latestVersion ? '' : version; + return { + href: path.join('/docs', folder), + folder: folder, + name: version + }; + }); + + var versionData = { + list: versions, + current: _.find(versions, { name: currentVersion }), + latest: _.find(versions, {name: latestVersion}) || _.first(versions) + }; + + config.set('rendering.contentsFolder', path.join('docs', versionData.current.folder)); + config.set('versionData', versionData); + extraData.version = versionData; + } +}; diff --git a/docs/tag-defs/index.js b/config/dgeni/tag-defs/index.js similarity index 93% rename from docs/tag-defs/index.js rename to config/dgeni/tag-defs/index.js index b121a55902..3835077df5 100644 --- a/docs/tag-defs/index.js +++ b/config/dgeni/tag-defs/index.js @@ -20,7 +20,6 @@ module.exports = [ { name: 'alias' }, { name: 'demo' }, { name: 'javascript' }, - { name: 'css' }, { name: 'html' }, - { name: 'ngModule' } + { name: 'css' } ]; diff --git a/docs/templates/api/api.template.html b/config/dgeni/templates/api/api.template.html similarity index 100% rename from docs/templates/api/api.template.html rename to config/dgeni/templates/api/api.template.html diff --git a/docs/templates/api/componentGroup.template.html b/config/dgeni/templates/api/componentGroup.template.html similarity index 100% rename from docs/templates/api/componentGroup.template.html rename to config/dgeni/templates/api/componentGroup.template.html diff --git a/docs/templates/api/controller.template.html b/config/dgeni/templates/api/controller.template.html similarity index 100% rename from docs/templates/api/controller.template.html rename to config/dgeni/templates/api/controller.template.html diff --git a/docs/templates/api/directive.template.html b/config/dgeni/templates/api/directive.template.html similarity index 100% rename from docs/templates/api/directive.template.html rename to config/dgeni/templates/api/directive.template.html diff --git a/docs/templates/api/filter.template.html b/config/dgeni/templates/api/filter.template.html similarity index 100% rename from docs/templates/api/filter.template.html rename to config/dgeni/templates/api/filter.template.html diff --git a/docs/templates/api/function.template.html b/config/dgeni/templates/api/function.template.html similarity index 100% rename from docs/templates/api/function.template.html rename to config/dgeni/templates/api/function.template.html diff --git a/docs/templates/api/object.template.html b/config/dgeni/templates/api/object.template.html similarity index 100% rename from docs/templates/api/object.template.html rename to config/dgeni/templates/api/object.template.html diff --git a/docs/templates/api/page.template.html b/config/dgeni/templates/api/page.template.html similarity index 100% rename from docs/templates/api/page.template.html rename to config/dgeni/templates/api/page.template.html diff --git a/docs/templates/api/provider.template.html b/config/dgeni/templates/api/provider.template.html similarity index 100% rename from docs/templates/api/provider.template.html rename to config/dgeni/templates/api/provider.template.html diff --git a/docs/templates/api/service.template.html b/config/dgeni/templates/api/service.template.html similarity index 100% rename from docs/templates/api/service.template.html rename to config/dgeni/templates/api/service.template.html diff --git a/docs/templates/api/type.template.html b/config/dgeni/templates/api/type.template.html similarity index 100% rename from docs/templates/api/type.template.html rename to config/dgeni/templates/api/type.template.html diff --git a/docs/templates/api/utility.template.html b/config/dgeni/templates/api/utility.template.html similarity index 100% rename from docs/templates/api/utility.template.html rename to config/dgeni/templates/api/utility.template.html diff --git a/docs/templates/index.template.html b/config/dgeni/templates/api_index.template.html similarity index 89% rename from docs/templates/index.template.html rename to config/dgeni/templates/api_index.template.html index 26d345439f..4b532da0bd 100644 --- a/docs/templates/index.template.html +++ b/config/dgeni/templates/api_index.template.html @@ -1,5 +1,9 @@ --- -<@ include "lib/yaml.template.html" @> +layout: "docs_api" +version: "<$ version.current.name $>" +versionHref: "<$ version.current.href $>" +path: "" + title: Javascript header_sub_title: Extend Ionic even further with the power of AngularJS searchable: false diff --git a/docs/templates/api_menu.template.html b/config/dgeni/templates/api_menu.template.html similarity index 100% rename from docs/templates/api_menu.template.html rename to config/dgeni/templates/api_menu.template.html diff --git a/docs/templates/api_menu_version.template.html b/config/dgeni/templates/api_menu_version.template.html similarity index 100% rename from docs/templates/api_menu_version.template.html rename to config/dgeni/templates/api_menu_version.template.html diff --git a/docs/templates/api_version_select.template.html b/config/dgeni/templates/api_version_select.template.html similarity index 100% rename from docs/templates/api_version_select.template.html rename to config/dgeni/templates/api_version_select.template.html diff --git a/docs/templates/demo_script.template.js b/config/dgeni/templates/demo/app.template.js similarity index 100% rename from docs/templates/demo_script.template.js rename to config/dgeni/templates/demo/app.template.js diff --git a/config/dgeni/templates/demo/doc.contents.template b/config/dgeni/templates/demo/doc.contents.template new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/templates/demo_index.template.html b/config/dgeni/templates/demo/index.template.html similarity index 100% rename from docs/templates/demo_index.template.html rename to config/dgeni/templates/demo/index.template.html diff --git a/docs/templates/demo_list.template.js b/config/dgeni/templates/demo/pages-data.template.js similarity index 100% rename from docs/templates/demo_list.template.js rename to config/dgeni/templates/demo/pages-data.template.js diff --git a/docs/templates/lib/events.template.html b/config/dgeni/templates/lib/events.template.html similarity index 100% rename from docs/templates/lib/events.template.html rename to config/dgeni/templates/lib/events.template.html diff --git a/docs/templates/lib/macros.html b/config/dgeni/templates/lib/macros.html similarity index 100% rename from docs/templates/lib/macros.html rename to config/dgeni/templates/lib/macros.html diff --git a/docs/templates/lib/methods.template.html b/config/dgeni/templates/lib/methods.template.html similarity index 100% rename from docs/templates/lib/methods.template.html rename to config/dgeni/templates/lib/methods.template.html diff --git a/docs/templates/lib/properties.template.html b/config/dgeni/templates/lib/properties.template.html similarity index 100% rename from docs/templates/lib/properties.template.html rename to config/dgeni/templates/lib/properties.template.html diff --git a/docs/templates/lib/returns.template.html b/config/dgeni/templates/lib/returns.template.html similarity index 100% rename from docs/templates/lib/returns.template.html rename to config/dgeni/templates/lib/returns.template.html diff --git a/docs/templates/lib/this.template.html b/config/dgeni/templates/lib/this.template.html similarity index 100% rename from docs/templates/lib/this.template.html rename to config/dgeni/templates/lib/this.template.html diff --git a/docs/templates/lib/yaml.template.html b/config/dgeni/templates/lib/yaml.template.html similarity index 100% rename from docs/templates/lib/yaml.template.html rename to config/dgeni/templates/lib/yaml.template.html diff --git a/docs/processors/keywords.js b/docs/processors/keywords.js deleted file mode 100644 index 6f7e9c2128..0000000000 --- a/docs/processors/keywords.js +++ /dev/null @@ -1,91 +0,0 @@ -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/latest-version.js b/docs/processors/latest-version.js deleted file mode 100644 index 6f0706a0f1..0000000000 --- a/docs/processors/latest-version.js +++ /dev/null @@ -1,22 +0,0 @@ -var copy = require('cp-r'); -var mkdirp = require('mkdirp'); -var path = require('canonical-path'); - -module.exports = { - name: 'latest-version', - runAfter: ['write-files'], - description: 'Copy the latest version (that was compiled to docs/latest) into docs/versionName', - process: function(docs, config) { - var versionData = config.get('versionData'); - - var docsBase = path.join(config.get('basePath'), config.get('rendering.outputFolder'), 'docs'); - var versionDir = path.join(docsBase, versionData.latest.name); - var latestDir = path.join(docsBase, 'api'); - - mkdirp(versionDir, function() { - copy(latestDir, path.join(versionDir, 'api'), { - deleteFirst: true - }); - }); - } -}; diff --git a/docs/processors/version-data.js b/docs/processors/version-data.js deleted file mode 100644 index d0baf3761f..0000000000 --- a/docs/processors/version-data.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - name: 'version-data', - runBefore: ['api-docs'], - description: 'Expose version data to templates', - process: function(extraData, config) { - extraData.version = config.get('versionData'); - } -}; diff --git a/docs/templates/demo/css.template.css b/docs/templates/demo/css.template.css deleted file mode 100644 index a8340eabca..0000000000 --- a/docs/templates/demo/css.template.css +++ /dev/null @@ -1 +0,0 @@ -<$ doc.contents $> diff --git a/docs/templates/demo/html.template.html b/docs/templates/demo/html.template.html deleted file mode 100644 index a8340eabca..0000000000 --- a/docs/templates/demo/html.template.html +++ /dev/null @@ -1 +0,0 @@ -<$ doc.contents $> diff --git a/docs/templates/demo/javascript.template.js b/docs/templates/demo/javascript.template.js deleted file mode 100644 index a8340eabca..0000000000 --- a/docs/templates/demo/javascript.template.js +++ /dev/null @@ -1 +0,0 @@ -<$ doc.contents $> diff --git a/docs/templates/demo/scenario.template.js b/docs/templates/demo/scenario.template.js deleted file mode 100644 index a8340eabca..0000000000 --- a/docs/templates/demo/scenario.template.js +++ /dev/null @@ -1 +0,0 @@ -<$ doc.contents $> diff --git a/docs/templates/demo/spec.template.js b/docs/templates/demo/spec.template.js deleted file mode 100644 index a8340eabca..0000000000 --- a/docs/templates/demo/spec.template.js +++ /dev/null @@ -1 +0,0 @@ -<$ doc.contents $> diff --git a/gulpfile.js b/gulpfile.js index 3497a5687b..b8861e5d3d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,5 +1,6 @@ var gulp = require('gulp'); var karma = require('karma').server; +var path = require('canonical-path'); var pkg = require('./package.json'); var semver = require('semver'); var through = require('through'); @@ -47,6 +48,10 @@ if (IS_RELEASE_BUILD) { ); } +if (argv.dist) { + buildConfig.dist = argv.dist; +} + gulp.task('default', ['build']); gulp.task('build', ['bundle', 'sass']); gulp.task('validate', ['jshint', 'ddescribe-iit', 'karma']); @@ -57,8 +62,11 @@ gulp.task('docs', function(done) { console.log('Usage: gulp docs --doc-version=(nightly|versionName)'); return process.exit(1); } - process.env.DOC_VERSION = docVersion; - return dgeni.generator(__dirname + '/docs/docs.config.js')().then(function() { + + var config = dgeni.loadConfig(path.join(__dirname, '/config/dgeni/docs.config.js')); + config.set('currentVersion', docVersion); + + return dgeni.generator(config)().then(function() { gutil.log('Docs for', gutil.colors.cyan(docVersion), 'generated!'); }); }); @@ -106,12 +114,12 @@ gulp.task('bundle', [ })) .pipe(header(buildConfig.bundleBanner)) .pipe(concat('ionic.bundle.min.js')) - .pipe(gulp.dest(buildConfig.distJs)); + .pipe(gulp.dest(buildConfig.dist + '/js')); return gulp.src(buildConfig.ionicBundleFiles) .pipe(header(buildConfig.bundleBanner)) .pipe(concat('ionic.bundle.js')) - .pipe(gulp.dest(buildConfig.distJs)); + .pipe(gulp.dest(buildConfig.dist + '/js')); }); gulp.task('jshint', function() { @@ -149,11 +157,11 @@ gulp.task('scripts', function() { .pipe(header(buildConfig.closureStart)) .pipe(footer(buildConfig.closureEnd)) .pipe(header(banner)) - .pipe(gulp.dest(buildConfig.distJs)) + .pipe(gulp.dest(buildConfig.dist + '/js')) .pipe(gulpif(IS_RELEASE_BUILD, uglify())) .pipe(rename({ extname: '.min.js' })) .pipe(header(banner)) - .pipe(gulp.dest(buildConfig.distJs)); + .pipe(gulp.dest(buildConfig.dist + '/js')); }); gulp.task('scripts-ng', function() { @@ -163,11 +171,11 @@ gulp.task('scripts-ng', function() { .pipe(header(buildConfig.closureStart)) .pipe(footer(buildConfig.closureEnd)) .pipe(header(banner)) - .pipe(gulp.dest(buildConfig.distJs)) + .pipe(gulp.dest(buildConfig.dist + '/js')) .pipe(gulpif(IS_RELEASE_BUILD, uglify())) .pipe(rename({ extname: '.min.js' })) .pipe(header(banner)) - .pipe(gulp.dest(buildConfig.distJs)); + .pipe(gulp.dest(buildConfig.dist + '/js')); }); gulp.task('sass', function(done) { @@ -184,10 +192,10 @@ gulp.task('sass', function(done) { } })) .pipe(concat('ionic.css')) - .pipe(gulp.dest(buildConfig.distCss)) + .pipe(gulp.dest(buildConfig.dist + '/css')) .pipe(gulpif(IS_RELEASE_BUILD, minifyCss())) .pipe(rename({ extname: '.min.css' })) - .pipe(gulp.dest(buildConfig.distCss)) + .pipe(gulp.dest(buildConfig.dist + '/css')) .on('end', done); }); @@ -204,7 +212,7 @@ gulp.task('version', function() { time: time })) .pipe(rename('version.json')) - .pipe(gulp.dest('dist')); + .pipe(gulp.dest(buildConfig.dist)); }); gulp.task('release-tweet', function(done) { diff --git a/scripts/app-base/publish.sh b/scripts/app-base/publish.sh index b05ee62fec..9dd9bd9371 100755 --- a/scripts/app-base/publish.sh +++ b/scripts/app-base/publish.sh @@ -8,39 +8,34 @@ ARG_DEFS=( ) function init { - PROJECT_DIR=$SCRIPT_DIR/../.. - TMP_DIR=$PROJECT_DIR/temp - BUILD_DIR=$PROJECT_DIR/dist + APPBASE_DIR=$IONIC_DIST_DIR/app-base + APPBASE_LIB_DIR=$APPBASE_DIR/www/lib/ionic + + echo "-- Cloning ionic-app-base..." - APPBASE_DIR=$TMP_DIR/app-base rm -rf $APPBASE_DIR mkdir -p $APPBASE_DIR + git clone \ + https://driftyco:$GH_TOKEN@github.com/driftyco/ionic-app-base.git \ + $APPBASE_DIR \ + --depth=1 + } function run { cd ../.. - rm -rf $APPBASE_DIR - mkdir -p $APPBASE_DIR - - echo "-- Cloning ionic-app-base..." - git clone \ - https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-app-base.git \ - $APPBASE_DIR \ - --depth=10 - cd $APPBASE_DIR echo "-- Updating files..." - rm -rf $APPBASE_DIR/www/lib/ionic - mkdir -p $APPBASE_DIR/www/lib/ionic - replaceJsonProp "$APPBASE_DIR/bower.json" "ionic" "driftyco/ionic-bower#$VERSION" + rm -rf $APPBASE_LIB_DIR + mkdir -p $APPBASE_LIB_DIR - cp -Rf $BUILD_DIR/* $APPBASE_DIR/www/lib/ionic + cp -Rf $IONIC_BUILD_DIR/* $APPBASE_LIB_DIR + cp -Rf $IONIC_SCSS_DIR $APPBASE_LIB_DIR - mkdir -p $APPBASE_DIR/www/lib/ionic/scss - cp -Rf $PROJECT_DIR/scss/* $APPBASE_DIR/www/lib/ionic/scss + replaceJsonProp "$APPBASE_DIR/bower.json" "ionic" "driftyco\/ionic-bower#$VERSION" git add -A git commit -am "release: update ionic to v$VERSION" diff --git a/scripts/bower/publish.sh b/scripts/bower/publish.sh index 40c636cf5b..c7f6a52a45 100755 --- a/scripts/bower/publish.sh +++ b/scripts/bower/publish.sh @@ -12,37 +12,31 @@ ARG_DEFS=( ) function init { - TMP_DIR=$SCRIPT_DIR/../../temp - BUILD_DIR=$SCRIPT_DIR/../../dist - PROJECT_DIR=$SCRIPT_DIR/../.. + BOWER_DIR=$IONIC_DIST_DIR/ionic-bower - BOWER_DIR=$TMP_DIR/ionic-bower -} - -function run { + echo "-- Cloning ionic-bower..." 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 \ + git clone https://driftyco:$GH_TOKEN@github.com/driftyco/ionic-bower.git \ $BOWER_DIR \ - --depth=10 + --depth=1 +} + +function run { # move the files from the build echo "-- Putting build files in ionic-bower..." cd $BOWER_DIR - cp -Rf $BUILD_DIR/* $BOWER_DIR - cp -Rf $PROJECT_DIR/scss $BOWER_DIR + cp -Rf $IONIC_BUILD_DIR/* $BOWER_DIR + cp -Rf $IONIC_SCSS_DIR $BOWER_DIR # Angular dependencies are managed by bower, don't include them - rm -rf $BOWER_DIR/js/angular* - rm -rf $BOWER_DIR/CHANGELOG* - rm -rf $BOWER_DIR/version.json # unneeded + rm -rf $BOWER_DIR/{js/angular*,CHANGELOG*,version.json} echo "-- Copying bower.json from project_dir and renaming main files" - node -p "var b = require('$PROJECT_DIR/bower.json'); \ + node -p "var b = require('$IONIC_DIR/bower.json'); \ delete b.ignore; \ b.main = b.main.map(function(s) { return s.replace(/^release\//,''); }); \ JSON.stringify(b,null,2);" \ diff --git a/scripts/cdn/publish.sh b/scripts/cdn/publish.sh index 82d9370536..79e91b11c1 100755 --- a/scripts/cdn/publish.sh +++ b/scripts/cdn/publish.sh @@ -10,34 +10,33 @@ ARG_DEFS=( ) function init { - PROJECT_DIR=$SCRIPT_DIR/../.. - BUILD_DIR=$SCRIPT_DIR/../../dist + CDN_DIR=$IONIC_DIST_DIR/ionic-code - IONIC_CODE_DIR=$SCRIPT_DIR/../../temp/ionic-code - rm -rf $IONIC_CODE_DIR - mkdir -p $IONIC_CODE_DIR + echo "-- Cloning ionic-code..." + + rm -rf $CDN_DIR + mkdir -p $CDN_DIR + git clone https://driftyco:$GH_TOKEN@github.com/driftyco/ionic-code.git \ + $CDN_DIR \ + --branch gh-pages \ + --depth=1 } function run { - echo "-- Cloning ionic-code..." - git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-code.git \ - $IONIC_CODE_DIR \ - --depth=10 \ - --branch gh-pages + VERSION_DIR=$CDN_DIR/$VERSION_NAME - VERSION_DIR=$IONIC_CODE_DIR/$VERSION_NAME rm -rf $VERSION_DIR mkdir -p $VERSION_DIR - cd $VERSION_DIR - cp -Rf $BUILD_DIR/* $VERSION_DIR + + cp -Rf $IONIC_BUILD_DIR/* $VERSION_DIR echo "-- Generating versions.json..." - cd $IONIC_CODE_DIR/builder + cd $CDN_DIR/builder python ./generate.py - cd $IONIC_CODE_DIR + cd $CDN_DIR git add -A git commit -am "release: $VERSION ($VERSION_NAME)" diff --git a/scripts/seed/publish.sh b/scripts/seed/publish.sh deleted file mode 100755 index 9eecfca77d..0000000000 --- a/scripts/seed/publish.sh +++ /dev/null @@ -1,43 +0,0 @@ - -echo "#####################################" -echo "# Update ionic-angular-cordova-seed #" -echo "#####################################" - -ARG_DEFS=( - "--version=(.*)" -) - -function init { - TMP_DIR=$SCRIPT_DIR/../../temp - BUILD_DIR=$SCRIPT_DIR/../../dist - - SEED_DIR=$TMP_DIR/seed - rm -rf $SEED_DIR - mkdir -p $SEED_DIR -} - -function run { - cd ../.. - - 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 \ - --depth=10 - - cd $SEED_DIR - - echo "-- Updating files..." - cp -Rf $BUILD_DIR/* $SEED_DIR/www/lib/ - - git add -A - 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!" -} - -source $(dirname $0)/../utils.inc diff --git a/scripts/site/publish.sh b/scripts/site/publish.sh index ab159c0fc8..00a019dafe 100755 --- a/scripts/site/publish.sh +++ b/scripts/site/publish.sh @@ -1,40 +1,32 @@ ARG_DEFS=( "[--version-name=(.*)]" - "--action=(clone|updateConfig|docs|demos)" + "--action=(updateConfig|docs)" ) function init { - PROJECT_DIR=$SCRIPT_DIR/../.. - BUILD_DIR=$SCRIPT_DIR/../../dist + SITE_DIR=$IONIC_DIST_DIR/ionic-site - IONIC_SITE_DIR=$SCRIPT_DIR/../../temp/ionic-site -} - -function clone { - echo "#################################" - echo "## Cloning ionic-site repo.... ##" - echo "#################################" - - rm -rf $IONIC_SITE_DIR - mkdir -p $IONIC_SITE_DIR - - git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic-site.git \ - $IONIC_SITE_DIR \ - --depth=10 \ - --branch=gh-pages + echo "-- Cloning ionic-site..." + # rm -rf $SITE_DIR + # mkdir -p $SITE_DIR + # git clone https://driftyco:$GH_TOKEN@github.com/driftyco/ionic-site.git \ + # $SITE_DIR \ + # --depth=1 \ + # --branch=gh-pages } function updateConfig { + echo "#####################################" - echo "## Cloning ionic-site config.yml... #" + echo "## Updating ionic-site config.yml.. #" echo "#####################################" - VERSION=$(readJsonProp "$BUILD_DIR/version.json" "version") - CODENAME=$(readJsonProp "$BUILD_DIR/version.json" "codename") - DATE=$(readJsonProp "$BUILD_DIR/version.json" "date") + VERSION=$(readJsonProp "$IONIC_BUILD_DIR/version.json" "version") + CODENAME=$(readJsonProp "$IONIC_BUILD_DIR/version.json" "codename") + DATE=$(readJsonProp "$IONIC_BUILD_DIR/version.json" "date") - cd $IONIC_SITE_DIR + cd $SITE_DIR $(replaceInFile "_config.yml" "latest_download:.*$" "latest_download: http:\/\/code.ionicframework.com\/$VERSION\/ionic-v$VERSION.zip") $(replaceInFile "_config.yml" "latest_version:.*$" "latest_version: $VERSION \"$CODENAME\"") @@ -50,17 +42,18 @@ function updateConfig { # Example: ./scripts/site/publish.sh --action=docs --version-name=nightly function docs { + echo "#####################################" echo "## Updating docs for $VERSION_NAME ##" echo "#####################################" - cd $PROJECT_DIR + cd $IONIC_DIR gulp docs --doc-version="$VERSION_NAME" gulp docs-index VERSION=$(readJsonProp "package.json" "version") - cd $IONIC_SITE_DIR + cd $SITE_DIR CHANGES=$(git status --porcelain) @@ -76,29 +69,4 @@ function docs { fi } -function demos { - echo "######################################" - echo "## Updating demos for $VERSION_NAME ##" - echo "######################################" - - cd $IONIC_SITE_DIR - - mkdir -p demos - cp -Rf $PROJECT_DIR/demos/* demos - - CHANGES=$(git status --porcelain) - VERSION=$(readJsonProp "$PROJECT_DIR/package.json" "version") - - # if no changes, don't commit - if [[ "$CHANGES" == "" ]]; then - echo "-- No changes detected in demos for $VERSION; demos not updated." - else - git add -A - git commit -am "demos: update for $VERSION" - git push -q origin gh-pages - - echo "-- Updated deoms for $VERSION successfully!" - fi -} - source $(dirname $0)/../utils.inc diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh new file mode 100755 index 0000000000..6cdcf8de5d --- /dev/null +++ b/scripts/travis/build.sh @@ -0,0 +1,16 @@ +# run this from project root +# source ./scripts/travis/build.sh + +export IONIC_DIR=$PWD +export IONIC_SCSS_DIR=$IONIC_DIR/scss +export IONIC_DIST_DIR=$IONIC_DIR/dist +export IONIC_BUILD_DIR=$IONIC_DIR/dist/build + +echo IONIC_DIR=$IONIC_DIR +echo IONIC_SCSS_DIR=IONIC_SCSS_DIR=$IONIC_SCSS_DIR +echo IONIC_DIST_DIR=$IONIC_DIST_DIR +echo IONIC_BUILD_DIR=$IONIC_BUILD_DIR + +mkdir -p $IONIC_DIST_DIR $IONIC_BUILD_DIR +gulp build --release --dist="$IONIC_BUILD_DIR" + diff --git a/scripts/travis/bump-nightly-version.sh b/scripts/travis/bump-nightly-version.sh deleted file mode 100755 index 5590534bfa..0000000000 --- a/scripts/travis/bump-nightly-version.sh +++ /dev/null @@ -1,22 +0,0 @@ - -echo "###########################################" -echo "# Writing nightly version in package.json #" -echo "###########################################" - -ARG_DEFS=( -) - -function run { - - cd ../.. - - VERSION=$(readJsonProp "package.json" "version") - - NEW_VERSION="$VERSION-nightly-$TRAVIS_BUILD_NUMBER" - - replaceJsonProp "package.json" "version" "$NEW_VERSION" - - echo "-- Build version is $NEW_VERSION." -} - -source $(dirname $0)/../utils.inc diff --git a/scripts/travis/ci.sh b/scripts/travis/ci.sh index d0e5a8a289..01768d0865 100755 --- a/scripts/travis/ci.sh +++ b/scripts/travis/ci.sh @@ -10,29 +10,27 @@ function init { if [[ "$TRAVIS" == "true" ]]; then git config --global user.name 'Ionitron' git config --global user.email hi@ionicframework.com - export GH_ORG=driftyco - export RELEASE_REMOTE=origin + export GIT_PUSH_DRYRUN="false" else # For testing if we aren't on travis export TRAVIS_BUILD_NUMBER=$RANDOM export TRAVIS_PULL_REQUEST=false export TRAVIS_COMMIT=$(git rev-parse HEAD) export TRAVIS_BRANCH=master - # use your github username as GH_ORG to push to, and it will push to ORG/ionic-code, etc - export GH_ORG=ajoslin - export RELEASE_REMOTE=ajoslin + export GIT_PUSH_DRYRUN="true" fi } function run { cd ../.. - echo "GH_ORG=$GH_ORG" + echo "GH_ORG=driftyco" echo "RELEASE_REMOTE=$RELEASE_REMOTE" echo "TRAVIS_BRANCH=$TRAVIS_BRANCH" echo "TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER" echo "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" echo "TRAVIS_COMMIT=$TRAVIS_COMMIT" + echo "GIT_PUSH_DRYRUN=$GIT_PUSH_DRYRUN" # check for stupid mistakes gulp jshint @@ -47,9 +45,9 @@ function run { exit 0 fi - mkdir -p temp - git show $TRAVIS_COMMIT~1:package.json > temp/package.old.json - OLD_VERSION=$(readJsonProp "temp/package.old.json" "version") + git show $TRAVIS_COMMIT~1:package.json > package-old.json.tmp + OLD_VERSION=$(readJsonProp "package-old.json.tmp" "version") + VERSION=$(readJsonProp "package.json" "version") CODENAME=$(readJsonProp "package.json" "codename") @@ -77,13 +75,26 @@ function run { echo "# Pushing out a new nightly release #" echo "#####################################" - ./scripts/travis/bump-nightly-version.sh - VERSION=$(readJsonProp "package.json" "version") - CODENAME=$(readJsonProp "package.json" "codename") + CURRENT_VERSION=$VERSION + VERSION="$CURRENT_VERSION-nightly-$TRAVIS_BUILD_NUMBER" + replaceJsonProp "package.json" "version" "$VERSION" + + echo "-- Build version is $NEW_VERSION." fi - # Build files after we are sure our version is correct - gulp build --release + export IONIC_DIR=$PWD + export IONIC_SCSS_DIR=$IONIC_DIR/scss + export IONIC_DIST_DIR=$IONIC_DIR/dist + export IONIC_BUILD_DIR=$IONIC_DIR/dist/build + + mkdir -p $IONIC_DIST_DIR $IONIC_BUILD_DIR + gulp build --release --dist="$IONIC_BUILD_DIR" + + echo "IONIC_DIR=$IONIC_DIR" + echo "IONIC_SCSS_DIR=IONIC_SCSS_DIR=$IONIC_SCSS_DIR" + echo "IONIC_DIST_DIR=$IONIC_DIST_DIR" + echo "IONIC_BUILD_DIR=$IONIC_BUILD_DIR" + if [[ $IS_RELEASE == "true" ]]; then @@ -94,16 +105,13 @@ function run { # 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" ./scripts/app-base/publish.sh --version="$VERSION" - ./scripts/travis/release-new-version.sh \ - --action="tweetAndIrc" \ - --version=$VERSION + gulp release-tweet + gulp release-irc + else - ./scripts/site/publish.sh --action="clone" VERSION_NAME="nightly" @@ -118,10 +126,6 @@ function run { --action="docs" \ --version-name="$VERSION_NAME" - ./scripts/site/publish.sh \ - --action="demos" \ - --version-name="$VERSION_NAME" - ./scripts/cdn/publish.sh \ --version=$VERSION \ --version-name="$VERSION_NAME" @@ -150,4 +154,3 @@ function run { } source $(dirname $0)/../utils.inc - diff --git a/scripts/travis/release-new-version.sh b/scripts/travis/release-new-version.sh index cf59f3b50b..c8d521e744 100755 --- a/scripts/travis/release-new-version.sh +++ b/scripts/travis/release-new-version.sh @@ -3,139 +3,49 @@ ARG_DEFS=( "--version=(.*)" "[--old-version=(.*)]" - "--action=(.*)" ) function init { - TMP_DIR=$SCRIPT_DIR/../../temp - BUILD_DIR=$SCRIPT_DIR/../../dist - PROJECT_DIR=$SCRIPT_DIR/../.. + PUSH_DIR=$IONIC_DIST_DIR/ionic - IONIC_DIR=$TMP_DIR/ionic + echo "-- Cloning ionic master ..." + + rm -rf $PUSH_DIR + mkdir -p $PUSH_DIR + git clone https://driftyco:$GH_TOKEN@github.com/driftyco/ionic.git \ + $PUSH_DIR \ + --depth=1 } -function push { +function run { echo "##############################" echo "# Pushing release $VERSION #" echo "##############################" - cd ../.. - - rm -rf $IONIC_DIR - mkdir -p $IONIC_DIR - - echo "-- Cloning ionic master ..." - git clone https://$GH_ORG:$GH_TOKEN@github.com/$GH_ORG/ionic.git \ - $IONIC_DIR \ - --depth=10 - - cd $IONIC_DIR + cd $PUSH_DIR # Get first codename in list - CODENAME=$(readJsonProp "$PROJECT_DIR/package.json" "codename") + CODENAME=$(readJsonProp "$IONIC_DIR/package.json" "codename") replaceJsonProp "package.json" "version" "$VERSION" replaceJsonProp "bower.json" "version" "$VERSION" replaceJsonProp "component.json" "version" "$VERSION" echo "-- Putting built files into release folder" + + rm -rf release mkdir -p release - cp -Rf $PROJECT_DIR/dist/* release + cp -Rf $IONIC_BUILD_DIR/* release git add -A git commit -m "finalize-release: v$VERSION \"$CODENAME\"" git tag -f -m "v$VERSION" v$VERSION - git push -q $RELEASE_REMOTE master - git push -q $RELEASE_REMOTE v$VERSION - - echo "-- v$VERSION \"$CODENAME\" pushed to $RELEASE_REMOTE/master successfully!" -} - -# Unused. TODO remove and rewrite as node.js script -function github { - echo "-- Pushing out github release..." - - # Get only newest things in changelog - sed until previous version is hit - sed -e '/'"$OLD_VERSION"'/,$d' $PROJECT_DIR/CHANGELOG.md | tail -n +3 \ - > $TMP_DIR/CHANGELOG_NEW.md - - CODENAME=$(readJsonProp "$IONIC_DIR/package.json" "codename") - - # we have to get all releases, then find the one corresponding to this new tag - curl https://api.github.com/repos/$GH_ORG/ionic/releases > $TMP_DIR/releases.json - - node -e "var releases = require('$TMP_DIR/releases.json'); \ - var id; \ - releases.forEach(function(r) { \ - if (r.tag_name == 'v$VERSION') { \ - id = r.id; \ - } \ - }); \ - require('fs').writeFileSync('$TMP_DIR/RELEASE_ID', id || '');" - - node -e "var fs = require('fs'); \ - fs.writeFileSync('$TMP_DIR/github.json', JSON.stringify({ \ - name: \"v$VERSION '$CODENAME'\", \ - tag_name: \"v$VERSION\", \ - body: fs.readFileSync('$TMP_DIR/CHANGELOG_NEW.md').toString() \ - }));" - - RELEASE_ID=$(cat $TMP_DIR/RELEASE_ID) - if [[ "$RELEASE_ID" == "" ]]; then - curl -X POST https://api.github.com/repos/$GH_ORG/ionic/releases \ - -H "Authorization: token $GH_TOKEN" \ - --data-binary @$TMP_DIR/github.json - else - curl -X PATCH https://api.github.com/repos/$GH_ORG/ionic/releases/$RELEASE_ID \ - -H "Authorization: token $GH_TOKEN" \ - --data-binary @$TMP_DIR/github.json - fi - - - echo "-- Github release pushed out successfully!" -} - -# Unused. TODO remove and rewrite as node.js script -function discourse { - CODENAME=$(readJsonProp "$IONIC_DIR/package.json" "codename") - # Get only newest things in changelog - sed until previous version is hit - sed -e '/'"$OLD_VERSION"'/,$d' $PROJECT_DIR/CHANGELOG.md | tail -n +3 \ - > $TMP_DIR/NEW_CHANGELOG.md - - node -e "var fs=require('fs'); \ - fs.writeFileSync('$TMP_DIR/discourse.json', \ - \"api_key=$DISCOURSE_TOKEN\" + \ - \"&api_username=Ionitron\" + \ - \"&title=\" + encodeURIComponent(\"v$VERSION '$CODENAME' Released!\") + \ - \"&raw=\" + encodeURIComponent(\"Download Instructions: https://github.com/driftyco/ionic#quick-start\n\n\" + fs.readFileSync('$TMP_DIR/CHANGELOG_NEW.md').toString()) \ - )"; - - curl -X POST http://forum.ionicframework.com/posts \ - -H 'Content-Type: application/x-www-form-urlencoded' \ - --data-binary @$TMP_DIR/discourse.json \ - > $TMP_DIR/discourse-response.json - - touch $IONIC_DIR/config/RELEASE_POST_URL - OLD_POST_URL=$(cat $IONIC_DIR/config/RELEASE_POST_URL) - if [[ "$OLD_POST_URL" != "" ]]; then - curl -X PUT "$OLD_POST_URL/status" --data "api_key=$DISCOURSE_TOKEN&api_username=Ionitron&status=pinned&enabled=false" - fi - - POST_URL=`node -e "var res = require('$TMP_DIR/discourse-response.json'); \ - console.log(\"http://forum.ionicframework.com/t/\" + res.topic_slug + \"/\" + res.topic_id);"` - echo $POST_URL > $IONIC_DIR/config/RELEASE_POST_URL - - curl -X PUT "$POST_URL/status" \ - --data "api_key=$DISCOURSE_TOKEN&api_username=Ionitron&status=pinned&enabled=true" - # curl -X PUT "$POST_URL/status" \ - # --data "api_key=$DISCOURSE_TOKEN&api_username=Ionitron&status=closed&enabled=true" - - cd $IONIC_DIR - git add config - git commit config -m 'chore(release): update discourse post url' git push -q origin master + git push -q origin v$VERSION + + echo "-- v$VERSION \"$CODENAME\" pushed to origin/master successfully!" } function tweetAndIrc {