Skip to content

Commit

Permalink
Rename Release -> JqueryUi
Browse files Browse the repository at this point in the history
- also rename release -> jquery-ui;
  • Loading branch information
rxaviers committed Jun 17, 2013
1 parent ffaeb8b commit c63b363
Show file tree
Hide file tree
Showing 13 changed files with 162 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
app/resources/download.all.min.js
app/resources/themeroller.all.min.js
app/src/template
jquery-ui
log/downloads.log
node_modules
release
tmp
32 changes: 16 additions & 16 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,20 +312,20 @@ function copy( ref ) {
rimraf = require( "rimraf" ),
version = grunt.file.readJSON( "tmp/jquery-ui/package.json" ).version,
dir = require( "path" ).basename( "tmp/jquery-ui/dist/jquery-ui-" + version );
grunt.file.mkdir( "release" );
grunt.file.mkdir( "jquery-ui" );
async.series([
function( callback ) {
if ( fs.existsSync( "release/" + ref ) ) {
grunt.log.writeln( "Cleaning up existing release/" + ref );
rimraf( "release/" + ref, log( callback, "Cleaned", "Error cleaning" ) );
if ( fs.existsSync( "jquery-ui/" + ref ) ) {
grunt.log.writeln( "Cleaning up existing jquery-ui/" + ref );
rimraf( "jquery-ui/" + ref, log( callback, "Cleaned", "Error cleaning" ) );
} else {
callback();
}
},
function( callback ) {
var from = "tmp/jquery-ui",
to = "release/" + ref;
grunt.log.writeln( "Copying jQuery UI " + version + " over to release/" + ref );
to = "jquery-ui/" + ref;
grunt.log.writeln( "Copying jQuery UI " + version + " over to jquery-ui/" + ref );
try {
grunt.file.recurse( from, function( filepath ) {
grunt.file.copy( filepath, filepath.replace( new RegExp( "^" + from ), to ) );
Expand All @@ -338,16 +338,16 @@ function copy( ref ) {
callback();
},
function( callback ) {
grunt.log.writeln( "Copying API documentation for jQuery UI over to release/" + ref + "/docs/" );
grunt.log.writeln( "Copying API documentation for jQuery UI over to jquery-ui/" + ref + "/docs/" );
grunt.file.expand({ filter: "isFile" }, docs + "/**" ).forEach(function( file ) {
grunt.file.copy( file, file.replace( docs, "release/" + ref + "/docs/" ));
grunt.file.copy( file, file.replace( docs, "jquery-ui/" + ref + "/docs/" ));
});
callback();
},
function() {
var removePath = ref + "/node_modules";
grunt.log.writeln( "Cleaning up copied jQuery UI" );
rimraf( "release/" + removePath, log( callback, "Removed release/" + removePath, "Error removing release/" + removePath ) );
rimraf( "jquery-ui/" + removePath, log( callback, "Removed jquery-ui/" + removePath, "Error removing jquery-ui/" + removePath ) );
}
]);
};
Expand All @@ -357,15 +357,15 @@ function buildPackages( folder, callback ) {
var Builder = require( "./lib/builder" ),
fs = require( "fs" ),
path = require( "path" ),
Release = require( "./lib/release" ),
JqueryUi = require( "./lib/jquery-ui" ),
ThemeRoller = require( "./lib/themeroller" );

async.forEachSeries( Release.all(), function( release, next ) {
var allComponents = release.components().map(function( component ) {
async.forEachSeries( JqueryUi.all(), function( jqueryUi, next ) {
var allComponents = jqueryUi.components().map(function( component ) {
return component.name;
}),
theme = new ThemeRoller({ version: release.pkg.version }),
builder = new Builder( release, allComponents, theme ),
theme = new ThemeRoller({ version: jqueryUi.pkg.version }),
builder = new Builder( jqueryUi, allComponents, theme ),
filename = path.join( folder, builder.filename() ),
stream;
grunt.log.ok( "Building \"" + filename + "\" with all components selected and base theme" );
Expand Down Expand Up @@ -413,9 +413,9 @@ grunt.registerTask( "mkdirs", "Create directories", function() {
}
});

grunt.registerTask( "prepare", [ "check-modules", "mkdirs", "prepare-release", "build-app" ] );
grunt.registerTask( "prepare", [ "check-modules", "mkdirs", "prepare-jquery-ui", "build-app" ] );

grunt.registerTask( "prepare-release", "Fetches and builds jQuery UI releases specified in config file", function() {
grunt.registerTask( "prepare-jquery-ui", "Fetches and builds jQuery UI releases specified in config file", function() {
var done = this.async();
async.series([
cloneOrFetch,
Expand Down
24 changes: 12 additions & 12 deletions download.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
var releases,
var jqueryUis,
_ = require( "underscore" ),
Builder = require( "./lib/builder" ),
fs = require( "fs" ),
Handlebars = require( "handlebars" ),
logger = require( "simple-log" ).init( "download.jqueryui.com" ),
querystring = require( "querystring" ),
Release = require( "./lib/release" ),
JqueryUi = require( "./lib/jquery-ui" ),
themeGallery = require( "./lib/themeroller.themegallery" ),
ThemeRoller = require( "./lib/themeroller" );

releases = Release.all();
jqueryUis = JqueryUi.all();

Handlebars.registerHelper( "isVersionChecked", function( release ) {
return Release.getStable().pkg.version === release.pkg.version ? " checked=\"checked\"" : "";
Handlebars.registerHelper( "isVersionChecked", function( jqueryUi ) {
return JqueryUi.getStable().pkg.version === jqueryUi.pkg.version ? " checked=\"checked\"" : "";
});

Handlebars.registerHelper( "join", function( array, sep, options ) {
Expand Down Expand Up @@ -45,25 +45,25 @@ Frontend.prototype = {
return indexTemplate({
baseVars: themeGallery[ 2 ].serializedVars,
components: JSON.stringify({
categories: Release.getStable().categories()
categories: JqueryUi.getStable().categories()
}),
host: this.host,
production: this.env.toLowerCase() === "production",
resources: this.resources,
releases: releases
jqueryUis: jqueryUis
});
},

components: function( params ) {
var data, release;
var data, jqueryUi;
if ( params.version ) {
release = Release.find( params.version );
jqueryUi = JqueryUi.find( params.version );
}
if ( release == null ) {
if ( jqueryUi == null ) {
logger.error( "Invalid input \"version\" = \"" + params.version + "\"" );
data = { error : "invalid version" };
} else {
data = { categories: release.categories() };
data = { categories: jqueryUi.categories() };
}
return jsonpTemplate({
callback: params.callback,
Expand All @@ -88,7 +88,7 @@ Frontend.prototype = {
version: fields.version
});
components = Object.keys( _.omit( fields, "scope", "theme", "theme-folder-name", "version" ) );
builder = new Builder( Release.find( fields.version ), components, theme, {
builder = new Builder( JqueryUi.find( fields.version ), components, theme, {
scope: fields.scope
});
response.setHeader( "Content-Type", "application/zip" );
Expand Down
4 changes: 2 additions & 2 deletions frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var _ = require( "underscore" ),
Download = require( "./download" ),
fs = require( "fs" ),
Handlebars = require( "handlebars" ),
Release = require( "./lib/release" ),
JqueryUi = require( "./lib/jquery-ui" ),
ThemeRoller = require( "./themeroller" );

var errorTemplate = Handlebars.compile( fs.readFileSync( __dirname + "/template/500.html", "utf-8" ) ),
Expand All @@ -20,7 +20,7 @@ Frontend.defaults = {
host: "",
resources: {
jqueryVersion: config.jquery,
jqueryuiVersion: Release.getStable().pkg.version
jqueryuiVersion: JqueryUi.getStable().pkg.version
}
};

Expand Down
42 changes: 21 additions & 21 deletions lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ function stripThemeImport( src ) {
/**
* Builder
*/
function Builder( release, components, theme, options ) {
function Builder( jqueryUi, components, theme, options ) {
var cssHeader, existingCss, header,
allComponents = release.components().map(function( element ) {
allComponents = jqueryUi.components().map(function( element ) {
return element.name;
}),
files = release.files(),
files = jqueryUi.files(),
invalidComponent = function( element ) {
return allComponents.indexOf( element ) < 0;
};
Expand All @@ -73,17 +73,17 @@ function Builder( release, components, theme, options ) {
throw new Error( "Builder: invalid components [ \"" + components.filter( invalidComponent ).join( "\", \"" ) + "\" ]" );
}

this.basedir = "jquery-ui-" + release.pkg.version + options.bundleSuffix;
this.basedir = "jquery-ui-" + jqueryUi.pkg.version + options.bundleSuffix;
this.components = components;
this.release = release;
this.jqueryUi = jqueryUi;
this.theme = theme;
this.ui = this.components.reduce(function( sum, component ) {
sum[ component ] = true;
return sum;
}, {});
this.ui.version = release.pkg.version;
this.ui.version = jqueryUi.pkg.version;

header = banner( release.pkg, this.components.map(function( component ) {
header = banner( jqueryUi.pkg, this.components.map(function( component ) {
return "jquery.ui." + component + ".js";
}) ) + "\n\n";
this.full = this.components.reduce(function( sum, component ) {
Expand All @@ -96,7 +96,7 @@ function Builder( release, components, theme, options ) {
existingCss = function( component ) {
return files.data[ "themes/base/jquery.ui." + component + ".css" ] !== undefined;
};
cssHeader = banner( release.pkg, this.components.filter( existingCss ).map(function( component ) {
cssHeader = banner( jqueryUi.pkg, this.components.filter( existingCss ).map(function( component ) {
return "jquery.ui." + component + ".css";
}) ) + "\n\n";
this.cssFull = this.components.reduce(function( sum, component ) {
Expand All @@ -113,11 +113,11 @@ function Builder( release, components, theme, options ) {
}

// Cache all releases (sync)
Builder.cacheReleases = function() {
var Release = require( "./release" );
Release.all().forEach(function( release ) {
release.files();
logger.log( "Release \"" + release.pkg.version + "\" files cached" );
Builder.cacheJqueryUi = function() {
var JqueryUi = require( "./jquery-ui" );
JqueryUi.all().forEach(function( jqueryUi ) {
jqueryUi.files();
logger.log( "JqueryUi \"" + jqueryUi.pkg.version + "\" files cached" );
});
};

Expand Down Expand Up @@ -192,11 +192,11 @@ Builder.prototype = {
components = this.components,
cssFull = this.cssFull,
cssMin = this.cssMin,
files = this.release.files(),
files = this.jqueryUi.files(),
full = this.full,
min = this.min,
options = this.options,
release = this.release,
jqueryUi = this.jqueryUi,
selectedRe = new RegExp( components.join( "|" ) ),
selected = function( filepath ) {
return components.length && selectedRe.test( filepath );
Expand All @@ -216,7 +216,7 @@ Builder.prototype = {

// Full
[ "development-bundle/ui/jquery-ui" + options.bundleSuffix + ".js",
"js/jquery-ui-" + release.pkg.version + options.bundleSuffix + ".js"
"js/jquery-ui-" + jqueryUi.pkg.version + options.bundleSuffix + ".js"
].forEach(function( dst ) {
build.push({
path: [ basedir, dst ].join( "/" ),
Expand All @@ -227,7 +227,7 @@ Builder.prototype = {
path: [ basedir, "development-bundle/themes/base/jquery-ui.css" ].join( "/" ),
data: cssFull + "\n" + stripBanner( baseThemeCssFull )
});
[ "css/" + theme.folderName() + "/jquery-ui-" + release.pkg.version + options.bundleSuffix + ".css",
[ "css/" + theme.folderName() + "/jquery-ui-" + jqueryUi.pkg.version + options.bundleSuffix + ".css",
"development-bundle/themes/" + theme.folderName() + "/jquery-ui.css"
].forEach(function( dst ) {
build.push({
Expand All @@ -238,7 +238,7 @@ Builder.prototype = {

// Min
[ "development-bundle/ui/minified/jquery-ui" + options.bundleSuffix + ".min.js",
"js/jquery-ui-" + release.pkg.version + options.bundleSuffix + ".min.js"
"js/jquery-ui-" + jqueryUi.pkg.version + options.bundleSuffix + ".min.js"
].forEach(function( dst ) {
build.push({
path: [ basedir, dst ].join( "/" ),
Expand All @@ -249,7 +249,7 @@ Builder.prototype = {
path: [ basedir, "development-bundle/themes/base/minified/jquery-ui.min.css" ].join( "/" ),
data: cssMin + baseThemeCssMin
});
[ "css/" + theme.folderName() + "/jquery-ui-" + release.pkg.version + options.bundleSuffix + ".min.css",
[ "css/" + theme.folderName() + "/jquery-ui-" + jqueryUi.pkg.version + options.bundleSuffix + ".min.css",
"development-bundle/themes/" + theme.folderName() + "/minified/jquery-ui.min.css"
].forEach(function( dst ) {
build.push({
Expand Down Expand Up @@ -303,7 +303,7 @@ Builder.prototype = {
});
build.push({
path: [ basedir, "development-bundle/themes/" + theme.folderName() + "/minified/jquery.ui.theme.min.css" ].join( "/" ),
data: banner( release.pkg, [ "jquery.ui.theme.css" ] ) + "\n" + sqwish.minify( stripBanner( theme.css() ) )
data: banner( jqueryUi.pkg, [ "jquery.ui.theme.css" ] ) + "\n" + sqwish.minify( stripBanner( theme.css() ) )
});
}

Expand Down Expand Up @@ -382,7 +382,7 @@ Builder.prototype = {
build_time: new Date() - start,
components: that.components,
theme_name: that.theme.name,
version: that.release.pkg.version
version: that.jqueryUi.pkg.version
}) );
callback( null, "All good!" );
});
Expand Down
Loading

0 comments on commit c63b363

Please sign in to comment.