Skip to content

Commit

Permalink
merging
Browse files Browse the repository at this point in the history
  • Loading branch information
Pinhook committed Oct 6, 2010
2 parents 7be658f + ec92d42 commit f6755da
Show file tree
Hide file tree
Showing 41 changed files with 25,530 additions and 12,813 deletions.
6 changes: 1 addition & 5 deletions build/apps/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ steal(function( steal ) {
// recursively goes through steals and their dependencies.
var addDependencies = function( steel, files, app ) {
//add self to files
if ( !files[steel.path] ) {
if (!files[steel.path] ) {

var source = readFile(steel.path);
if ( steel.type && steal.build.types[steel.type] ) {
Expand All @@ -21,7 +21,6 @@ steal(function( steal ) {
source = "" + steal.build.compressor(source, true);
//need to convert to other types.


files[steel.path] = {
path: steel.path,
apps: [],
Expand Down Expand Up @@ -64,7 +63,6 @@ steal(function( steal ) {
},
getMostShared = function( files ) {
var shared = []; // count

for ( var fileName in files ) {
var file = files[fileName];
if ( file.packaged ) {
Expand All @@ -75,7 +73,6 @@ steal(function( steal ) {
}
var level = shared[file.apps.length]; //how many apps it is shared in (5?)


var appsName = file.apps.sort().join();


Expand Down Expand Up @@ -105,7 +102,6 @@ steal(function( steal ) {
}
}
//mark files

for ( var i = 0; i < most.files.length; i++ ) {
var f = most.files[i];
f.packaged = true;
Expand Down
5 changes: 2 additions & 3 deletions build/apps/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// load("steal/build/apps/test.js")

_args = ['cookbook','phui/combobox','phui/modal'];
load("steal/buildjs");
_args = ['cookbook', 'phui/combobox', 'phui/modal'];
load("steal/buildjs");
30 changes: 13 additions & 17 deletions build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ steal(function( steal ) {
* </table>
*/
steal.build = function( url, options ) {

//convert options (which might be an array) into an object
options = steal.opts(options || {}, {
//compress everything, regardless of what you find
Expand All @@ -104,10 +104,8 @@ steal(function( steal ) {
});

// to is the folder packages will be put in
options.to = options.to || (url.match(/https?:\/\//) ?
"" :
url.substr(0, url.lastIndexOf('/')));

options.to = options.to || (url.match(/https?:\/\//) ? "" : url.substr(0, url.lastIndexOf('/')));

// make sure to ends with /
if ( options.to.match(/\\$/) === null && options.to !== '' ) {
options.to += "/";
Expand All @@ -116,17 +114,16 @@ steal(function( steal ) {
print("Building to " + options.to);

var opener = steal.build.open(url);

// iterates through the types of builders. For now
// there are just scripts and styles builders
for ( var builder in steal.build.builders ) {
steal.build.builders[builder](opener, options);
}
};

// a place for the builders
steal.build.builders = {}; //builders

// a helper function that gets the src of a script and returns
// the content for that script
var loadScriptText = function( src ) {
Expand Down Expand Up @@ -182,12 +179,12 @@ steal(function( steal ) {
return jQuery.View.registerScript("micro", id, text);
},
'text/jaml': function( script ) {
var text = script.text || loadScriptText(script.src),
var text = script.text || loadScriptText(script.src),
id = script.id || script.getAttribute("id");
return jQuery.View.registerScript("jaml", id, text);
},
'text/tmpl': function( script ) {
var text = script.text || loadScriptText(script.src),
var text = script.text || loadScriptText(script.src),
id = script.id || script.getAttribute("id");
return jQuery.View.registerScript("tmpl", id, text);
},
Expand All @@ -205,19 +202,18 @@ steal(function( steal ) {
* the content for a certain tag slightly easier.
*
*/
steal.build.open = function( url , stealData ) {
steal.build.open = function( url, stealData ) {
var scripts = [],

// save and remove the old steal
// save and remove the old steal
oldSteal = window.steal || steal,
newSteal;
delete window.steal;
if(stealData){
if ( stealData ) {
window.steal = stealData;
}
// get envjs
load('steal/rhino/env.js'); //reload every time

// open the url
Envjs(url, {
scriptTypes: {
Expand All @@ -238,13 +234,13 @@ steal(function( steal ) {
scripts.push(script);
}
});

// set back steal
newSteal = window.steal;
window.steal = oldSteal;
window.steal._steal = newSteal;


// check if newSteal added any build types (used to convert less to css for example).
if(newSteal && newSteal.build && newSteal.build.types){
for ( var buildType in newSteal.build.types ) {
Expand Down
112 changes: 55 additions & 57 deletions build/pluginify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,69 @@
// js steal\scripts\pluginify.js jquery/controller
// js steal\scripts\pluginify.js jquery/event/drag -exclude jquery/lang/vector/vector.js jquery/event/livehack/livehack.js
// load("steal/rhino/steal.js");
load("steal/rhino/steal.js");
steal.plugins('steal/build', 'steal/build/scripts', function() {

/**
*
* @param {Object} plugin
* @param {Object} opts
*/
steal.pluginify = function( plugin, opts ) {

load("steal/rhino/steal.js");
steal.plugins('steal/build','steal/build/scripts',function(){

/**
*
* @param {Object} plugin
* @param {Object} opts
*/
steal.pluginify = function(plugin, opts){
var jq = true,
opts = steal.opts(opts, {
"destination": 1,
"exclude": -1,
"nojquery": 0,
"packagejquery": 0
}),
destination = opts.destination || plugin + ".js";

opts.exclude = !opts.exclude ? [] : (steal.isArray(opts.exclude) ? opts.exclude : [opts.exclude]);

var jq = true;
opts = steal.opts(opts, {
"destination": 1,
"exclude": -1,
"nojquery": 0,
"packagejquery": 0
}), destination = opts.destination || plugin + ".js";

opts.exclude = !opts.exclude ? [] :
(steal.isArray(opts.exclude) ? opts.exclude : [opts.exclude]);
if ( opts.nojquery ) {
jq = false;
}

if(opts.nojquery){
jq = false
}
if(!opts.packagejquery){
opts.exclude.push('jquery.js')
}
rhinoLoader = {
callback: function(s){
s.plugin(plugin)
if (!opts.packagejquery ) {
opts.exclude.push('jquery.js');
}
}

steal.win().build_in_progress = true;

var pageSteal = steal.build.open("steal/rhino/empty.html").steal,
out = [],
str,
i,
inExclude = function(path){
for (var i = 0; i < opts.exclude.length; i++) {
if (opts.exclude[i].indexOf(path) > -1) {
return true
}

rhinoLoader = {
callback: function( s ) {
s.plugin(plugin);
}
return false;
};

for (i = 0; i < pageSteal.total.length; i++) {
if (typeof pageSteal.total[i].func == "function") {
filePath = pageSteal.total[i].path;
if (!inExclude(filePath)) {
file = readFile(filePath);
match = file.match(/\.then\(\s*function\s*\([^\)]*\)\s*\{([\s\S]*)\}\s*\)\s*;*\s*/im)
str = "// " + filePath + "\n\n"
str += "(function($){\n" + steal.build.builders.scripts.clean(match[1]) + "\n})(" + (jq ? "jQuery" : "") + ");\n\n"
out.push(str);
steal.win().build_in_progress = true;

var pageSteal = steal.build.open("steal/rhino/empty.html").steal,
out = [],
str, i, inExclude = function( path ) {
for ( var i = 0; i < opts.exclude.length; i++ ) {
if ( opts.exclude[i].indexOf(path) > -1 ) {
return true;
}
}
return false;
};

for ( i = 0; i < pageSteal.total.length; i++ ) {
if ( typeof pageSteal.total[i].func == "function" ) {
filePath = pageSteal.total[i].path;
if (!inExclude(filePath) ) {
file = readFile(filePath);
match = file.match(/\.then\(\s*function\s*\([^\)]*\)\s*\{([\s\S]*)\}\s*\)\s*;*\s*/im);
str = "// " + filePath + "\n\n";
str += "(function($){\n" + steal.build.builders.scripts.clean(match[1]) + "\n})(" + (jq ? "jQuery" : "") + ");\n\n";
out.push(str);
}
}
}
}
print("saving to " + destination);
new steal.File(destination).save(out.join(""));
//print("pluginified " + plugin)
}
print("saving to " + destination);
new steal.File(destination).save(out.join(""));
//print("pluginified " + plugin)
};

})
});
18 changes: 7 additions & 11 deletions build/styles/cssmin.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
steal(function(steal){
var comments = /\/\*.*?\*\//g,
steal(function( steal ) {
var comments = /\/\*.*?\*\//g,
newLines = /\n*/g,
space = /[ ]+/g,
spaceChars = /\s?([;:{},+>])\s?/g,
lastSemi = /;}/g;
steal.cssMin = function(css){


steal.cssMin = function( css ) {
//remove comments
return css .replace(comments,"")
.replace(newLines,"")
.replace(space," ")
.replace(spaceChars,'$1')
.replace(lastSemi,'}')
return css.replace(comments, "").replace(newLines, "").replace(space, " ").replace(spaceChars, '$1').replace(lastSemi, '}')
}
})
})
Loading

0 comments on commit f6755da

Please sign in to comment.