Browse Source

Merge branch 'next' of github.com:Semantic-Org/Semantic-UI

pull/1845/head
jlukic 10 years ago
parent
commit
d0e43f9939
17 changed files with 185 additions and 155 deletions
  1. 10
      RELEASE-NOTES.md
  2. 2
      package.json
  3. 8
      src/definitions/behaviors/api.js
  4. 33
      src/definitions/modules/tab.js
  5. 64
      tasks/admin/components/create.js
  6. 59
      tasks/admin/distributions/create.js
  7. 24
      tasks/admin/publish.js
  8. 0
      tasks/admin/register.js
  9. 29
      tasks/admin/release-all.js
  10. 5
      tasks/admin/release.js
  11. 2
      tasks/build.js
  12. 23
      tasks/collections/admin.js
  13. 1
      tasks/config/admin/release.js
  14. 7
      tasks/config/admin/templates/component-package.js
  15. 35
      tasks/config/admin/templates/css-package.js
  16. 36
      tasks/config/admin/templates/less-package.js
  17. 2
      tasks/watch.js

10
RELEASE-NOTES.md

@ -1,5 +1,15 @@
## RELEASE NOTES ## RELEASE NOTES
### Version 1.9.3 - February 20, 2015
**Bugs**
- **Tab** - Fixed bug when loading `remote` content with `tab` where current tab would not hide while loading
- **Tab** - Tab with remote content and `auto: true` now removes duplicate slashes from url path
- **API** - Simplified `api` debug output to console to more clearly label url and data sent
**Docs**
- **Tab** - Added new tab remote content example with stubbed AJAX using SinonJS
### Version 1.9.2 - February 19, 2015 ### Version 1.9.2 - February 19, 2015
Added new repositories for css and less only versions, can be installed with Added new repositories for css and less only versions, can be installed with

2
package.json

