mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Ionitron tweet
Must be run with release command Move code to bottom of gulp file Add twitter keys Send off a test tweet Update twitter secrets Awesome it worked, delete always tweet
This commit is contained in:
11
.travis.yml
11
.travis.yml
@@ -1,24 +1,23 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.10
|
||||
|
||||
- 0.1
|
||||
env:
|
||||
global:
|
||||
- secure: C49JZxX08FSiXEZYpIFDs4YRdZGB0Hyygkk8zFknALLxPCREwk/MLhs64FOftgcVYjyo1CpmEZfmlKdHDnuko8mUjERrn/3iFHO2Fi0Z/zbj1pDkHlkoeIWGu3JS9y5mDAC1N0AO+pbMQp1jy+qTbHZsBsRCM4tVeEoLVdLmwOU=
|
||||
- secure: EXFisiY1QVmeXLOQRcZHcY3kJNfUUhBgVfe8492Ion/+djwi/e6bRbuZvU8Axvz26CpdRwS9IWSsZm7J3Eu+g3ORsBqILbJ0hTO4m7UJyt8hZxeRJZEOmQI2S0NcOFkIdSgNbrvxZoF8ZNFrp96kQWR3/5wMYRGcxtu/1JTqVy0=
|
||||
- secure: QGukWuP7Li6RDnvxszY/qX/nySshmwiOYQJOKyG0YqAGjV4aFxfdA1pOffqPXEYn2KK6eB5DDx3YjDgtVnBClxV26CUdDhwy0reNKj8UrzgN/NSYeFy6EnOZMDz+DtPJXpUSXnGa3HtaOxbxG8mrpPFSPEeCY6Ci4M119hyslFY=
|
||||
|
||||
- secure: ANeKOUjQA68r92tf4qW4/uqT+kn7jTG9nPwZD2nE0G3RpWFfLa0/g1IXqGb9w5ILxwnKFB6yzBQu9ERjHY595jshFTeJhUei35fJyZy56S9eG7eLqZGjHgz+1G7tsKd7mikkGNCF0OyLh/BtMucqWFPsARlQTJpjl79Ctv7vitU=
|
||||
- secure: ClLLhCzhh6nGAWxEmmMFZXoLfFes3qYhEmr6CrrH4jKoAn2Zw/AWRQgcchAcvELUOZuhOh5JKMFTq7yqBFDI5zRIaB+AKM6B7lyl5F6jCKR4IdLYtW/3f0nbmL/z1y046g4Prr//2LDQ5H/uQ1syqRkrd9W+mMundVuNewaObf8=
|
||||
- secure: 2fk0b82A5q+FtU8M5MUIjxfbm+nxlDC3e7eHksgqfRY7v8odHWjJxJliBF50sP8qkVsop3HRONtxHcX09RpYfjAg2JVWd0QNtKF3PtpyJQO1Oe3oRBLCQSLM3H2O8vp0lXOrqjP3gKCVcqKZftPOJkR1HwwSmgCuDEkEBja/WlU=
|
||||
- secure: venr/q6rVyF2AbiT34XjWZvtXXOPKSusgbIcpNRoSBhs/fxJu6LKZ1byPJsdohBPLxsxd6J+3RJLU+dQul49uY6HCk7+uFETgQAU/H+DE3585eHaUwOyuOoYv/psoEuMXAopbAekJwZw/rnnpGh73CxychuQQUVDsJnt5QsbOwI=
|
||||
notifications:
|
||||
hipchat:
|
||||
rooms:
|
||||
secure: mkHfRTsuxidtOOORbJJ0Jspb/DSa8jAiQwWWUljqLwefy1p4HGC9P/rLdXXg3vsjiulCzyjEkfvDWAHXvu34GhGWfQuD8U140Fon1Os3AO5Hbme+yRmjXmTcgH8XetSLQufyBBMqXHMd6o1tkxXql1p54G1IShhgAdPNe76d5ZE=
|
||||
|
||||
before_install:
|
||||
- npm install -g gulp protractor
|
||||
|
||||
before_script:
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
|
||||
script:
|
||||
- ./scripts/travis/ci.sh
|
||||
|
||||
291
gulpfile.js
291
gulpfile.js
@@ -1,3 +1,10 @@
|
||||
var gulp = require('gulp');
|
||||
var pkg = require('./package.json');
|
||||
var semver = require('semver');
|
||||
var through = require('through');
|
||||
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
var _ = require('lodash');
|
||||
var buildConfig = require('./config/build.config.js');
|
||||
var changelog = require('conventional-changelog');
|
||||
@@ -13,13 +20,6 @@ var http = require('http');
|
||||
var cp = require('child_process');
|
||||
var fs = require('fs');
|
||||
|
||||
var gulp = require('gulp');
|
||||
var pkg = require('./package.json');
|
||||
var semver = require('semver');
|
||||
var through = require('through');
|
||||
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
var concat = require('gulp-concat');
|
||||
var footer = require('gulp-footer');
|
||||
var gulpif = require('gulp-if');
|
||||
@@ -30,6 +30,7 @@ var rename = require('gulp-rename');
|
||||
var sass = require('gulp-sass');
|
||||
var stripDebug = require('gulp-strip-debug');
|
||||
var template = require('gulp-template');
|
||||
var twitter = require('gulp-twitter');
|
||||
var uglify = require('gulp-uglify');
|
||||
var gutil = require('gulp-util');
|
||||
|
||||
@@ -43,140 +44,9 @@ if (IS_RELEASE_BUILD) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
gulp.task('default', ['build']);
|
||||
gulp.task('build', ['bundle', 'sass']);
|
||||
|
||||
gulp.task('docs-index', function() {
|
||||
var idx = lunr(function() {
|
||||
this.field('path');
|
||||
this.field('title', {boost: 10});
|
||||
this.field('body');
|
||||
this.ref('id');
|
||||
});
|
||||
var ref = {};
|
||||
var refId = 0;
|
||||
|
||||
function addToIndex(path, title, layout, body) {
|
||||
// Add the data to the indexer and ref object
|
||||
idx.add({'path': path, 'body': body, 'title': title, id: refId});
|
||||
ref[refId] = {'p': path, 't': title, 'l': layout};
|
||||
refId++;
|
||||
}
|
||||
|
||||
return gulp.src([
|
||||
'tmp/ionic-site/docs/{components,guide,api,overview}/**/*.{md,html,markdown}',
|
||||
'tmp/ionic-site/docs/index.html',
|
||||
'tmp/ionic-site/getting-started/index.html',
|
||||
'tmp/ionic-site/tutorials/**/*.{md,html,markdown}',
|
||||
'tmp/ionic-site/_posts/**/*.{md,html,markdown}'
|
||||
])
|
||||
.pipe(es.map(function(file, callback) {
|
||||
//docs for gulp file objects: https://github.com/wearefractal/vinyl
|
||||
var contents = file.contents.toString(); //was buffer
|
||||
|
||||
// Grab relative path from ionic-site root
|
||||
var relpath = file.path.replace(/^.*?tmp\/ionic-site\//, '');
|
||||
|
||||
// Read out the yaml portion of the Jekyll file
|
||||
var yamlStartIndex = contents.indexOf('---');
|
||||
|
||||
if (yamlStartIndex === -1) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
// read Jekyll's page yaml variables at the top of the file
|
||||
var yamlEndIndex = contents.indexOf('---', yamlStartIndex+3); //starting from start
|
||||
var yamlRaw = contents.substring(yamlStartIndex+3, yamlEndIndex);
|
||||
|
||||
var pageData = yaml.safeLoad(yamlRaw);
|
||||
if(!pageData.title || !pageData.layout) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
// manually set to not be searchable, or for a blog post, manually set to be searchable
|
||||
if(pageData.searchable === false || (pageData.layout == 'post' && pageData.searchable !== true)) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
// clean up some content so code variables are searchable too
|
||||
contents = contents.substring(yamlEndIndex+3);
|
||||
contents = contents.replace(/<code?>/gi, '');
|
||||
contents = contents.replace(/<\/code>/gi, '');
|
||||
contents = contents.replace(/<code?></gi, '');
|
||||
contents = contents.replace(/><\/code>/gi, '');
|
||||
contents = contents.replace(/`</gi, '');
|
||||
contents = contents.replace(/>`/gi, '');
|
||||
|
||||
// create a clean path to the URL
|
||||
var path = '/' + relpath.replace('index.md', '')
|
||||
.replace('index.html', '')
|
||||
.replace('.md', '.html')
|
||||
.replace('.markdown', '.html');
|
||||
if(pageData.layout == 'post') {
|
||||
path = '/blog/' + path.substring(19).replace('.html', '/');
|
||||
}
|
||||
|
||||
if(pageData.search_sections === true) {
|
||||
// each section within the content should be its own search result
|
||||
var section = { body: '', title: '' };
|
||||
var isTitleOpen = false;
|
||||
|
||||
var parser = new htmlparser.Parser({
|
||||
ontext: function(text){
|
||||
if(isTitleOpen) {
|
||||
section.title += text; // get the title of this section
|
||||
} else {
|
||||
section.body += text.replace(/{%.*%}/, '', 'g'); // Ignore any Jekyll expressions
|
||||
}
|
||||
},
|
||||
onopentag: function(name, attrs) {
|
||||
if(name == 'section' && attrs.id) {
|
||||
// start building new section data
|
||||
section = { body: '', path: path + '#' + attrs.id, title: '' };
|
||||
} else if( (name == 'h1' || name == 'h2' || name == 'h3') && attrs.class == 'title') {
|
||||
isTitleOpen = true; // the next text will be this sections title
|
||||
}
|
||||
},
|
||||
onclosetag: function(name) {
|
||||
if(name == 'section') {
|
||||
// section closed, index this section then clear it out
|
||||
addToIndex(section.path, section.title, pageData.layout, section.body);
|
||||
section = { body: '', title: '' };
|
||||
} else if( (name == 'h1' || name == 'h2' || name == 'h3') && isTitleOpen) {
|
||||
isTitleOpen = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
parser.write(contents);
|
||||
parser.end();
|
||||
|
||||
} else {
|
||||
// index the entire page
|
||||
var body = '';
|
||||
var parser = new htmlparser.Parser({
|
||||
ontext: function(text){
|
||||
body += text.replace(/{%.*%}/, '', 'g'); // Ignore any Jekyll expressions
|
||||
}
|
||||
});
|
||||
parser.write(contents);
|
||||
parser.end();
|
||||
|
||||
addToIndex(path, pageData.title, pageData.layout, body);
|
||||
}
|
||||
|
||||
callback();
|
||||
|
||||
})).on('end', function() {
|
||||
// Write out as one json file
|
||||
mkdirp.sync('tmp/ionic-site/data');
|
||||
fs.writeFileSync(
|
||||
'tmp/ionic-site/data/index.json',
|
||||
JSON.stringify({'ref': ref, 'index': idx.toJSON()})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('docs', function(done) {
|
||||
var docVersion = argv['doc-version'];
|
||||
if (docVersion != 'nightly' && !semver.valid(docVersion)) {
|
||||
@@ -317,6 +187,151 @@ gulp.task('version', function() {
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('tweet', function() {
|
||||
var oauth = {
|
||||
consumerKey: process.env.TWITTER_CONSUMER_KEY,
|
||||
consumerSecret: process.env.TWITTER_CONSUMER_SECRET,
|
||||
accessToken: process.env.TWITTER_ACCESS_TOKEN,
|
||||
accessTokenSecret: process.env.TWITTER_ACCESS_TOKEN_SECRET
|
||||
};
|
||||
var exclamations = ["Aah","Ah","Aha","All right","Aw","Ay","Aye","Bah","Boy","By golly","Boom","Cheerio","Cheers","Come on","Crikey","Dear me","Egads","Fiddle-dee-dee","Gadzooks","Gangway","G'day","Gee whiz","Gesundheit","Get outta here","Good golly","Good job","Gosh","Gracious","Great","Gulp","Ha","Ha-ha","Hah","Hallelujah","Harrumph","Hey","Hooray","Hot dog","Hurray","Huzza","I say","La-di-dah","Look","Look here","Long time","Lordy","Most certainly","My my","My word","Oh","Oho","Oh-oh","Oh no","Okay","Okey-dokey","Ooh","Oye","Phew","Quite","Ready","Right on","Roger that","Rumble","Say","See ya","Snap","Sup","Ta-da","Take that","Tally ho","Thanks","Toodles","Touche","Tut-tut","Very nice","Very well","Voila","Vroom","Well done","Well, well","Whoa","Whoopee","Whew","Word up","Wow","Wuzzup","Ya","Yea","Yeah","Yippee","Yo","Yoo-hoo","You bet","You don't say","You know","Yow","Yum","Yummy","Zap","Zounds","Zowie"];
|
||||
if(IS_RELEASE_BUILD && argv.codeversion && argv.codename) {
|
||||
var tweet = exclamations[Math.floor(Math.random()*exclamations.length)]+'! Just released @IonicFramework '+argv.codename+' v'+argv.codeversion+' https://github.com/driftyco/ionic/releases/tag/v'+argv.codeversion;
|
||||
console.log(tweet);
|
||||
return gulp.src('package.json')
|
||||
.pipe(twitter(oauth, tweet));
|
||||
}
|
||||
});
|
||||
|
||||
gulp.task('docs-index', function() {
|
||||
var idx = lunr(function() {
|
||||
this.field('path');
|
||||
this.field('title', {boost: 10});
|
||||
this.field('body');
|
||||
this.ref('id');
|
||||
});
|
||||
var ref = {};
|
||||
var refId = 0;
|
||||
|
||||
function addToIndex(path, title, layout, body) {
|
||||
// Add the data to the indexer and ref object
|
||||
idx.add({'path': path, 'body': body, 'title': title, id: refId});
|
||||
ref[refId] = {'p': path, 't': title, 'l': layout};
|
||||
refId++;
|
||||
}
|
||||
|
||||
return gulp.src([
|
||||
'tmp/ionic-site/docs/{components,guide,api,overview}/**/*.{md,html,markdown}',
|
||||
'tmp/ionic-site/docs/index.html',
|
||||
'tmp/ionic-site/getting-started/index.html',
|
||||
'tmp/ionic-site/tutorials/**/*.{md,html,markdown}',
|
||||
'tmp/ionic-site/_posts/**/*.{md,html,markdown}'
|
||||
])
|
||||
.pipe(es.map(function(file, callback) {
|
||||
//docs for gulp file objects: https://github.com/wearefractal/vinyl
|
||||
var contents = file.contents.toString(); //was buffer
|
||||
|
||||
// Grab relative path from ionic-site root
|
||||
var relpath = file.path.replace(/^.*?tmp\/ionic-site\//, '');
|
||||
|
||||
// Read out the yaml portion of the Jekyll file
|
||||
var yamlStartIndex = contents.indexOf('---');
|
||||
|
||||
if (yamlStartIndex === -1) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
// read Jekyll's page yaml variables at the top of the file
|
||||
var yamlEndIndex = contents.indexOf('---', yamlStartIndex+3); //starting from start
|
||||
var yamlRaw = contents.substring(yamlStartIndex+3, yamlEndIndex);
|
||||
|
||||
var pageData = yaml.safeLoad(yamlRaw);
|
||||
if(!pageData.title || !pageData.layout) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
// manually set to not be searchable, or for a blog post, manually set to be searchable
|
||||
if(pageData.searchable === false || (pageData.layout == 'post' && pageData.searchable !== true)) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
// clean up some content so code variables are searchable too
|
||||
contents = contents.substring(yamlEndIndex+3);
|
||||
contents = contents.replace(/<code?>/gi, '');
|
||||
contents = contents.replace(/<\/code>/gi, '');
|
||||
contents = contents.replace(/<code?></gi, '');
|
||||
contents = contents.replace(/><\/code>/gi, '');
|
||||
contents = contents.replace(/`</gi, '');
|
||||
contents = contents.replace(/>`/gi, '');
|
||||
|
||||
// create a clean path to the URL
|
||||
var path = '/' + relpath.replace('index.md', '')
|
||||
.replace('index.html', '')
|
||||
.replace('.md', '.html')
|
||||
.replace('.markdown', '.html');
|
||||
if(pageData.layout == 'post') {
|
||||
path = '/blog/' + path.substring(19).replace('.html', '/');
|
||||
}
|
||||
|
||||
if(pageData.search_sections === true) {
|
||||
// each section within the content should be its own search result
|
||||
var section = { body: '', title: '' };
|
||||
var isTitleOpen = false;
|
||||
|
||||
var parser = new htmlparser.Parser({
|
||||
ontext: function(text){
|
||||
if(isTitleOpen) {
|
||||
section.title += text; // get the title of this section
|
||||
} else {
|
||||
section.body += text.replace(/{%.*%}/, '', 'g'); // Ignore any Jekyll expressions
|
||||
}
|
||||
},
|
||||
onopentag: function(name, attrs) {
|
||||
if(name == 'section' && attrs.id) {
|
||||
// start building new section data
|
||||
section = { body: '', path: path + '#' + attrs.id, title: '' };
|
||||
} else if( (name == 'h1' || name == 'h2' || name == 'h3') && attrs.class == 'title') {
|
||||
isTitleOpen = true; // the next text will be this sections title
|
||||
}
|
||||
},
|
||||
onclosetag: function(name) {
|
||||
if(name == 'section') {
|
||||
// section closed, index this section then clear it out
|
||||
addToIndex(section.path, section.title, pageData.layout, section.body);
|
||||
section = { body: '', title: '' };
|
||||
} else if( (name == 'h1' || name == 'h2' || name == 'h3') && isTitleOpen) {
|
||||
isTitleOpen = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
parser.write(contents);
|
||||
parser.end();
|
||||
|
||||
} else {
|
||||
// index the entire page
|
||||
var body = '';
|
||||
var parser = new htmlparser.Parser({
|
||||
ontext: function(text){
|
||||
body += text.replace(/{%.*%}/, '', 'g'); // Ignore any Jekyll expressions
|
||||
}
|
||||
});
|
||||
parser.write(contents);
|
||||
parser.end();
|
||||
|
||||
addToIndex(path, pageData.title, pageData.layout, body);
|
||||
}
|
||||
|
||||
callback();
|
||||
|
||||
})).on('end', function() {
|
||||
// Write out as one json file
|
||||
mkdirp.sync('tmp/ionic-site/data');
|
||||
fs.writeFileSync(
|
||||
'tmp/ionic-site/data/index.json',
|
||||
JSON.stringify({'ref': ref, 'index': idx.toJSON()})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('sauce-connect', sauceConnect);
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
"js-yaml": "3.0.2",
|
||||
"event-stream": "3.1.0",
|
||||
"gulp-strip-debug": "^0.3.0",
|
||||
"gulp-footer": "^1.0.4"
|
||||
"gulp-footer": "^1.0.4",
|
||||
"gulp-twitter": "0.0.3"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
|
||||
@@ -52,6 +52,8 @@ function run {
|
||||
git push -q $RELEASE_REMOTE v$VERSION
|
||||
|
||||
echo "-- v$VERSION \"$CODENAME\" pushed to $RELEASE_REMOTE/master successfully!"
|
||||
|
||||
gulp tweet --release --codeversion "$VERSION" --codename "$CODENAME"
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
|
||||
Reference in New Issue
Block a user