From 761cc4f19b2d4eab63896577dd90d84e04ce32c6 Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 1 Dec 2014 00:25:28 +0100 Subject: [PATCH 01/24] simple test files to ship a css pacakge with all UI --- meteor/tests/test_fonts.js | 14 +++++++++++++ meteor/tests/test_images.js | 20 +++++++++++++++++++ package.js | 39 +++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 meteor/tests/test_fonts.js create mode 100644 meteor/tests/test_images.js create mode 100644 package.js diff --git a/meteor/tests/test_fonts.js b/meteor/tests/test_fonts.js new file mode 100644 index 000000000..40c208162 --- /dev/null +++ b/meteor/tests/test_fonts.js @@ -0,0 +1,14 @@ +// Check that the font files are downloadable. Meteor places assets at /packages//. +['eot', 'otf', 'svg', 'ttf', 'woff'].forEach(function (ext) { + Tinytest.addAsync(ext + ' fonts are shipped', function (test, done) { + HTTP.get('/packages/semantic_ui/dist/themes/default/assets/fonts/icons.' + ext, function callback(error, result) { + if (error) { + test.fail({message: 'Font failed to load'}); + } else { + test.isTrue(result.content.length > 10000, ext + ' font could not be downloaded'); + } + + done(); + }); + }); +}); \ No newline at end of file diff --git a/meteor/tests/test_images.js b/meteor/tests/test_images.js new file mode 100644 index 000000000..0b87a8e5f --- /dev/null +++ b/meteor/tests/test_images.js @@ -0,0 +1,20 @@ +var images = [ + 'dist/themes/default/assets/images/flags.png', +]; + +// Check that the font files are downloadable. Meteor places assets at /packages//. +images.forEach(function (path) { + Tinytest.addAsync('image ' + path + ' is shipped', function (test, done) { + HTTP.get('/packages/semantic_ui/' + path, function callback(error, result) { + if (error) { + test.fail({message: 'Image failed to load'}); + } else { + test.isTrue(result.content.length > 10000, 'Image ' + path + ' could not be downloaded'); + } + + done(); + }); + }); +}); + + diff --git a/package.js b/package.js new file mode 100644 index 000000000..ed737abc2 --- /dev/null +++ b/package.js @@ -0,0 +1,39 @@ +Package.describe({ + name: 'semantic:ui', + summary: 'Semantic empowers designers and developers by creating a shared vocabulary for UI.', + version: '1.0.1', + git: 'git://github.com/Semantic-Org/Semantic-UI.git#1.0' +}); + +var where = 'client'; // Adds files only to the client + +Package.onUse(function(api) { + api.versionsFrom('1.0'); + + api.addFiles([ + 'dist/semantic.css', + 'dist/semantic.js', + 'dist/themes/default/assets/fonts/icons.eot', + 'dist/themes/default/assets/fonts/icons.otf', + 'dist/themes/default/assets/fonts/icons.svg', + 'dist/themes/default/assets/fonts/icons.ttf', + 'dist/themes/default/assets/fonts/icons.woff', + 'dist/themes/default/assets/images/flags.png', + ], where); +}); + +Package.onTest(function(api) { + api.use([ + 'tinytest', + 'http', + 'semantic:ui' + ], where); + api.use([ + 'semantic:ui' + ], 'server'); + + api.addFiles([ + 'meteor/tests/test_fonts.js', + 'meteor/tests/test_images.js', + ], where); +}); From 52e7762b2501a1c31bb1a307828cc996e7007bb6 Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 1 Dec 2014 00:44:38 +0100 Subject: [PATCH 02/24] removed forgotten block --- package.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.js b/package.js index ed737abc2..a1e1c9a81 100644 --- a/package.js +++ b/package.js @@ -28,9 +28,6 @@ Package.onTest(function(api) { 'http', 'semantic:ui' ], where); - api.use([ - 'semantic:ui' - ], 'server'); api.addFiles([ 'meteor/tests/test_fonts.js', From a49bbc393f22072359ff355e19888f8b10502fac Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 1 Dec 2014 03:08:31 +0100 Subject: [PATCH 03/24] added package.js files into components repos --- .gitignore | 1 + README.md | 7 ++++++ gulpfile.js | 43 ++++++++++++++++++++++++++------ meteor/README.md | 12 +++++++++ tasks/admin/release.js | 1 + tasks/admin/templates/package.js | 16 ++++++++++++ 6 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 meteor/README.md create mode 100644 tasks/admin/templates/package.js diff --git a/.gitignore b/.gitignore index 8e364968e..308630381 100755 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ Thumbs.db nbproject *.sublime-project *.sublime-workspace +.build* diff --git a/README.md b/README.md index ebadad640..5ba0ee87e 100755 --- a/README.md +++ b/README.md @@ -60,6 +60,13 @@ gulp help // list all commands * Android 4 * Blackberry 10 +## Meteor +To use Semantic with the [Meteor.js](https://www.meteor.com) framework, run + + $ meteor add semantic:ui + +Learn more about the [Meteor integration in the README](meteor/README.md). + ### Reaching Out If you'd like to start a conversation about Semantic feel free to reach out by e-mail [jack@semantic-ui.com](mailto:jack@semantic-ui.com) diff --git a/gulpfile.js b/gulpfile.js index 4e1e941ae..23c1447c1 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -720,7 +720,10 @@ gulp.task('create repos', false, function(callback) { formExport : /\$\.fn\.\w+\s*=\s*function\(fields, parameters\)\s*{/g, settingsExport : /\$\.fn\.\w+\.settings\s*=/g, settingsReference : /\$\.fn\.\w+\.settings/g, - jQuery : /jQuery/g + jQuery : /jQuery/g, + // meteor + mversion : '{package-version}', + mfiles : '{package-files}', }, replace : { // readme @@ -737,7 +740,9 @@ gulp.task('create repos', false, function(callback) { formExport : 'module.exports = function(fields, parameters) {\n var _module = module;\n', settingsExport : 'module.exports.settings =', settingsReference : '_module.exports.settings', - jQuery : 'require("jquery")' + jQuery : 'require("jquery")', + // meteor + mversion : version } }, task = { @@ -745,14 +750,24 @@ gulp.task('create repos', false, function(callback) { repo : component + ' create repo', bower : component + ' create bower.json', readme : component + ' create README', - readme : component + ' create README', npm : component + ' create NPM Module', notes : component + ' create release notes', composer : component + ' create composer.json', - package : component + ' create package.json' + package : component + ' create package.json', + meteor : component + ' create package.js', } ; + var fnames; + if(isJavascript) { + if(isCSS) + fnames = ' \'' + component + '.js\',\n \'' + component + '.css\''; + else + fnames = ' \'' + component + '.js\''; + } + else + fnames = ' \'' + component + '.css\''; + // copy dist files into output folder adjusting asset paths gulp.task(task.repo, false, function() { return gulp.src(release.source + component + '.*') @@ -890,6 +905,19 @@ gulp.task('create repos', false, function(callback) { ; }); + // create package.js + gulp.task(task.meteor, false, function() { + return gulp.src(release.templates.meteor) + .pipe(plumber()) + .pipe(flatten()) + .pipe(replace(regExp.match.name, regExp.replace.name)) + .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) + .pipe(replace(regExp.match.mversion, regExp.replace.mversion)) + .pipe(replace(regExp.match.mfiles, fnames)) + .pipe(gulp.dest(outputDirectory)) + ; + }); + // synchronous tasks in orchestrator? I think not gulp.task(task.all, false, function(callback) { runSequence([ @@ -899,7 +927,8 @@ gulp.task('create repos', false, function(callback) { task.readme, task.package, task.composer, - task.notes + task.notes, + task.meteor ], callback); }); @@ -909,8 +938,8 @@ gulp.task('create repos', false, function(callback) { } runSequence(tasks, callback); - }); + gulp.task('register repos', false, function(callback) { var index = -1, @@ -951,7 +980,7 @@ gulp.task('register repos', false, function(callback) { stepRepo(); }); */ - } + }; stepRepo(); }); diff --git a/meteor/README.md b/meteor/README.md new file mode 100644 index 000000000..83f49becd --- /dev/null +++ b/meteor/README.md @@ -0,0 +1,12 @@ +Packaging Semantic-UI for [Meteor.js](http://meteor.com), the most popular full-stack JavaScript framework on GitHub. + +# Meteor + +If you're new to Meteor, here's what the excitement is all about - [watch the first two minutes](https://www.youtube.com/watch?v=fsi0aJ9yr2o); you'll be hooked by 1:28. + +That screencast is from 2012. In the meantime, Meteor has become a mature JavaScript-everywhere web development framework with numerous [advantages](http://www.meteorpedia.com/read/Why_Meteor) over all other single-page application frameworks. + + +# WIP + +This is only a stub file... \ No newline at end of file diff --git a/tasks/admin/release.js b/tasks/admin/release.js index 35446c5be..16c8d52cb 100644 --- a/tasks/admin/release.js +++ b/tasks/admin/release.js @@ -18,6 +18,7 @@ module.exports = { bower : './tasks/admin/templates/bower.json', composer : './tasks/admin/templates/composer.json', package : './tasks/admin/templates/package.json', + meteor : './tasks/admin/templates/package.js', readme : './tasks/admin/templates/README.md', notes : './RELEASE-NOTES.md' }, diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js new file mode 100644 index 000000000..db371903b --- /dev/null +++ b/tasks/admin/templates/package.js @@ -0,0 +1,16 @@ +Package.describe({ + name: 'semantic:ui-{component}', + summary: 'Semantic UI - {Component}, Single component release of {component}', + version: '{package-version}', + git: 'git://github.com/Semantic-Org/UI-{Component}.git' +}); + +var where = 'client'; // Adds files only to the client + +Package.onUse(function(api) { + api.versionsFrom('1.0'); + + api.addFiles([ +{package-files} + ], where); +}); \ No newline at end of file From 33d4cbaf5f363afa1c0c717d0b9ba1a673edb48d Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 1 Dec 2014 22:10:30 +0100 Subject: [PATCH 04/24] assets inside pacakge.js for flag and icon --- gulpfile.js | 39 +++++++++++++++++++++++++------- tasks/admin/templates/package.js | 3 ++- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 23c1447c1..5ba901d3e 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -760,13 +760,29 @@ gulp.task('create repos', false, function(callback) { var fnames; if(isJavascript) { - if(isCSS) + if(isCSS) { fnames = ' \'' + component + '.js\',\n \'' + component + '.css\''; - else + } + else { fnames = ' \'' + component + '.js\''; + } } - else + else { fnames = ' \'' + component + '.css\''; + } + + // Adds flags image as asset for UI-Flag + if (component == 'flag') { + fnames += ',\n \'assets/images/flags.png\''; + } + // Adds fonts as assets for UI-Icon + if (component == 'icon') { + fnames += ',\n \'assets/fonts/icons.eot\''; + fnames += ',\n \'assets/fonts/icons.otf\''; + fnames += ',\n \'assets/fonts/icons.svg\''; + fnames += ',\n \'assets/fonts/icons.ttf\''; + fnames += ',\n \'assets/fonts/icons.woff\''; + } // copy dist files into output folder adjusting asset paths gulp.task(task.repo, false, function() { @@ -1010,7 +1026,7 @@ gulp.task('update git', false, function() { repoURL = 'https://github.com/' + release.org + '/' + repoName + '/', gitOptions = { cwd: outputDirectory }, quietOptions = { args: '-q', cwd: outputDirectory }, - isRepository = fs.existsSync(outputDirectory + '.git/') + isRepository = fs.existsSync(outputDirectory + '.git/'), componentPackage = fs.existsSync(outputDirectory + 'package.json' ) ? require(outputDirectory + 'package.json') : false, @@ -1083,9 +1099,17 @@ gulp.task('update git', false, function() { function tagFiles() { console.log('Tagging new version ', version); git.tag(version, 'Updated version from semantic-ui (automatic)', function (err) { - pushFiles(); + publishMeteor(); }); } + function publishMeteor() { + console.log('Publishing Meteor package version ', version); + //var cmd = new run.Command('meteor publish'); + //cmd.exec(function(error){ + // pushFiles(); + //}); + pushFiles(); + } function pushFiles() { console.log('Pushing files'); git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { @@ -1095,7 +1119,7 @@ gulp.task('update git', false, function() { console.log('Push completed successfully'); stepRepo(); }); - }; + } // set-up path function createRepo() { @@ -1139,8 +1163,7 @@ gulp.task('update git', false, function() { stepRepo(); } }); - }; - + } }; return stepRepo(); diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js index db371903b..0e8118dba 100644 --- a/tasks/admin/templates/package.js +++ b/tasks/admin/templates/package.js @@ -2,7 +2,8 @@ Package.describe({ name: 'semantic:ui-{component}', summary: 'Semantic UI - {Component}, Single component release of {component}', version: '{package-version}', - git: 'git://github.com/Semantic-Org/UI-{Component}.git' + git: 'git://github.com/Semantic-Org/UI-{Component}.git', + //readme: 'git://github.com/Semantic-Org/UI-{Component}/tree/master/meteor/README.md' }); var where = 'client'; // Adds files only to the client From eb601a41c7ebf168a3ddc54754dce425704f1d15 Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Tue, 2 Dec 2014 13:24:59 +0100 Subject: [PATCH 05/24] main package.js plus assets copy for components --- gulpfile.js | 148 ++++++++++++++------- package.js | 7 +- package.json | 4 +- tasks/admin/release.js | 21 ++- tasks/admin/templates/package-component.js | 16 +++ tasks/admin/templates/package.js | 24 +++- tasks/defaults.js | 3 +- 7 files changed, 156 insertions(+), 67 deletions(-) create mode 100644 tasks/admin/templates/package-component.js diff --git a/gulpfile.js b/gulpfile.js index 5ba901d3e..e42065c47 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -25,6 +25,7 @@ var clone = require('gulp-clone'), concat = require('gulp-concat'), concatCSS = require('gulp-concat-css'), + concatFnames = require('gulp-concat-filenames'), copy = require('gulp-copy'), debug = require('gulp-debug'), flatten = require('gulp-flatten'), @@ -40,6 +41,7 @@ var rename = require('gulp-rename'), replace = require('gulp-replace'), sourcemaps = require('gulp-sourcemaps'), + tap = require('gulp-tap'), uglify = require('gulp-uglify'), util = require('gulp-util'), watch = require('gulp-watch'), @@ -526,7 +528,6 @@ gulp.task('install', 'Set-up project for first time', function () { ; } - // determine semantic.json config if(answers.components) { json.components = answers.components; @@ -572,6 +573,30 @@ gulp.task('install', 'Set-up project for first time', function () { .pipe(gulp.dest('./')) ; } + + // write package.js + console.info('Creating package.js (Meteor)'); + var + packagedFolder = json.paths.output.packaged || output.packaged, + themesFolder = json.paths.output.themes || output.themes, + fnames = + '\n \'' + packagedFolder + 'semantic.css\',' + + '\n \'' + packagedFolder + 'semantic.js\',' + + '\n \'' + themesFolder + 'default/assets/images/flags.png\',' + + '\n \'' + themesFolder + 'default/assets/fonts/icons.eot\',' + + '\n \'' + themesFolder + 'default/assets/fonts/icons.otf\',' + + '\n \'' + themesFolder + 'default/assets/fonts/icons.svg\',' + + '\n \'' + themesFolder + 'default/assets/fonts/icons.ttf\',' + + '\n \'' + themesFolder + 'default/assets/fonts/icons.woff\'' + ; + gulp.src(release.templates.meteor) + .pipe(plumber()) + .pipe(flatten()) + .pipe(replace('{package-version}', version)) + .pipe(replace('{package-files}', fnames)) + .pipe(gulp.dest('./')) + ; + console.log(''); console.log(''); })) @@ -699,6 +724,7 @@ gulp.task('create repos', false, function(callback) { outputDirectory = release.outputRoot + component, isJavascript = fs.existsSync(output.compressed + component + '.js'), isCSS = fs.existsSync(output.compressed + component + '.css'), + assets = release.componentsAssets[component], capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1), packageName = release.packageRoot + component, repoName = release.repoRoot + capitalizedComponent, @@ -746,43 +772,48 @@ gulp.task('create repos', false, function(callback) { } }, task = { - all : component + ' creating', - repo : component + ' create repo', - bower : component + ' create bower.json', - readme : component + ' create README', - npm : component + ' create NPM Module', - notes : component + ' create release notes', - composer : component + ' create composer.json', - package : component + ' create package.json', - meteor : component + ' create package.js', - } + all : component + ' creating', + repo : component + ' create repo', + assetsPaths : component + ' get assets paths', + assets : component + ' copy assets', + bower : component + ' create bower.json', + readme : component + ' create README', + npm : component + ' create NPM Module', + notes : component + ' create release notes', + composer : component + ' create composer.json', + package : component + ' create package.json', + meteor : component + ' create package.js', + }, + taskSequence = (assets) + ? [ + task.repo, + task.assets, + task.assetsPaths, + task.npm, + task.bower, + task.readme, + task.package, + task.composer, + task.notes, + task.meteor + ] + : [ + task.repo, + task.npm, + task.bower, + task.readme, + task.package, + task.composer, + task.notes, + task.meteor + ], + fnames = '' ; - var fnames; - if(isJavascript) { - if(isCSS) { - fnames = ' \'' + component + '.js\',\n \'' + component + '.css\''; - } - else { - fnames = ' \'' + component + '.js\''; - } - } - else { - fnames = ' \'' + component + '.css\''; - } - - // Adds flags image as asset for UI-Flag - if (component == 'flag') { - fnames += ',\n \'assets/images/flags.png\''; - } - // Adds fonts as assets for UI-Icon - if (component == 'icon') { - fnames += ',\n \'assets/fonts/icons.eot\''; - fnames += ',\n \'assets/fonts/icons.otf\''; - fnames += ',\n \'assets/fonts/icons.svg\''; - fnames += ',\n \'assets/fonts/icons.ttf\''; - fnames += ',\n \'assets/fonts/icons.woff\''; - } + if(isJavascript) + fnames += ' \'' + component + '.js\',\n'; + if(isCSS) + fnames += ' \'' + component + '.css\',\n'; // copy dist files into output folder adjusting asset paths gulp.task(task.repo, false, function() { @@ -794,6 +825,32 @@ gulp.task('create repos', false, function(callback) { ; }); + // possibly copy assets + if (assets) { + var + baseFolder = source.themes + 'default/', + concatFilenamesOptions = { + newline: '', + root: source.themes + 'default/', + prepend: ' \'', + append: '\',' + } + ; + + gulp.task(task.assetsPaths, function() { + return gulp.src(baseFolder + assets, { base: baseFolder}) + .pipe(concatFnames("dummy.txt", concatFilenamesOptions)) + .pipe(tap(function(file) { fnames += file.contents; })) + ; + }); + + gulp.task(task.assets, false, function() { + return gulp.src(baseFolder + assets, { base: baseFolder}) + .pipe(gulp.dest(outputDirectory)) + ; + }); + } + // create npm module gulp.task(task.npm, false, function() { return gulp.src(release.source + component + '!(*.min|*.map).js') @@ -922,30 +979,23 @@ gulp.task('create repos', false, function(callback) { }); // create package.js - gulp.task(task.meteor, false, function() { - return gulp.src(release.templates.meteor) + var taskDeps = assets ? [task.assetsPaths] : false; + gulp.task(task.meteor, taskDeps, function() { + return gulp.src(release.templates.meteorComponent) .pipe(plumber()) .pipe(flatten()) .pipe(replace(regExp.match.name, regExp.replace.name)) .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) .pipe(replace(regExp.match.mversion, regExp.replace.mversion)) .pipe(replace(regExp.match.mfiles, fnames)) + .pipe(rename('package.js')) .pipe(gulp.dest(outputDirectory)) ; }); // synchronous tasks in orchestrator? I think not gulp.task(task.all, false, function(callback) { - runSequence([ - task.repo, - task.npm, - task.bower, - task.readme, - task.package, - task.composer, - task.notes, - task.meteor - ], callback); + runSequence(taskSequence, callback); }); tasks.push(task.all); @@ -1168,4 +1218,4 @@ gulp.task('update git', false, function() { return stepRepo(); -}); \ No newline at end of file +}); diff --git a/package.js b/package.js index a1e1c9a81..c5c2fdc8c 100644 --- a/package.js +++ b/package.js @@ -2,7 +2,8 @@ Package.describe({ name: 'semantic:ui', summary: 'Semantic empowers designers and developers by creating a shared vocabulary for UI.', version: '1.0.1', - git: 'git://github.com/Semantic-Org/Semantic-UI.git#1.0' + git: 'git://github.com/Semantic-Org/Semantic-UI#1.0', + readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/1.0/meteor/README.md' }); var where = 'client'; // Adds files only to the client @@ -13,12 +14,12 @@ Package.onUse(function(api) { api.addFiles([ 'dist/semantic.css', 'dist/semantic.js', + 'dist/themes/default/assets/images/flags.png', 'dist/themes/default/assets/fonts/icons.eot', 'dist/themes/default/assets/fonts/icons.otf', 'dist/themes/default/assets/fonts/icons.svg', 'dist/themes/default/assets/fonts/icons.ttf', - 'dist/themes/default/assets/fonts/icons.woff', - 'dist/themes/default/assets/images/flags.png', + 'dist/themes/default/assets/fonts/icons.woff' ], where); }); diff --git a/package.json b/package.json index a91536494..899d55ed2 100755 --- a/package.json +++ b/package.json @@ -53,6 +53,8 @@ "gulp-watch": "x.x.x", "rtlcss": "x.x.x", "run-sequence": "x.x.x", - "wrench": "x.x.x" + "wrench": "x.x.x", + "gulp-concat-filenames": "0.0.3", + "gulp-tap": "^0.1.3" } } diff --git a/tasks/admin/release.js b/tasks/admin/release.js index 16c8d52cb..eb785add8 100644 --- a/tasks/admin/release.js +++ b/tasks/admin/release.js @@ -15,12 +15,13 @@ module.exports = { }, templates: { - bower : './tasks/admin/templates/bower.json', - composer : './tasks/admin/templates/composer.json', - package : './tasks/admin/templates/package.json', - meteor : './tasks/admin/templates/package.js', - readme : './tasks/admin/templates/README.md', - notes : './RELEASE-NOTES.md' + bower : './tasks/admin/templates/bower.json', + composer : './tasks/admin/templates/composer.json', + package : './tasks/admin/templates/package.json', + meteor : './tasks/admin/templates/package.js', + meteorComponent : './tasks/admin/templates/package-component.js', + readme : './tasks/admin/templates/README.md', + notes : './RELEASE-NOTES.md' }, org : 'Semantic-Org', @@ -81,6 +82,12 @@ module.exports = { 'table', 'transition', 'video' - ] + ], + + // Assets needed by each component + componentsAssets : { + flag: 'assets/images/**', + icon: 'assets/fonts/**', + } }; diff --git a/tasks/admin/templates/package-component.js b/tasks/admin/templates/package-component.js new file mode 100644 index 000000000..e23645d10 --- /dev/null +++ b/tasks/admin/templates/package-component.js @@ -0,0 +1,16 @@ +Package.describe({ + name: 'semantic:ui-{component}', + summary: 'Semantic UI - {Component}, Single component release of {component}', + version: '{package-version}', + git: 'git://github.com/Semantic-Org/UI-{Component}.git', + //readme: 'git://github.com/Semantic-Org/UI-{Component}/tree/master/meteor/README.md' +}); + +var where = 'client'; // Adds files only to the client + +Package.onUse(function(api) { + api.versionsFrom('1.0'); + + api.addFiles([ +{package-files} ], where); +}); diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js index 0e8118dba..8c1dcea26 100644 --- a/tasks/admin/templates/package.js +++ b/tasks/admin/templates/package.js @@ -1,9 +1,9 @@ Package.describe({ - name: 'semantic:ui-{component}', - summary: 'Semantic UI - {Component}, Single component release of {component}', + name: 'semantic:ui', + summary: 'Semantic empowers designers and developers by creating a shared vocabulary for UI.', version: '{package-version}', - git: 'git://github.com/Semantic-Org/UI-{Component}.git', - //readme: 'git://github.com/Semantic-Org/UI-{Component}/tree/master/meteor/README.md' + git: 'git://github.com/Semantic-Org/Semantic-UI.git#1.0', + readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/1.0/meteor/README.md' }); var where = 'client'; // Adds files only to the client @@ -11,7 +11,19 @@ var where = 'client'; // Adds files only to the client Package.onUse(function(api) { api.versionsFrom('1.0'); + api.addFiles([{package-files} + ], where); +}); + +Package.onTest(function(api) { + api.use([ + 'tinytest', + 'http', + 'semantic:ui' + ], where); + api.addFiles([ -{package-files} + 'meteor/tests/test_fonts.js', + 'meteor/tests/test_images.js', ], where); -}); \ No newline at end of file +}); diff --git a/tasks/defaults.js b/tasks/defaults.js index 10083cdee..c11f0f1be 100755 --- a/tasks/defaults.js +++ b/tasks/defaults.js @@ -46,6 +46,7 @@ module.exports = { composer : 'composer.json', config : './semantic.json', npm : './package.json', + meteor : './package.js', site : './src/site', theme : './src/theme.config' }, @@ -66,4 +67,4 @@ module.exports = { }, clean : 'dist/' } -}; \ No newline at end of file +}; From 178a79d23ba6532d94bb62fc12555e0a52385943 Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:02:45 +0100 Subject: [PATCH 06/24] added link to Meteor README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1baf9256f..c97d6f521 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ To use Semantic with the [Meteor.js](https://www.meteor.com) framework, run $ meteor add semantic:ui -Learn more about the [Meteor integration in the README](meteor/README.md). +Learn more by reading the [Meteor integration README](https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md). ## Browser Support From 8242abd012f86e313fb3dc4f5782f08d634a6e64 Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:03:15 +0100 Subject: [PATCH 07/24] better Meteor README --- meteor/README.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/meteor/README.md b/meteor/README.md index 83f49becd..c4f742e73 100644 --- a/meteor/README.md +++ b/meteor/README.md @@ -1,12 +1,38 @@ -Packaging Semantic-UI for [Meteor.js](http://meteor.com), the most popular full-stack JavaScript framework on GitHub. +[Semantic-UI](http://semantic-ui.com/) packaged for [Meteor.js](http://meteor.com). -# Meteor +# Usage -If you're new to Meteor, here's what the excitement is all about - [watch the first two minutes](https://www.youtube.com/watch?v=fsi0aJ9yr2o); you'll be hooked by 1:28. +```sh +meteor add semantic:ui +``` -That screencast is from 2012. In the meantime, Meteor has become a mature JavaScript-everywhere web development framework with numerous [advantages](http://www.meteorpedia.com/read/Why_Meteor) over all other single-page application frameworks. +# Theming + +In case you wish to build your own theme you should follow the +[Recommended Usage (Themed)](https://github.com/Semantic-Org/Semantic-UI#recommended-usage-themed) +guide. + +After having build the project you'll get a ready to use meteor package +shipping your newly created theme. +Simply move the whole folder (or otherwise simlink it...) under your Meteor +app's `packages` folder run + +```sh +meteor add semantic:ui +``` + +from your app's main folder and that's it! -# WIP +# Issues -This is only a stub file... \ No newline at end of file +If you encounter a Meteor-related issue while using this package, +please CC @Semantic-Org/meteor when you +[file it](https://github.com/Semantic-Org/Semantic-UI/issues). + + +# Meteor + +If you're new to Meteor, here's what the excitement is all about - [watch the first two minutes](https://www.youtube.com/watch?v=fsi0aJ9yr2o); you'll be hooked by 1:28. + +That screencast is from 2012. In the meantime, Meteor has become a mature JavaScript-everywhere web development framework with numerous [advantages](http://www.meteorpedia.com/read/Why_Meteor) over all other single-page application frameworks. From 8d46150c6efbf911a9d209512d88e7f884cab7b0 Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:03:44 +0100 Subject: [PATCH 08/24] updated --- package.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.js b/package.js index c5c2fdc8c..d5bf0cac6 100644 --- a/package.js +++ b/package.js @@ -1,9 +1,9 @@ Package.describe({ name: 'semantic:ui', - summary: 'Semantic empowers designers and developers by creating a shared vocabulary for UI.', - version: '1.0.1', - git: 'git://github.com/Semantic-Org/Semantic-UI#1.0', - readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/1.0/meteor/README.md' + summary: 'Semantic (official): a UI component framework based around useful principles from natural language.', + version: '1.7.2', + git: 'git://github.com/Semantic-Org/Semantic-UI.git', + readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md' }); var where = 'client'; // Adds files only to the client @@ -14,12 +14,12 @@ Package.onUse(function(api) { api.addFiles([ 'dist/semantic.css', 'dist/semantic.js', - 'dist/themes/default/assets/images/flags.png', 'dist/themes/default/assets/fonts/icons.eot', 'dist/themes/default/assets/fonts/icons.otf', 'dist/themes/default/assets/fonts/icons.svg', 'dist/themes/default/assets/fonts/icons.ttf', - 'dist/themes/default/assets/fonts/icons.woff' + 'dist/themes/default/assets/fonts/icons.woff', + 'dist/themes/default/assets/images/flags.png', ], where); }); From ed45c2a842ec54f9a7def54de907fb7463ddd93c Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:04:15 +0100 Subject: [PATCH 09/24] removed typo --- src/definitions/elements/label.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/definitions/elements/label.less b/src/definitions/elements/label.less index f9b6a0221..c9daf9616 100755 --- a/src/definitions/elements/label.less +++ b/src/definitions/elements/label.less @@ -1,4 +1,4 @@ -]/* +/* * # Semantic - Label * http://github.com/semantic-org/semantic-ui/ * From 7f34ff23fd968732a02a688b9310ef1c9213ed1a Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:04:49 +0100 Subject: [PATCH 10/24] removed assets list --- tasks/admin/release.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tasks/admin/release.js b/tasks/admin/release.js index eb785add8..4d685e09e 100644 --- a/tasks/admin/release.js +++ b/tasks/admin/release.js @@ -82,12 +82,5 @@ module.exports = { 'table', 'transition', 'video' - ], - - // Assets needed by each component - componentsAssets : { - flag: 'assets/images/**', - icon: 'assets/fonts/**', - } + ] }; - From 5425804cffd295bac74922cc5edbca009d25a69e Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:05:27 +0100 Subject: [PATCH 11/24] added instruction to install under Meteor --- tasks/admin/templates/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/admin/templates/README.md b/tasks/admin/templates/README.md index 38bcaf439..c3ee5b308 100644 --- a/tasks/admin/templates/README.md +++ b/tasks/admin/templates/README.md @@ -16,6 +16,12 @@ bower install semantic-ui-{component} npm install semantic-ui-{component} ``` +#### To install with Meteor +``` +meteor add semantic:ui-{component} +``` + + ## Addendum This element's definitions (required class names, html structures) are available in the [UI Docs](http://www.semantic-ui.com) From 2a0c628d5f6e579f1618f4fc7ff914f6377a972f Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:06:15 +0100 Subject: [PATCH 12/24] finalized package.js templates --- tasks/admin/templates/package-component.js | 3 +-- tasks/admin/templates/package.js | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tasks/admin/templates/package-component.js b/tasks/admin/templates/package-component.js index e23645d10..63911e850 100644 --- a/tasks/admin/templates/package-component.js +++ b/tasks/admin/templates/package-component.js @@ -1,9 +1,8 @@ Package.describe({ name: 'semantic:ui-{component}', - summary: 'Semantic UI - {Component}, Single component release of {component}', + summary: 'Semantic UI - {Component} (official): Single component release of {component}', version: '{package-version}', git: 'git://github.com/Semantic-Org/UI-{Component}.git', - //readme: 'git://github.com/Semantic-Org/UI-{Component}/tree/master/meteor/README.md' }); var where = 'client'; // Adds files only to the client diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js index 8c1dcea26..23d20d9e0 100644 --- a/tasks/admin/templates/package.js +++ b/tasks/admin/templates/package.js @@ -1,9 +1,9 @@ Package.describe({ name: 'semantic:ui', - summary: 'Semantic empowers designers and developers by creating a shared vocabulary for UI.', + summary: 'Semantic (official): a UI component framework based around useful principles from natural language.', version: '{package-version}', - git: 'git://github.com/Semantic-Org/Semantic-UI.git#1.0', - readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/1.0/meteor/README.md' + git: 'git://github.com/Semantic-Org/Semantic-UI.git', + readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md' }); var where = 'client'; // Adds files only to the client @@ -11,8 +11,8 @@ var where = 'client'; // Adds files only to the client Package.onUse(function(api) { api.versionsFrom('1.0'); - api.addFiles([{package-files} - ], where); + api.addFiles([ +{package-files} ], where); }); Package.onTest(function(api) { From 322c86558dedecf5a5c46b317962352e8f2b166b Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:07:40 +0100 Subject: [PATCH 13/24] better tasks for meteor package.js --- gulpfile.js | 188 +++++++++++++++++++++++++--------------------------- 1 file changed, 90 insertions(+), 98 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 964e425c6..736fc233a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -406,6 +406,30 @@ gulp.task('build', 'Builds all files from source', function(callback) { }) ; + // updates package.js + console.info('Updating package.js (Meteor)'); + var fnames = + ' \'' + output.packaged + 'semantic.css\',\n' + + ' \'' + output.packaged + 'semantic.js\',\n' + ; + gulp.src(output.themes + 'default/assets/**') + .pipe(concatFnames("dummy.txt", { + newline: '', + root: './', + prepend: ' \'', + append: '\',' + })) + .pipe(tap(function(file) { fnames += file.contents; })) + .on('end', function() { + gulp.src(release.templates.meteor) + .pipe(plumber()) + .pipe(flatten()) + .pipe(replace('{package-version}', version)) + .pipe(replace('{package-files}', fnames)) + .pipe(gulp.dest('./')) + ; + }) + ; }); // cleans distribution files @@ -594,27 +618,32 @@ gulp.task('install', 'Set-up project for first time', function () { ; } - // write package.js + // writes package.js console.info('Creating package.js (Meteor)'); var packagedFolder = json.paths.output.packaged || output.packaged, themesFolder = json.paths.output.themes || output.themes, fnames = - '\n \'' + packagedFolder + 'semantic.css\',' + - '\n \'' + packagedFolder + 'semantic.js\',' + - '\n \'' + themesFolder + 'default/assets/images/flags.png\',' + - '\n \'' + themesFolder + 'default/assets/fonts/icons.eot\',' + - '\n \'' + themesFolder + 'default/assets/fonts/icons.otf\',' + - '\n \'' + themesFolder + 'default/assets/fonts/icons.svg\',' + - '\n \'' + themesFolder + 'default/assets/fonts/icons.ttf\',' + - '\n \'' + themesFolder + 'default/assets/fonts/icons.woff\'' + ' \'' + packagedFolder + 'semantic.css\',\n' + + ' \'' + packagedFolder + 'semantic.js\',\n' ; - gulp.src(release.templates.meteor) - .pipe(plumber()) - .pipe(flatten()) - .pipe(replace('{package-version}', version)) - .pipe(replace('{package-files}', fnames)) - .pipe(gulp.dest('./')) + gulp.src(themesFolder + 'default/assets/**') + .pipe(concatFnames("dummy.txt", { + newline: '', + root: './', + prepend: ' \'', + append: '\',' + })) + .pipe(tap(function(file) { fnames += file.contents; })) + .on('end', function() { + gulp.src(release.templates.meteor) + .pipe(plumber()) + .pipe(flatten()) + .pipe(replace('{package-version}', version)) + .pipe(replace('{package-files}', fnames)) + .pipe(gulp.dest('./')) + ; + }) ; console.log(''); @@ -744,7 +773,6 @@ gulp.task('create repos', false, function(callback) { outputDirectory = release.outputRoot + component, isJavascript = fs.existsSync(output.compressed + component + '.js'), isCSS = fs.existsSync(output.compressed + component + '.css'), - assets = release.componentsAssets[component], capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1), packageName = release.packageRoot + component, repoName = release.repoRoot + capitalizedComponent, @@ -794,47 +822,16 @@ gulp.task('create repos', false, function(callback) { task = { all : component + ' creating', repo : component + ' create repo', - assetsPaths : component + ' get assets paths', - assets : component + ' copy assets', bower : component + ' create bower.json', + package : component + ' create package.json', readme : component + ' create README', npm : component + ' create NPM Module', notes : component + ' create release notes', composer : component + ' create composer.json', - package : component + ' create package.json', meteor : component + ' create package.js', - }, - taskSequence = (assets) - ? [ - task.repo, - task.assets, - task.assetsPaths, - task.npm, - task.bower, - task.readme, - task.package, - task.composer, - task.notes, - task.meteor - ] - : [ - task.repo, - task.npm, - task.bower, - task.readme, - task.package, - task.composer, - task.notes, - task.meteor - ], - fnames = '' + } ; - if(isJavascript) - fnames += ' \'' + component + '.js\',\n'; - if(isCSS) - fnames += ' \'' + component + '.css\',\n'; - // copy dist files into output folder adjusting asset paths gulp.task(task.repo, false, function() { return gulp.src(release.source + component + '.*') @@ -845,32 +842,6 @@ gulp.task('create repos', false, function(callback) { ; }); - // possibly copy assets - if (assets) { - var - baseFolder = source.themes + 'default/', - concatFilenamesOptions = { - newline: '', - root: source.themes + 'default/', - prepend: ' \'', - append: '\',' - } - ; - - gulp.task(task.assetsPaths, function() { - return gulp.src(baseFolder + assets, { base: baseFolder}) - .pipe(concatFnames("dummy.txt", concatFilenamesOptions)) - .pipe(tap(function(file) { fnames += file.contents; })) - ; - }); - - gulp.task(task.assets, false, function() { - return gulp.src(baseFolder + assets, { base: baseFolder}) - .pipe(gulp.dest(outputDirectory)) - ; - }); - } - // create npm module gulp.task(task.npm, false, function() { return gulp.src(release.source + component + '!(*.min|*.map).js') @@ -998,24 +969,53 @@ gulp.task('create repos', false, function(callback) { ; }); - // create package.js - var taskDeps = assets ? [task.assetsPaths] : false; - gulp.task(task.meteor, taskDeps, function() { - return gulp.src(release.templates.meteorComponent) - .pipe(plumber()) - .pipe(flatten()) - .pipe(replace(regExp.match.name, regExp.replace.name)) - .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) - .pipe(replace(regExp.match.mversion, regExp.replace.mversion)) - .pipe(replace(regExp.match.mfiles, fnames)) - .pipe(rename('package.js')) - .pipe(gulp.dest(outputDirectory)) + // Meteor stuff + + // Creates Meteor package.js + // Tries to list assets to be added among the files list + // inside the package.js file for Meteor + gulp.task(task.meteor, function() { + var fnames = ''; + if(isJavascript) + fnames += ' \'' + component + '.js\',\n'; + if(isCSS) + fnames += ' \'' + component + '.css\',\n'; + return gulp.src(outputDirectory + '/assets/**', { base: outputDirectory}) + .pipe(concatFnames("dummy.txt", { + newline: '', + root: outputDirectory, + prepend: ' \'', + append: '\',' + })) + .pipe(tap(function(file) { fnames += file.contents;})) + .on('end', function(){ + gulp.src(release.templates.meteorComponent) + .pipe(plumber()) + .pipe(flatten()) + .pipe(replace(regExp.match.name, regExp.replace.name)) + .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) + .pipe(replace(regExp.match.mversion, regExp.replace.mversion)) + .pipe(replace(regExp.match.mfiles, fnames)) + .pipe(rename('package.js')) + .pipe(gulp.dest(outputDirectory)) + ; + }) ; }); + // synchronous tasks in orchestrator? I think not gulp.task(task.all, false, function(callback) { - runSequence(taskSequence, callback); + runSequence([ + task.repo, + task.npm, + task.bower, + task.readme, + task.package, + task.composer, + task.notes, + task.meteor + ], callback); }); tasks.push(task.all); @@ -1146,7 +1146,7 @@ gulp.task('update git', false, function() { mergeCommit(); } }); - }; + } function mergeCommit() { // commit files console.log('Adding merge commit', commitArgs); @@ -1169,17 +1169,9 @@ gulp.task('update git', false, function() { function tagFiles() { console.log('Tagging new version ', version); git.tag(version, 'Updated version from semantic-ui (automatic)', function (err) { - publishMeteor(); + pushFiles(); }); } - function publishMeteor() { - console.log('Publishing Meteor package version ', version); - //var cmd = new run.Command('meteor publish'); - //cmd.exec(function(error){ - // pushFiles(); - //}); - pushFiles(); - } function pushFiles() { console.log('Pushing files'); git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { From 01a1e1c52d46fb00ad5a34c34fbe86528c38345f Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:26:21 +0100 Subject: [PATCH 14/24] better order --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 05e575c48..50d043795 100644 --- a/package.json +++ b/package.json @@ -24,14 +24,15 @@ "del": "^1.0.0", "extend": "^2.0.0", "github": "^0.2.3", + "gulp": "^3.8.10", "gulp-autoprefixer": "^2.0.0", "gulp-batch": "^1.0.3", "gulp-chmod": "^1.2.0", "gulp-clone": "^1.0.0", + "gulp-concat": "^2.4.2", "gulp-concat-css": "^1.1.1", "gulp-concat-filenames": "^0.0.3", - "gulp-concat": "^2.4.2", - "gulp-copy": "^0.0.2", + "gulp-copy": "0.0.2", "gulp-csscomb": "^3.0.3", "gulp-debug": "^1.0.1", "gulp-flatten": "0.0.4", @@ -54,7 +55,6 @@ "gulp-uglify": "^1.0.1", "gulp-util": "^3.0.1", "gulp-watch": "^2.0.0", - "gulp": "^3.8.10", "karma": "^0.12.28", "rtlcss": "^1.4.2", "run-sequence": "^1.0.2", From 357c2a3165d5d79dabbce9cf3d42bf1f27c9c7fb Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:33:16 +0100 Subject: [PATCH 15/24] fixed version --- package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.js b/package.js index d5bf0cac6..4aaf8c407 100644 --- a/package.js +++ b/package.js @@ -1,7 +1,7 @@ Package.describe({ name: 'semantic:ui', summary: 'Semantic (official): a UI component framework based around useful principles from natural language.', - version: '1.7.2', + version: '1.7.0', git: 'git://github.com/Semantic-Org/Semantic-UI.git', readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md' }); From bef92fdbdc957d735bf590a8b6f886d808928729 Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:33:46 +0100 Subject: [PATCH 16/24] cleanup --- gulpfile.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 53fd53c92..2ab49762a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -428,11 +428,13 @@ gulp.task('build', 'Builds all files from source', function(callback) { // updates package.js console.info('Updating package.js (Meteor)'); - var fnames = - ' \'' + output.packaged + 'semantic.css\',\n' + - ' \'' + output.packaged + 'semantic.js\',\n' + var + assetPath = output.themes + 'default/assets/', + fnames = + ' \'' + output.packaged + 'semantic.css\',\n' + + ' \'' + output.packaged + 'semantic.js\',\n' ; - gulp.src(output.themes + 'default/assets/**') + gulp.src(assetPath + '**', {base: assetPath}) .pipe(concatFnames("dummy.txt", { newline: '', root: './', @@ -1307,7 +1309,7 @@ gulp.task('create repos', false, function(callback) { .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) .pipe(replace(regExp.match.mversion, regExp.replace.mversion)) .pipe(replace(regExp.match.mfiles, fnames)) - .pipe(rename('package.js')) + .pipe(rename(defaults.files.npm)) .pipe(gulp.dest(outputDirectory)) ; }) From 7b8621edcb862e424a5773715bf088f14d42527e Mon Sep 17 00:00:00 2001 From: Luca Mussi Date: Mon, 12 Jan 2015 00:36:25 +0100 Subject: [PATCH 17/24] cleanup --- gulpfile.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 2ab49762a..7582e83e7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1126,15 +1126,15 @@ gulp.task('create repos', false, function(callback) { } }, task = { - all : component + ' creating', - repo : component + ' create repo', - bower : component + ' create bower.json', - package : component + ' create package.json', - readme : component + ' create README', - npm : component + ' create NPM Module', - notes : component + ' create release notes', - composer : component + ' create composer.json', - meteor : component + ' create package.js', + all : component + ' creating', + repo : component + ' create repo', + bower : component + ' create bower.json', + readme : component + ' create README', + npm : component + ' create NPM Module', + notes : component + ' create release notes', + composer : component + ' create composer.json', + package : component + ' create package.json', + meteor : component + ' create package.js', } ; From db25fb6f166beab19df01f48d360cb5b2cdad4db Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 12 Jan 2015 13:37:11 -0500 Subject: [PATCH 18/24] #1607 formatting --- tasks/admin/templates/package.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js index 23d20d9e0..59fcf8038 100644 --- a/tasks/admin/templates/package.js +++ b/tasks/admin/templates/package.js @@ -1,18 +1,18 @@ +var + where = 'client' // Adds files only to the client +; + Package.describe({ - name: 'semantic:ui', - summary: 'Semantic (official): a UI component framework based around useful principles from natural language.', - version: '{package-version}', - git: 'git://github.com/Semantic-Org/Semantic-UI.git', - readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md' + name : 'semantic:ui', + summary : 'Semantic (official): a UI component framework based around useful principles from natural language.', + version : '{package-version}', + git : 'git://github.com/Semantic-Org/Semantic-UI.git', + readme : 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md' }); -var where = 'client'; // Adds files only to the client - Package.onUse(function(api) { api.versionsFrom('1.0'); - - api.addFiles([ -{package-files} ], where); + api.addFiles([ {package-files} ], where); }); Package.onTest(function(api) { From 8afab4af8d6c19e047c1986884250b5d69cba94e Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 12 Jan 2015 13:46:01 -0500 Subject: [PATCH 19/24] Restructure test/ for meteor #1607 --- meteor/tests/test_fonts.js | 14 -------------- tasks/admin/templates/package.js | 4 ++-- .../test_images.js => test/meteor/assets.js | 10 +++++----- test/meteor/fonts.js | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 21 deletions(-) delete mode 100644 meteor/tests/test_fonts.js rename meteor/tests/test_images.js => test/meteor/assets.js (88%) create mode 100644 test/meteor/fonts.js diff --git a/meteor/tests/test_fonts.js b/meteor/tests/test_fonts.js deleted file mode 100644 index 40c208162..000000000 --- a/meteor/tests/test_fonts.js +++ /dev/null @@ -1,14 +0,0 @@ -// Check that the font files are downloadable. Meteor places assets at /packages//. -['eot', 'otf', 'svg', 'ttf', 'woff'].forEach(function (ext) { - Tinytest.addAsync(ext + ' fonts are shipped', function (test, done) { - HTTP.get('/packages/semantic_ui/dist/themes/default/assets/fonts/icons.' + ext, function callback(error, result) { - if (error) { - test.fail({message: 'Font failed to load'}); - } else { - test.isTrue(result.content.length > 10000, ext + ' font could not be downloaded'); - } - - done(); - }); - }); -}); \ No newline at end of file diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js index 59fcf8038..c6df8250c 100644 --- a/tasks/admin/templates/package.js +++ b/tasks/admin/templates/package.js @@ -23,7 +23,7 @@ Package.onTest(function(api) { ], where); api.addFiles([ - 'meteor/tests/test_fonts.js', - 'meteor/tests/test_images.js', + 'test/meteor/fonts.js', + 'test/meteor/assets.js', ], where); }); diff --git a/meteor/tests/test_images.js b/test/meteor/assets.js similarity index 88% rename from meteor/tests/test_images.js rename to test/meteor/assets.js index 0b87a8e5f..40f4b40ec 100644 --- a/meteor/tests/test_images.js +++ b/test/meteor/assets.js @@ -1,20 +1,20 @@ -var images = [ +var assets = [ 'dist/themes/default/assets/images/flags.png', ]; // Check that the font files are downloadable. Meteor places assets at /packages//. -images.forEach(function (path) { +assets.forEach(function (path) { Tinytest.addAsync('image ' + path + ' is shipped', function (test, done) { HTTP.get('/packages/semantic_ui/' + path, function callback(error, result) { if (error) { test.fail({message: 'Image failed to load'}); - } else { + } + else { test.isTrue(result.content.length > 10000, 'Image ' + path + ' could not be downloaded'); } - done(); }); }); }); - + diff --git a/test/meteor/fonts.js b/test/meteor/fonts.js new file mode 100644 index 000000000..195d5159b --- /dev/null +++ b/test/meteor/fonts.js @@ -0,0 +1,16 @@ +// Check that the font files are downloadable. Meteor places assets at /packages//. +['eot', 'otf', 'svg', 'ttf', 'woff'] + .forEach(function (extension) { + Tinytest.addAsync(extension + ' fonts are shipped', function (test, done) { + HTTP.get('/packages/semantic_ui/dist/themes/default/assets/fonts/icons.' + extension, function callback(error, result) { + if (error) { + test.fail({message: 'Font failed to load'}); + } + else { + test.isTrue(result.content.length > 10000, extension + ' font could not be downloaded'); + } + done(); + }); + }); + }) +; \ No newline at end of file From ba2e1f6e499570495d9d8b34a87f6cde9fb9a347 Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 12 Jan 2015 14:21:40 -0500 Subject: [PATCH 20/24] JS formatting: implicit brackets, full words, removing meteor tasks from build/install --- gulpfile.js | 162 +++++++++++++++++----------------------------------- 1 file changed, 53 insertions(+), 109 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 10a968a9f..9d7d8e782 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,57 +9,57 @@ var - gulp = require('gulp-help')(require('gulp')), + gulp = require('gulp-help')(require('gulp')), // node components & oddballs - console = require('better-console'), - del = require('del'), - extend = require('extend'), - fs = require('fs'), - path = require('path'), - runSequence = require('run-sequence'), - wrench = require('wrench'), + console = require('better-console'), + del = require('del'), + extend = require('extend'), + fs = require('fs'), + path = require('path'), + runSequence = require('run-sequence'), + wrench = require('wrench'), // gulp dependencies - autoprefixer = require('gulp-autoprefixer'), - chmod = require('gulp-chmod'), - clone = require('gulp-clone'), - concat = require('gulp-concat'), - concatCSS = require('gulp-concat-css'), - concatFnames = require('gulp-concat-filenames'), - copy = require('gulp-copy'), - debug = require('gulp-debug'), - flatten = require('gulp-flatten'), - header = require('gulp-header'), - jeditor = require('gulp-json-editor'), - karma = require('gulp-karma'), - less = require('gulp-less'), - minifyCSS = require('gulp-minify-css'), - notify = require('gulp-notify'), - plumber = require('gulp-plumber'), - print = require('gulp-print'), - prompt = require('gulp-prompt'), - rename = require('gulp-rename'), - replace = require('gulp-replace'), - rtlcss = require('gulp-rtlcss'), - sourcemaps = require('gulp-sourcemaps'), - tap = require('gulp-tap'), - uglify = require('gulp-uglify'), - util = require('gulp-util'), - watch = require('gulp-watch'), + autoprefixer = require('gulp-autoprefixer'), + chmod = require('gulp-chmod'), + clone = require('gulp-clone'), + concat = require('gulp-concat'), + concatCSS = require('gulp-concat-css'), + concatFileNames = require('gulp-concat-filenames'), + copy = require('gulp-copy'), + debug = require('gulp-debug'), + flatten = require('gulp-flatten'), + header = require('gulp-header'), + jeditor = require('gulp-json-editor'), + karma = require('gulp-karma'), + less = require('gulp-less'), + minifyCSS = require('gulp-minify-css'), + notify = require('gulp-notify'), + plumber = require('gulp-plumber'), + print = require('gulp-print'), + prompt = require('gulp-prompt'), + rename = require('gulp-rename'), + replace = require('gulp-replace'), + rtlcss = require('gulp-rtlcss'), + sourcemaps = require('gulp-sourcemaps'), + tap = require('gulp-tap'), + uglify = require('gulp-uglify'), + util = require('gulp-util'), + watch = require('gulp-watch'), // config - banner = require('./tasks/banner'), - comments = require('./tasks/comments'), - defaults = require('./tasks/defaults'), - log = require('./tasks/log'), - questions = require('./tasks/questions'), - settings = require('./tasks/gulp-settings'), + banner = require('./tasks/banner'), + comments = require('./tasks/comments'), + defaults = require('./tasks/defaults'), + log = require('./tasks/log'), + questions = require('./tasks/questions'), + settings = require('./tasks/gulp-settings'), // admin - release = require('./tasks/admin/release'), - git = require('gulp-git'), - githubAPI = require('github'), + release = require('./tasks/admin/release'), + git = require('gulp-git'), + githubAPI = require('github'), oAuth = fs.existsSync('./tasks/admin/oauth.js') ? require('./tasks/admin/oauth') @@ -425,33 +425,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { gulp.start('package compressed css'); }) ; - - // updates package.js - console.info('Updating package.js (Meteor)'); - var - assetPath = output.themes + 'default/assets/', - fnames = - ' \'' + output.packaged + 'semantic.css\',\n' + - ' \'' + output.packaged + 'semantic.js\',\n' - ; - gulp.src(assetPath + '**', {base: assetPath}) - .pipe(concatFnames("dummy.txt", { - newline: '', - root: './', - prepend: ' \'', - append: '\',' - })) - .pipe(tap(function(file) { fnames += file.contents; })) - .on('end', function() { - gulp.src(release.templates.meteor) - .pipe(plumber()) - .pipe(flatten()) - .pipe(replace('{package-version}', version)) - .pipe(replace('{package-files}', fnames)) - .pipe(gulp.dest('./')) - ; - }) - ; }); // cleans distribution files @@ -927,35 +900,6 @@ gulp.task('install', 'Set-up project for first time', function () { .pipe(gulp.dest('./')) ; } - - // writes package.js - console.info('Creating package.js (Meteor)'); - var - packagedFolder = json.paths.output.packaged || output.packaged, - themesFolder = json.paths.output.themes || output.themes, - fnames = - ' \'' + packagedFolder + 'semantic.css\',\n' + - ' \'' + packagedFolder + 'semantic.js\',\n' - ; - gulp.src(themesFolder + 'default/assets/**') - .pipe(concatFnames("dummy.txt", { - newline: '', - root: './', - prepend: ' \'', - append: '\',' - })) - .pipe(tap(function(file) { fnames += file.contents; })) - .on('end', function() { - gulp.src(release.templates.meteor) - .pipe(plumber()) - .pipe(flatten()) - .pipe(replace('{package-version}', version)) - .pipe(replace('{package-files}', fnames)) - .pipe(gulp.dest('./')) - ; - }) - ; - console.log(''); console.log(''); })) @@ -1288,25 +1232,25 @@ gulp.task('create repos', false, function(callback) { ; }); - // Meteor stuff - // Creates Meteor package.js // Tries to list assets to be added among the files list // inside the package.js file for Meteor gulp.task(task.meteor, function() { - var fnames = ''; - if(isJavascript) - fnames += ' \'' + component + '.js\',\n'; - if(isCSS) - fnames += ' \'' + component + '.css\',\n'; + var fileNames = ''; + if(isJavascript) { + fileNames += ' \'' + component + '.js\',\n'; + } + if(isCSS) { + fileNames += ' \'' + component + '.css\',\n'; + } return gulp.src(outputDirectory + '/assets/**', { base: outputDirectory}) - .pipe(concatFnames("dummy.txt", { + .pipe(concatFileNames('dummy.txt', { newline: '', root: outputDirectory, prepend: ' \'', append: '\',' })) - .pipe(tap(function(file) { fnames += file.contents;})) + .pipe(tap(function(file) { fileNames += file.contents;})) .on('end', function(){ gulp.src(release.templates.meteorComponent) .pipe(plumber()) @@ -1314,7 +1258,7 @@ gulp.task('create repos', false, function(callback) { .pipe(replace(regExp.match.name, regExp.replace.name)) .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) .pipe(replace(regExp.match.mversion, regExp.replace.mversion)) - .pipe(replace(regExp.match.mfiles, fnames)) + .pipe(replace(regExp.match.mfiles, fileNames)) .pipe(rename(defaults.files.npm)) .pipe(gulp.dest(outputDirectory)) ; From 469a540bdee16f1ba55f4fe1d6ac4bb658b2448a Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 12 Jan 2015 14:28:50 -0500 Subject: [PATCH 21/24] Update templated var names for meteor #1607 --- gulpfile.js | 15 +++++++-------- tasks/admin/templates/package.js | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 9d7d8e782..8ae7f057f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1036,9 +1036,11 @@ gulp.task('create repos', false, function(callback) { repoURL = 'https://github.com/' + release.org + '/' + repoName + '/', regExp = { match : { - // readme - name : '{component}', - titleName : '{Component}', + // templated values + name : '{component}', + titleName : '{Component}', + version : '{version}', + files : '{files}', // release notes spacedVersions : /(###.*\n)\n+(?=###)/gm, spacedLists : /(^- .*\n)\n+(?=^-)/gm, @@ -1051,9 +1053,6 @@ gulp.task('create repos', false, function(callback) { settingsExport : /\$\.fn\.\w+\.settings\s*=/g, settingsReference : /\$\.fn\.\w+\.settings/g, jQuery : /jQuery/g, - // meteor - mversion : '{package-version}', - mfiles : '{package-files}', }, replace : { // readme @@ -1257,8 +1256,8 @@ gulp.task('create repos', false, function(callback) { .pipe(flatten()) .pipe(replace(regExp.match.name, regExp.replace.name)) .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) - .pipe(replace(regExp.match.mversion, regExp.replace.mversion)) - .pipe(replace(regExp.match.mfiles, fileNames)) + .pipe(replace(regExp.match.version, regExp.replace.mversion)) + .pipe(replace(regExp.match.files, fileNames)) .pipe(rename(defaults.files.npm)) .pipe(gulp.dest(outputDirectory)) ; diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js index c6df8250c..4a09cbdb7 100644 --- a/tasks/admin/templates/package.js +++ b/tasks/admin/templates/package.js @@ -5,14 +5,14 @@ var Package.describe({ name : 'semantic:ui', summary : 'Semantic (official): a UI component framework based around useful principles from natural language.', - version : '{package-version}', + version : '{version}', git : 'git://github.com/Semantic-Org/Semantic-UI.git', readme : 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md' }); Package.onUse(function(api) { api.versionsFrom('1.0'); - api.addFiles([ {package-files} ], where); + api.addFiles([ {files} ], where); }); Package.onTest(function(api) { From bf30fe0e9f0fb1189a3b066282ea4cc99438c9c8 Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 12 Jan 2015 14:30:50 -0500 Subject: [PATCH 22/24] #1607 Meteor version uses global version from package.json --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 8ae7f057f..d52085cbe 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1256,7 +1256,7 @@ gulp.task('create repos', false, function(callback) { .pipe(flatten()) .pipe(replace(regExp.match.name, regExp.replace.name)) .pipe(replace(regExp.match.titleName, regExp.replace.titleName)) - .pipe(replace(regExp.match.version, regExp.replace.mversion)) + .pipe(replace(regExp.match.version, version)) .pipe(replace(regExp.match.files, fileNames)) .pipe(rename(defaults.files.npm)) .pipe(gulp.dest(outputDirectory)) From 82f07d61164fd5b0a19beb705e0fb5113760c845 Mon Sep 17 00:00:00 2001 From: jlukic Date: Fri, 16 Jan 2015 12:01:31 -0500 Subject: [PATCH 23/24] Remove duplicate variable --- gulpfile.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index d9d5d9f05..b172a6568 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1082,9 +1082,7 @@ gulp.task('create repos', false, function(callback) { formExport : 'module.exports = function(fields, parameters) {\n var _module = module;\n', settingsExport : 'module.exports.settings =', settingsReference : '_module.exports.settings', - jQuery : 'require("jquery")', - // meteor - mversion : version + jQuery : 'require("jquery")' } }, task = { From 2bc5d6fd3fd850e548281eb6fcb772225fd21dfb Mon Sep 17 00:00:00 2001 From: jlukic Date: Fri, 16 Jan 2015 16:40:32 -0500 Subject: [PATCH 24/24] Iterating on gulpfile restructure --- gulpfile.js | 176 +++++++++++---------- package.js | 27 ++-- package.json | 2 - tasks/admin/templates/package-component.js | 18 ++- tasks/admin/templates/package.js | 8 +- 5 files changed, 122 insertions(+), 109 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index b172a6568..2af544536 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,57 +16,40 @@ var del = require('del'), extend = require('extend'), fs = require('fs'), + + // unsure path = require('path'), - runSequence = require('run-sequence'), - wrench = require('wrench'), - // gulp dependencies + // watch / build deps autoprefixer = require('gulp-autoprefixer'), chmod = require('gulp-chmod'), clone = require('gulp-clone'), concat = require('gulp-concat'), - concatCSS = require('gulp-concat-css'), - concatFileNames = require('gulp-concat-filenames'), copy = require('gulp-copy'), debug = require('gulp-debug'), flatten = require('gulp-flatten'), header = require('gulp-header'), - jeditor = require('gulp-json-editor'), karma = require('gulp-karma'), less = require('gulp-less'), minifyCSS = require('gulp-minify-css'), - notify = require('gulp-notify'), plumber = require('gulp-plumber'), print = require('gulp-print'), - prompt = require('gulp-prompt'), rename = require('gulp-rename'), replace = require('gulp-replace'), - rtlcss = require('gulp-rtlcss'), - sourcemaps = require('gulp-sourcemaps'), - tap = require('gulp-tap'), uglify = require('gulp-uglify'), util = require('gulp-util'), watch = require('gulp-watch'), + // rtl + rtlcss = require('gulp-rtlcss'), + // config banner = require('./tasks/banner'), comments = require('./tasks/comments'), defaults = require('./tasks/defaults'), log = require('./tasks/log'), - questions = require('./tasks/questions'), settings = require('./tasks/gulp-settings'), - // admin - release = require('./tasks/admin/release'), - git = require('gulp-git'), - githubAPI = require('github'), - - oAuth = fs.existsSync('./tasks/admin/oauth.js') - ? require('./tasks/admin/oauth') - : false, - github, - - // local runSetup = false, overwrite = true, @@ -136,14 +119,6 @@ var : 'Unknown' ; - // create glob for matching filenames from components in semantic.json - componentGlob = (typeof config.components == 'object') - ? (config.components.length > 1) - ? '{' + config.components.join(',') + '}' - : config.components[0] - : '{' + defaults.components.join(',') + '}' - ; - // relative asset paths for css assetPaths = { uncompressed : path.relative(output.uncompressed, output.themes).replace(/\\/g,'/'), @@ -163,6 +138,15 @@ var } } clean = base + clean; + + // create glob for matching filenames from components in semantic.json + componentGlob = (typeof config.components == 'object') + ? (config.components.length > 1) + ? '{' + config.components.join(',') + '}' + : config.components[0] + : '{' + defaults.components.join(',') + '}' + ; + } ; @@ -250,7 +234,6 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb // unified css stream stream = gulp.src(srcPath) .pipe(plumber()) - //.pipe(sourcemaps.init()) .pipe(less(settings.less)) .pipe(replace(comments.variables.in, comments.variables.out)) .pipe(replace(comments.large.in, comments.large.out)) @@ -266,7 +249,6 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb uncompressedStream .pipe(plumber()) .pipe(replace(assetPaths.source, assetPaths.uncompressed)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) @@ -282,7 +264,6 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb .pipe(replace(assetPaths.source, assetPaths.compressed)) .pipe(minifyCSS(settings.minify)) .pipe(rename(settings.rename.minCSS)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.compressed)) @@ -299,10 +280,10 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb }) ; - // watch for changes in assets + // watch for changes in assets that match component names (or their plural) gulp .watch([ - source.themes + '**/assets/**' + source.themes + '**/assets/**/' + componentGlob + '?(s).*' ], function(file) { // copy assets gulp.src(file.path, { base: source.themes }) @@ -323,7 +304,6 @@ gulp.task('watch', 'Watch for site/theme changes (Default Task)', function(callb .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) - .pipe(sourcemaps.init()) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(chmod(config.permission)) @@ -364,7 +344,7 @@ gulp.task('build', 'Builds all files from source', function(callback) { assetPaths.source = '../../themes'; // path.relative returns wrong path (hardcoded for src) // copy assets - gulp.src(source.themes + '**/assets/**') + gulp.src(source.themes + '**/assets/**/' + componentGlob + '?(s).*') .pipe(chmod(config.permission)) .pipe(gulp.dest(output.themes)) ; @@ -376,7 +356,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) - // .pipe(sourcemaps.init()) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(header(banner, settings.header)) @@ -392,7 +371,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { // unified css stream stream = gulp.src(source.definitions + '**/' + componentGlob + '.less') .pipe(plumber()) - //.pipe(sourcemaps.init()) .pipe(less(settings.less)) .pipe(flatten()) .pipe(replace(comments.variables.in, comments.variables.out)) @@ -409,7 +387,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { uncompressedStream .pipe(plumber()) .pipe(replace(assetPaths.source, assetPaths.uncompressed)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) @@ -425,7 +402,6 @@ gulp.task('build', 'Builds all files from source', function(callback) { .pipe(replace(assetPaths.source, assetPaths.compressed)) .pipe(minifyCSS(settings.minify)) .pipe(rename(settings.rename.minCSS)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.compressed)) @@ -446,11 +422,11 @@ gulp.task('version', 'Displays current version of Semantic', function(callback) console.log('Semantic UI ' + version); }); + /******************************* RTL Tasks *******************************/ - /* Watch RTL */ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(callback) { @@ -513,7 +489,6 @@ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(c // unified css stream stream = gulp.src(srcPath) .pipe(plumber()) - //.pipe(sourcemaps.init()) .pipe(less(settings.less)) .pipe(replace(comments.variables.in, comments.variables.out)) .pipe(replace(comments.large.in, comments.large.out)) @@ -530,7 +505,6 @@ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(c uncompressedStream .pipe(plumber()) .pipe(replace(assetPaths.source, assetPaths.uncompressed)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(rename(settings.rename.rtlCSS)) @@ -546,7 +520,6 @@ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(c .pipe(clone()) .pipe(replace(assetPaths.source, assetPaths.compressed)) .pipe(minifyCSS(settings.minify)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(rename(settings.rename.rtlMinCSS)) @@ -588,7 +561,6 @@ gulp.task('watch rtl', 'Watch for site/theme changes (Default Task)', function(c .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) - .pipe(sourcemaps.init()) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(chmod(config.permission)) @@ -636,7 +608,6 @@ gulp.task('build rtl', 'Builds all files from source', function(callback) { .pipe(chmod(config.permission)) .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) - // .pipe(sourcemaps.init()) .pipe(uglify(settings.uglify)) .pipe(rename(settings.rename.minJS)) .pipe(header(banner, settings.header)) @@ -652,7 +623,6 @@ gulp.task('build rtl', 'Builds all files from source', function(callback) { // unified css stream stream = gulp.src(source.definitions + '**/' + componentGlob + '.less') .pipe(plumber()) - //.pipe(sourcemaps.init()) .pipe(less(settings.less)) .pipe(flatten()) .pipe(replace(comments.variables.in, comments.variables.out)) @@ -670,7 +640,6 @@ gulp.task('build rtl', 'Builds all files from source', function(callback) { uncompressedStream .pipe(plumber()) .pipe(replace(assetPaths.source, assetPaths.uncompressed)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(rename(settings.rename.rtlCSS)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) @@ -687,7 +656,6 @@ gulp.task('build rtl', 'Builds all files from source', function(callback) { .pipe(replace(assetPaths.source, assetPaths.compressed)) .pipe(minifyCSS(settings.minify)) .pipe(rename(settings.rename.rtlMinCSS)) - //.pipe(sourcemaps.write('/', settings.sourcemap)) .pipe(header(banner, settings.header)) .pipe(chmod(config.permission)) .pipe(gulp.dest(output.compressed)) @@ -773,10 +741,19 @@ gulp.task('package compressed js', false, function() { ; }); +/******************************* + Install Tasks +*******************************/ + +var + // install dependencies + jeditor = require('gulp-json-editor'), + prompt = require('gulp-prompt'), + wrench = require('wrench'), -/*-------------- - Config ----------------*/ + questions = require('./tasks/questions'), + +; gulp.task('check install', false, function () { setTimeout(function() { @@ -934,16 +911,36 @@ gulp.task('install', 'Set-up project for first time', function () { *******************************/ var + // admin dependencies + concatFileNames = require('gulp-concat-filenames'), + git = require('gulp-git'), + githubAPI = require('github'), + runSequence = require('run-sequence'), + tap = require('gulp-tap'), + + // admin files adminQuestions = require('./tasks/admin/questions'), - newVersion = false + release = require('./tasks/admin/release'), + + // stores oauth info for GitHub API + oAuth = fs.existsSync('./tasks/admin/oauth.js') + ? require('./tasks/admin/oauth') + : false, + github, + ; + +/*-------------- + Docs +---------------*/ + + /* Moves watched files to static site generator output */ gulp.task('serve-docs', false, function () { config = require('./tasks/admin/docs.json'); getConfigValues(); - // copy source files gulp .watch([ @@ -981,10 +978,18 @@ gulp.task('build-docs', false, function () { /* Release */ gulp.task('release', false, function() { - // gulp bump - // Ask for release type (minor, major, patch) - // Bump package.json - // Bump composer.json + + // gulp build + runSequence( + 'build', + 'create files' + ); + +}); + +/* Release All */ +gulp.task('release all', false, function() { + if(!oAuth) { console.error('Must add node include tasks/admin/oauth.js with oauth token for GitHub'); return; @@ -1003,17 +1008,12 @@ gulp.task('release', false, function() { }); // gulp build - //runSequence('update git'); - runSequence('build', 'create repos', 'update git'); - - // #Create SCSS Version - // #Create RTL Release - -}); + runSequence( + 'build', + 'create components', + 'update component repos' + ); -/* Build Component Release Only */ -gulp.task('build release', false, function() { - runSequence('build', 'create repos'); }); @@ -1021,8 +1021,18 @@ gulp.task('build release', false, function() { Internal ---------------*/ - -gulp.task('create repos', false, function(callback) { +/* + This will create individual component repositories for each SUI component + + * copy component files from release + * create commonjs files as index.js for NPM release + * create release notes that filter only items related to component + * custom package.json file from template + * create bower.json from template + * create README from template + * create meteor.js file +*/ +gulp.task('create components', false, function(callback) { var stream, index, @@ -1032,7 +1042,7 @@ gulp.task('create repos', false, function(callback) { for(index in release.components) { var - component = release.components[index] + component = release.components[index] ; // streams... designed to save time and make coding fun... @@ -1242,23 +1252,23 @@ gulp.task('create repos', false, function(callback) { ; }); - // Creates Meteor package.js - // Tries to list assets to be added among the files list - // inside the package.js file for Meteor + // Creates component meteor package.js gulp.task(task.meteor, function() { - var fileNames = ''; + var + fileNames = '' + ; if(isJavascript) { fileNames += ' \'' + component + '.js\',\n'; } if(isCSS) { fileNames += ' \'' + component + '.css\',\n'; } - return gulp.src(outputDirectory + '/assets/**', { base: outputDirectory}) + return gulp.src(outputDirectory + '/assets/**/' + component + '?(s).*', { base: outputDirectory}) .pipe(concatFileNames('dummy.txt', { - newline: '', - root: outputDirectory, - prepend: ' \'', - append: '\',' + newline : '', + root : outputDirectory, + prepend : ' \'', + append : '\',' })) .pipe(tap(function(file) { fileNames += file.contents;})) .on('end', function(){ @@ -1343,7 +1353,7 @@ gulp.task('register repos', false, function(callback) { stepRepo(); }); -gulp.task('update git', false, function() { +gulp.task('update component repos', false, function() { var index = -1, total = release.components.length, diff --git a/package.js b/package.js index 4aaf8c407..8dfcf3d2f 100644 --- a/package.js +++ b/package.js @@ -1,16 +1,17 @@ +var + where = 'client' // Adds files only to the client +; + Package.describe({ - name: 'semantic:ui', - summary: 'Semantic (official): a UI component framework based around useful principles from natural language.', - version: '1.7.0', - git: 'git://github.com/Semantic-Org/Semantic-UI.git', - readme: 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md' + git : 'git://github.com/Semantic-Org/Semantic-UI.git', + name : 'semantic:ui', + readme : 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md', + summary : 'Semantic (official): a UI component framework based around useful principles from natural language.', + version : '1.7.0' }); -var where = 'client'; // Adds files only to the client - Package.onUse(function(api) { api.versionsFrom('1.0'); - api.addFiles([ 'dist/semantic.css', 'dist/semantic.js', @@ -19,19 +20,19 @@ Package.onUse(function(api) { 'dist/themes/default/assets/fonts/icons.svg', 'dist/themes/default/assets/fonts/icons.ttf', 'dist/themes/default/assets/fonts/icons.woff', - 'dist/themes/default/assets/images/flags.png', + 'dist/themes/default/assets/images/flags.png' ], where); }); Package.onTest(function(api) { api.use([ - 'tinytest', 'http', - 'semantic:ui' + 'semantic:ui', + 'tinytest' ], where); api.addFiles([ - 'meteor/tests/test_fonts.js', - 'meteor/tests/test_images.js', + 'test/meteor/assets.js', + 'test/meteor/fonts.js', ], where); }); diff --git a/package.json b/package.json index d7b8bf9c4..6f34789b6 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "gulp-concat-filenames": "^0.0.3", "gulp-copy": "0.0.2", "gulp-csscomb": "^3.0.3", - "gulp-debug": "^1.0.1", "gulp-flatten": "0.0.4", "gulp-git": "^0.5.5", "gulp-header": "^1.2.2", @@ -50,7 +49,6 @@ "gulp-rename": "^1.2.0", "gulp-replace": "^0.5.0", "gulp-rtlcss": "^0.1.2", - "gulp-sourcemaps": "^1.2.8", "gulp-tap": "^0.1.3", "gulp-uglify": "^1.0.1", "gulp-util": "^3.0.1", diff --git a/tasks/admin/templates/package-component.js b/tasks/admin/templates/package-component.js index 63911e850..0f4c199ab 100644 --- a/tasks/admin/templates/package-component.js +++ b/tasks/admin/templates/package-component.js @@ -1,15 +1,17 @@ +var + where = 'client' // Adds files only to the client +; + Package.describe({ - name: 'semantic:ui-{component}', - summary: 'Semantic UI - {Component} (official): Single component release of {component}', - version: '{package-version}', - git: 'git://github.com/Semantic-Org/UI-{Component}.git', + name : 'semantic:ui-{component}', + summary : 'Semantic UI - {Component} (official): Single component release of {component}', + version : '{version}', + git : 'git://github.com/Semantic-Org/UI-{Component}.git', }); -var where = 'client'; // Adds files only to the client - Package.onUse(function(api) { api.versionsFrom('1.0'); - api.addFiles([ -{package-files} ], where); + {files} + ], where); }); diff --git a/tasks/admin/templates/package.js b/tasks/admin/templates/package.js index 4a09cbdb7..1a59aff47 100644 --- a/tasks/admin/templates/package.js +++ b/tasks/admin/templates/package.js @@ -4,15 +4,17 @@ var Package.describe({ name : 'semantic:ui', - summary : 'Semantic (official): a UI component framework based around useful principles from natural language.', + summary : 'Semantic UI (Official): a UI component framework based around useful principles from natural language.', version : '{version}', git : 'git://github.com/Semantic-Org/Semantic-UI.git', - readme : 'https://github.com/Semantic-Org/Semantic-UI/blob/master/meteor/README.md' + readme : 'https://github.com/Semantic-Org/README.md' }); Package.onUse(function(api) { api.versionsFrom('1.0'); - api.addFiles([ {files} ], where); + api.addFiles([ + {files} + ], where); }); Package.onTest(function(api) {