From ce342f58fd0bfb5b19ad14143b96d2e1a7669bec Mon Sep 17 00:00:00 2001 From: jlukic Date: Thu, 19 Feb 2015 15:15:42 -0500 Subject: [PATCH] Finish releases --- package.json | 2 -- tasks/admin/components/create.js | 2 +- tasks/admin/components/update.js | 8 +++--- tasks/admin/distributions/create.js | 40 ++++++++++++++--------------- tasks/admin/distributions/init.js | 2 -- tasks/admin/distributions/update.js | 33 ++++++++++++------------ tasks/admin/release.js | 4 +-- 7 files changed, 42 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index 23a815c39..d50670e29 100644 --- a/package.json +++ b/package.json @@ -82,9 +82,7 @@ "gulp-concat-filenames" : "^0.0.3", "gulp-debug" : "^2.0.0", "gulp-git" : "^1.0.0", - "gulp-karma" : "0.0.4", "gulp-tap" : "^0.1.3", - "karma" : "^0.12.28", "run-sequence" : "^1.0.2" } } diff --git a/tasks/admin/components/create.js b/tasks/admin/components/create.js index 3dc61799e..d3478a5ed 100644 --- a/tasks/admin/components/create.js +++ b/tasks/admin/components/create.js @@ -64,7 +64,7 @@ module.exports = function(callback) { (function(component) { var - outputDirectory = release.outputRoot + component, + outputDirectory = path.join(release.outputRoot, component), isJavascript = fs.existsSync(output.compressed + component + '.js'), isCSS = fs.existsSync(output.compressed + component + '.css'), capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1), diff --git a/tasks/admin/components/update.js b/tasks/admin/components/update.js index 405cfee8d..7d51b9060 100644 --- a/tasks/admin/components/update.js +++ b/tasks/admin/components/update.js @@ -63,7 +63,7 @@ module.exports = function() { var component = release.components[index] - outputDirectory = path.resolve(release.outputRoot + component), + outputDirectory = path.resolve(path.join(release.outputRoot, component)), capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1), repoName = release.componentRepoRoot + capitalizedComponent, @@ -130,7 +130,7 @@ module.exports = function() { // push changess to remote function pushFiles() { console.info('Pushing files for ' + component); - git.push('origin', 'master', { args: '-f', cwd: outputDirectory }, function(error) { + git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { console.info('Push completed successfully'); createRelease(); }); @@ -159,12 +159,12 @@ module.exports = function() { console.log('Sleeping for 1 second...'); // avoid rate throttling global.clearTimeout(timer); - return stepRepo() + timer = global.setTimeout(stepRepo, 500); } if(localRepoSetup) { - commitFiles(); + setUser(); } else { console.error('Repository must be setup before running update components'); diff --git a/tasks/admin/distributions/create.js b/tasks/admin/distributions/create.js index f6cae0158..d8039995f 100644 --- a/tasks/admin/distributions/create.js +++ b/tasks/admin/distributions/create.js @@ -59,7 +59,7 @@ module.exports = function(callback) { (function(distribution) { var - outputDirectory = release.outputRoot + distribution, + outputDirectory = path.join(release.outputRoot, distribution.toLowerCase()), packageFile = path.join(outputDirectory, release.files.npm), repoName = release.distRepoRoot + distribution task = { @@ -69,24 +69,30 @@ module.exports = function(callback) { } ; - // copy source files depending on distribution type - gulp.task(task.repo, false, function() { - if(distribution == 'CSS') { - return gulp.src('dist/**/*') + if(distribution == 'CSS') { + gulp.task(task.repo, function() { + return gulp.src('./dist/themes/default/**/*', { base: './dist/' }) + .pipe(gulp.src('./dist/components/*', { base: './dist/' })) + .pipe(gulp.src('./dist/*', { base: './dist/' })) .pipe(plumber()) .pipe(gulp.dest(outputDirectory)) ; - } - else if(distribution == 'LESS') { - return gulp.src('src/**/*') + }); + } + else if(distribution == 'LESS') { + gulp.task(task.repo, function() { + return gulp.src('./src/theme.config.example', { base: './src/' }) + .pipe(gulp.src('./src/definitions/**/*', { base: './src/' })) + .pipe(gulp.src('./src/_site/**/*', { base: './src/' })) + .pipe(gulp.src('./src/themes/**/*', { base: './src/' })) .pipe(plumber()) .pipe(gulp.dest(outputDirectory)) ; - } - }); + }); + } // extend package.json - gulp.task(task.package, false, function() { + gulp.task(task.package, function() { return gulp.src(packageFile) .pipe(plumber()) .pipe(jsonEditor(function(package) { @@ -99,18 +105,10 @@ module.exports = function(callback) { ; }); - // synchronous tasks in orchestrator? I think not - gulp.task(task.all, false, function(callback) { - runSequence([ - task.repo, - task.package - ], callback); - }); - - tasks.push(task.all); + tasks.push(task.repo); + tasks.push(task.package); })(distribution); } - runSequence(tasks, callback); }; \ No newline at end of file diff --git a/tasks/admin/distributions/init.js b/tasks/admin/distributions/init.js index 2b4dd2528..d188f7afd 100644 --- a/tasks/admin/distributions/init.js +++ b/tasks/admin/distributions/init.js @@ -39,8 +39,6 @@ var version = project.version ; -console.log(__dirname + '/../../config/admin/oauth.js'); - module.exports = function(callback) { var diff --git a/tasks/admin/distributions/update.js b/tasks/admin/distributions/update.js index 9b0378de2..7c3605a3e 100644 --- a/tasks/admin/distributions/update.js +++ b/tasks/admin/distributions/update.js @@ -4,7 +4,7 @@ /* - This task update all SUI individual component repos with new versions of components + This task update all SUI individual distribution repos with new versions of distributions * Commits changes from create repo * Pushes changes to GitHub @@ -42,7 +42,7 @@ module.exports = function() { var index = -1, - total = release.components.length, + total = release.distributions.length, timer, stream, stepRepo @@ -53,7 +53,7 @@ module.exports = function() { return; } - // Do Git commands synchronously per component, to avoid issues + // Do Git commands synchronously per distribution, to avoid issues stepRepo = function() { index = index + 1; @@ -62,10 +62,9 @@ module.exports = function() { } var - component = release.components[index] - outputDirectory = path.resolve(release.outputRoot + component), - capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1), - repoName = release.distRepoRoot + capitalizedComponent, + distribution = release.distributions[index], + outputDirectory = path.resolve(path.join(release.outputRoot, distribution.toLowerCase() )), + repoName = release.distRepoRoot + distribution, gitURL = 'https://github.com/' + release.org + '/' + repoName + '.git', repoURL = 'https://github.com/' + release.org + '/' + repoName + '/', @@ -74,14 +73,14 @@ module.exports = function() { ? '--author "' + oAuth.name + ' <' + oAuth.email + '>"' : '', - componentPackage = fs.existsSync(outputDirectory + 'package.json' ) + distributionPackage = fs.existsSync(outputDirectory + 'package.json' ) ? require(outputDirectory + 'package.json') : false, - isNewVersion = (version && componentPackage.version != version), + isNewVersion = (version && distributionPackage.version != version), commitMessage = (isNewVersion) - ? 'Updated component to version ' + version + ? 'Updated distribution to version ' + version : 'Updated files from main repo', gitOptions = { cwd: outputDirectory }, @@ -108,7 +107,7 @@ module.exports = function() { // standard path function commitFiles() { // commit files - console.info('Committing ' + component + ' files', commitArgs); + console.info('Committing ' + distribution + ' files', commitArgs); gulp.src('**/*', gitOptions) .pipe(git.add(gitOptions)) .pipe(git.commit(commitMessage, commitOptions)) @@ -129,8 +128,8 @@ module.exports = function() { // push changess to remote function pushFiles() { - console.info('Pushing files for ' + component); - git.push('origin', 'master', { args: '-f', cwd: outputDirectory }, function(error) { + console.info('Pushing files for ' + distribution); + git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { console.info('Push completed successfully'); createRelease(); }); @@ -148,7 +147,7 @@ module.exports = function() { // Tags files locally function tagFiles() { - console.info('Tagging new version ' + component, version); + console.info('Tagging new version ' + distribution, version); git.tag(version, 'Updated version from semantic-ui (automatic)', function (err) { nextRepo(); }); @@ -159,15 +158,15 @@ module.exports = function() { console.log('Sleeping for 1 second...'); // avoid rate throttling global.clearTimeout(timer); - return stepRepo() + timer = global.setTimeout(stepRepo, 500); } if(localRepoSetup) { - commitFiles(); + setUser(); } else { - console.error('Repository must be setup before running update components'); + console.error('Repository must be setup before running update distributions'); } }; diff --git a/tasks/admin/release.js b/tasks/admin/release.js index f2449eefe..7ff1848e9 100644 --- a/tasks/admin/release.js +++ b/tasks/admin/release.js @@ -22,8 +22,8 @@ module.exports = function() { runSequence( //'build', // build Semantic 'init distributions', // sync with current github version - 'create distributions' // update each repo with changes from master repo - //'update distributions' // commit changes to github + 'create distributions', // update each repo with changes from master repo + 'update distributions' // commit changes to github ); }; \ No newline at end of file