@ -1,6 +1,6 @@
{ {
"name" : "semantic-ui", "name" : "semantic-ui",
"version" : "1.9.2",
"version" : "1.9.3",
"title" : "Semantic UI", "title" : "Semantic UI",
"description" : "Semantic empowers designers and developers by creating a shared vocabulary for UI.", "description" : "Semantic empowers designers and developers by creating a shared vocabulary for UI.",
"homepage" : "http://www.semantic-ui.com", "homepage" : "http://www.semantic-ui.com",

8
src/definitions/behaviors/api.js

@ -180,7 +180,9 @@ $.api = $.fn.api = function(parameters) {
complete : function() {} complete : function() {}
}); });
module.verbose('Creating AJAX request with settings', ajaxSettings);
module.debug('Querying URL', ajaxSettings.url);
module.debug('Sending data', data, ajaxSettings.method);
module.verbose('Using AJAX settings', ajaxSettings);
if( module.is.loading() ) { if( module.is.loading() ) {
// throttle additional requests // throttle additional requests
@ -383,7 +385,7 @@ $.api = $.fn.api = function(parameters) {
// if http status code returned and json returned error, look for it // if http status code returned and json returned error, look for it
if( xhr.status != 200 && httpMessage !== undefined && httpMessage !== '') { if( xhr.status != 200 && httpMessage !== undefined && httpMessage !== '') {
module.error(error.statusMessage + httpMessage);
module.error(error.statusMessage + httpMessage, ajaxSettings.url);
} }
else { else {
if(status == 'error' && settings.dataType == 'json') { if(status == 'error' && settings.dataType == 'json') {
@ -767,7 +769,7 @@ $.api.settings = {
namespace : 'api', namespace : 'api',
debug : true, debug : true,
verbose : true,
verbose : false,
performance : true, performance : true,
// event binding // event binding

33
src/definitions/modules/tab.js

@ -75,10 +75,7 @@ $.fn.tab = function(parameters) {
// set up automatic routing // set up automatic routing
if(settings.auto) { if(settings.auto) {
module.verbose('Setting up automatic tab retrieval from server');
settings.apiSettings = {
url: (settings.path || '') + '/{$tab}'
};
module.set.auto();
} }
// attach events if navigation wasn't set to window // attach events if navigation wasn't set to window
@ -238,6 +235,22 @@ $.fn.tab = function(parameters) {
}, },
set: { set: {
auto: function() {
var
url = (typeof settings.path == 'string')
? settings.path.replace(/\/$/, '') + '/{$tab}'
: '/{$tab}'
;
module.verbose('Setting up automatic tab retrieval from server', url);
if($.isPlainObject(settings.apiSettings)) {
settings.apiSettings.url = url;
}
else {
settings.apiSettings = {
url: url
};
}
},
state: function(state) { state: function(state) {
$.address.value(state); $.address.value(state);
} }
@ -370,22 +383,22 @@ $.fn.tab = function(parameters) {
cachedContent = module.cache.read(fullTabPath); cachedContent = module.cache.read(fullTabPath);
module.activate.tab(tabPath);
if(settings.cache && cachedContent) { if(settings.cache && cachedContent) {
module.debug('Showing existing content', fullTabPath); module.debug('Showing existing content', fullTabPath);
module.content.update(tabPath, cachedContent); module.content.update(tabPath, cachedContent);
module.activate.tab(tabPath);
settings.onTabLoad.call($tab, tabPath, parameterArray, historyEvent); settings.onTabLoad.call($tab, tabPath, parameterArray, historyEvent);
} }
else if(existingRequest) { else if(existingRequest) {
module.debug('Content is already loading', fullTabPath); module.debug('Content is already loading', fullTabPath);
$tab
.addClass(className.loading)
;
$tab.addClass(className.loading);
} }
else if($.api !== undefined) { else if($.api !== undefined) {
requestSettings = $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings);
requestSettings = $.extend(true, {
headers: { 'X-Remote': true }
}, settings.apiSettings, apiSettings);
module.debug('Retrieving remote content', fullTabPath, requestSettings); module.debug('Retrieving remote content', fullTabPath, requestSettings);
console.log(existingRequest, requestSettings, cachedContent);
$tab.api( requestSettings ); $tab.api( requestSettings );
} }
else { else {

64
tasks/admin/components/create.js

@ -34,6 +34,7 @@ var
rename = require('gulp-rename'), rename = require('gulp-rename'),
replace = require('gulp-replace'), replace = require('gulp-replace'),
tap = require('gulp-tap'), tap = require('gulp-tap'),
util = require('gulp-util'),
// config // config
config = require('../../config/user'), config = require('../../config/user'),
@ -72,6 +73,12 @@ module.exports = function(callback) {
repoName = release.componentRepoRoot + capitalizedComponent, repoName = release.componentRepoRoot + capitalizedComponent,
gitURL = 'https://github.com/' + release.org + '/' + repoName + '.git', gitURL = 'https://github.com/' + release.org + '/' + repoName + '.git',
repoURL = 'https://github.com/' + release.org + '/' + repoName + '/', repoURL = 'https://github.com/' + release.org + '/' + repoName + '/',
concatSettings = {
newline : '',
root : outputDirectory,
prepend : " '",
append : "',"
},
regExp = { regExp = {
match : { match : {
// templated values // templated values
@ -90,6 +97,7 @@ module.exports = function(callback) {
formExport : /\$\.fn\.\w+\s*=\s*function\(fields, parameters\)\s*{/g, formExport : /\$\.fn\.\w+\s*=\s*function\(fields, parameters\)\s*{/g,
settingsExport : /\$\.fn\.\w+\.settings\s*=/g, settingsExport : /\$\.fn\.\w+\.settings\s*=/g,
settingsReference : /\$\.fn\.\w+\.settings/g, settingsReference : /\$\.fn\.\w+\.settings/g,
trailingComma : /,(?=[^,]*$)/,
jQuery : /jQuery/g, jQuery : /jQuery/g,
}, },
replace : { replace : {
@ -119,10 +127,13 @@ module.exports = function(callback) {
notes : component + ' create release notes', notes : component + ' create release notes',
composer : component + ' create composer.json', composer : component + ' create composer.json',
package : component + ' create package.json', package : component + ' create package.json',
meteor : component + ' create package.js',
meteor : component + ' create meteor package.js',
}, },
// paths to includable assets // paths to includable assets
assetPath = '/assets/**/' + component + '?(s).*'
manifest = {
assets : outputDirectory + '/assets/**/' + component + '?(s).*',
component : outputDirectory + '/' + component + '+(.js|.css)'
}
; ;
// copy dist files into output folder adjusting asset paths // copy dist files into output folder adjusting asset paths
@ -265,32 +276,33 @@ module.exports = function(callback) {
// Creates meteor package.js // Creates meteor package.js
gulp.task(task.meteor, function() { gulp.task(task.meteor, function() {
var var
fileNames = ''
filenames = ''
; ;
if(isJavascript) {
fileNames += ' \'' + component + '.js\',\n';
}
if(isCSS) {
fileNames += ' \'' + component + '.css\',\n';
}
return gulp.src(outputDirectory + assetPath, { base: outputDirectory})
.pipe(concatFileNames('/dev/null', {
newline : '',
root : outputDirectory,
prepend : ' \'',
append : '\','
return gulp.src(manifest.component)
.pipe(concatFileNames('empty.txt', concatSettings))
.pipe(tap(function(file) {
filenames += file.contents;
})) }))
.pipe(tap(function(file) { fileNames += file.contents; }))
.on('end', function(){
gulp.src(release.templates.meteor.component)
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.name, regExp.replace.name))
.pipe(replace(regExp.match.titleName, regExp.replace.titleName))
.pipe(replace(regExp.match.version, version))
.pipe(replace(regExp.match.files, fileNames))
.pipe(rename(release.files.meteor))
.pipe(gulp.dest(outputDirectory))
.on('end', function() {
gulp.src(manifest.assets)
.pipe(concatFileNames('empty.txt', concatSettings))
.pipe(tap(function(file) {
filenames += file.contents;
}))
.on('end', function() {
// remove trailing slash
filenames = filenames.replace(regExp.match.trailingComma, '').trim();
gulp.src(release.templates.meteor.component)
.pipe(plumber())
.pipe(flatten())
.pipe(replace(regExp.match.name, regExp.replace.name))
.pipe(replace(regExp.match.titleName, regExp.replace.titleName))
.pipe(replace(regExp.match.version, version))
.pipe(replace(regExp.match.files, filenames))
.pipe(rename(release.files.meteor))
.pipe(gulp.dest(outputDirectory))
;
})
; ;
}) })
; ;

59
tasks/admin/distributions/create.js

@ -65,6 +65,7 @@ module.exports = function(callback) {
repoName = release.distRepoRoot + distribution, repoName = release.distRepoRoot + distribution,
regExp = { regExp = {
match : { match : {
files : '{files}',
version : '{version}' version : '{version}'
} }
}, },
@ -73,16 +74,69 @@ module.exports = function(callback) {
repo : distribution + ' create repo', repo : distribution + ' create repo',
meteor : distribution + ' create meteor package.js', meteor : distribution + ' create meteor package.js',
package : distribution + ' create package.json' package : distribution + ' create package.json'
}
},
gatherFiles,
createList
; ;
// get files for meteor
gatherFiles = function(dir) {
var
dir = dir || path.resolve('.'),
list = fs.readdirSync(dir),
omitted = [
'.git',
'node_modules',
'package.js',
'package.json',
'bower.json',
'.gitignore'
]
files = []
;
list.forEach(function(file) {
var
isOmitted = (omitted.indexOf(file) > -1),
filePath = path.join(dir, file),
stat = fs.statSync(filePath)
;
if(!isOmitted) {
if(stat && stat.isDirectory()) {
files = files.concat(gatherFiles(filePath));
}
else {
files.push(filePath.replace(outputDirectory + path.sep, ''));
}
}
})
return files
};
// spaces out list correctly
createList = function(files) {
var filenames = '';
for(file in files) {
if(file == (files.length - 1) ) {
filenames += "'" + files[file] + "'";
}
else {
filenames += "'" + files[file] + "',\n ";
}
}
return filenames;
};
gulp.task(task.meteor, function() { gulp.task(task.meteor, function() {
var
files = gatherFiles(outputDirectory)
filenames = createList(files)
;
gulp.src(release.templates.meteor[distLowerCase]) gulp.src(release.templates.meteor[distLowerCase])
.pipe(plumber()) .pipe(plumber())
.pipe(debug())
.pipe(flatten()) .pipe(flatten())
.pipe(replace(regExp.match.version, version)) .pipe(replace(regExp.match.version, version))
.pipe(replace(regExp.match.files, filenames))
.pipe(rename(release.files.meteor)) .pipe(rename(release.files.meteor))
.pipe(gulp.dest(outputDirectory)) .pipe(gulp.dest(outputDirectory))
; ;
@ -101,6 +155,7 @@ module.exports = function(callback) {
else if(distribution == 'LESS') { else if(distribution == 'LESS') {
gulp.task(task.repo, function() { gulp.task(task.repo, function() {
return gulp.src('./src/theme.config.example', { base: './src/' }) return gulp.src('./src/theme.config.example', { base: './src/' })
.pipe(gulp.src('./src/theme.less', { base: './src/' }))
.pipe(gulp.src('./src/definitions/**/*', { base: './src/' })) .pipe(gulp.src('./src/definitions/**/*', { base: './src/' }))
.pipe(gulp.src('./src/_site/**/*', { base: './src/' })) .pipe(gulp.src('./src/_site/**/*', { base: './src/' }))
.pipe(gulp.src('./src/themes/**/*', { base: './src/' })) .pipe(gulp.src('./src/themes/**/*', { base: './src/' }))

24
tasks/admin/publish.js

@ -0,0 +1,24 @@
/*******************************
Release All
*******************************/
/*
This task update all SUI individual component repos with new versions of components
* Commits changes from create components to GitHub and Tags
*/
var
runSequence = require('run-sequence')
;
/* Release All */
module.exports = function() {
runSequence(
'update distributions', // commit less/css versions to github
'update components' // commit components to github
);
};

tasks/admin/register-repos.js → tasks/admin/register.js

29
tasks/admin/release-all.js

@ -1,29 +0,0 @@
/*******************************
Release All
*******************************/
/*
This task update all SUI individual component repos with new versions of components
* Initializes repositories with current versions
* Creates local files at ../components/ with each repo for release
* Commits changes from create components
* Registers new versions with NPM Publish
*/
var
runSequence = require('run-sequence')
;
/* Release All */
module.exports = function() {
runSequence(
'build', // build Semantic
'init components', // sync with current github version
'create components', // update each repo
'update components' // commit changes to github
);
};

5
tasks/admin/release.js

@ -7,8 +7,6 @@
* Initializes repositories with current versions * Initializes repositories with current versions
* Creates local files at ../distributions/ with each repo for release * Creates local files at ../distributions/ with each repo for release
* Commits changes from create components
* Registers new versions with NPM Publish
*/ */
@ -23,7 +21,8 @@ module.exports = function() {
'build', // build Semantic 'build', // build Semantic
'init distributions', // sync with current github version 'init distributions', // sync with current github version
'create distributions', // update each repo with changes from master repo 'create distributions', // update each repo with changes from master repo
'update distributions' // commit changes to github
'init components', // sync with current github version
'create components' // update each repo
); );
}; };

2
tasks/build.js

@ -61,7 +61,7 @@ module.exports = function(callback) {
// check for right-to-left language // check for right-to-left language
if(config.rtl === true || config.rtl === 'Yes') { if(config.rtl === true || config.rtl === 'Yes') {
gulp.start('build rtl');
gulp.start('build-rtl');
return; return;
} }

23
tasks/collections/admin.js

@ -26,25 +26,24 @@ module.exports = function(gulp) {
createDistributions = require('../admin/distributions/create'), createDistributions = require('../admin/distributions/create'),
updateDistributions = require('../admin/distributions/update'), updateDistributions = require('../admin/distributions/update'),
// one time register with PM
registerRepos = require('../admin/register-repos'),
// meta tasks
releaseAll = require('../admin/release-all'),
release = require('../admin/release')
release = require('../admin/release'),
publish = require('../admin/publish'),
register = require('../admin/register')
; ;
gulp.task('release', 'Publishes only packaged releases', release);
gulp.task('release all', 'Publishes all releases (components, package)', releaseAll);
/* Release */
gulp.task('init distributions', 'Grabs each component from GitHub', initDistributions); gulp.task('init distributions', 'Grabs each component from GitHub', initDistributions);
gulp.task('create distributions', 'Updates files in each repo', createDistributions); gulp.task('create distributions', 'Updates files in each repo', createDistributions);
gulp.task('update distributions', 'Commits component updates from create to GitHub', updateDistributions);
gulp.task('init components', 'Grabs each component from GitHub', initComponents); gulp.task('init components', 'Grabs each component from GitHub', initComponents);
gulp.task('create components', 'Updates files in each repo', createComponents); gulp.task('create components', 'Updates files in each repo', createComponents);
/* Publish */
gulp.task('update distributions', 'Commits component updates from create to GitHub', updateDistributions);
gulp.task('update components', 'Commits component updates from create to GitHub', updateComponents); gulp.task('update components', 'Commits component updates from create to GitHub', updateComponents);
gulp.task('register repos', 'Registers all packages with NPM', registerRepos);
/* Tasks */
gulp.task('release', 'Stages changes in GitHub repos for all distributions', release);
gulp.task('publish', 'Publishes all releases (components, package)', publish);
gulp.task('register', 'Registers all packages with NPM', register);
}; };

1
tasks/config/admin/release.js

@ -61,6 +61,7 @@ module.exports = {
// components that get separate repositories for bower/npm // components that get separate repositories for bower/npm
components : [ components : [
'accordion', 'accordion',
'ad',
'api', 'api',
'breadcrumb', 'breadcrumb',
'button', 'button',

7
tasks/config/admin/templates/component-package.js

@ -1,10 +1,7 @@
var
where = 'client' // Adds files only to the client
;
Package.describe({ Package.describe({
name : 'semantic:ui-{component}', name : 'semantic:ui-{component}',
summary : 'Semantic UI - {Component} (official): Single component release of {component}',
summary : 'Semantic UI - {Component}: Single component release',
version : '{version}', version : '{version}',
git : 'git://github.com/Semantic-Org/UI-{Component}.git', git : 'git://github.com/Semantic-Org/UI-{Component}.git',
}); });
@ -13,5 +10,5 @@ Package.onUse(function(api) {
api.versionsFrom('1.0'); api.versionsFrom('1.0');
api.addFiles([ api.addFiles([
{files} {files}
], where);
], 'client');
}); });

35
tasks/config/admin/templates/css-package.js

@ -11,37 +11,10 @@ Package.describe({
Package.onUse(function(api) { Package.onUse(function(api) {
var
fs = require('fs'),
path = require('path'),
files,
walk
;
// recursive sync walk
walk = function(dir) {
var
dir = dir || __dirname,
list = fs.readdirSync(dir),
files = []
;
list.forEach(function(file) {
var
filePath = path.join(dir, file),
stat = fs.statSync(filePath)
;
if(stat && stat.isDirectory() && file !== 'node_modules') {
files = files.concat(walk(filePath));
}
else {
files.push(filePath);
}
})
return files
}
files = walk();
api.versionsFrom('1.0'); api.versionsFrom('1.0');
api.addFiles(files, 'clent');
api.addFiles([
{files}
], 'client');
}); });

36
tasks/config/admin/templates/less-package.js

@ -11,37 +11,11 @@ Package.describe({
Package.onUse(function(api) { Package.onUse(function(api) {
var
fs = require('fs'),
path = require('path'),
files,
walk
;
// recursive sync walk
walk = function(dir) {
var
dir = dir || __dirname,
list = fs.readdirSync(dir),
files = []
;
list.forEach(function(file) {
var
filePath = path.join(dir, file),
stat = fs.statSync(filePath)
;
if(stat && stat.isDirectory() && file !== 'node_modules') {
files = files.concat(walk(filePath));
}
else {
files.push(filePath);
}
})
return files
}
files = walk();
api.versionsFrom('1.0'); api.versionsFrom('1.0');
api.addFiles(files, 'clent');
api.use('less', 'client');
api.addFiles([
{files}
], 'client');
}); });

2
tasks/watch.js

@ -59,7 +59,7 @@ module.exports = function(callback) {
// check for right-to-left language // check for right-to-left language
if(config.rtl === true || config.rtl === 'Yes') { if(config.rtl === true || config.rtl === 'Yes') {
gulp.start('watch rtl');
gulp.start('watch-rtl');
return; return;
} }

Loading…
Cancel
Save