forked from stealjs/steal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new install is possible for specific files/folders
- Loading branch information
Pinhook
committed
Mar 29, 2011
1 parent
5df5805
commit e075f14
Showing
6 changed files
with
253 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// a dummy version of steal that can run on a file and extract data from it ... | ||
steal(function(s){ | ||
var makeFunc = function(name){ | ||
return function(){ | ||
for(var i =0; i < arguments.length; i++){ | ||
this["_"+name].push(arguments[i]) | ||
} | ||
|
||
return this; | ||
} | ||
} | ||
|
||
s.dummy = function(code){ | ||
var args = []; | ||
var dummy = function(){ | ||
args.push(arguments); | ||
} | ||
|
||
for(var prop in s){ | ||
if(typeof s[prop] == 'function'){ | ||
dummy["_"+prop] = [] | ||
dummy[prop] = makeFunc(prop); | ||
}else { | ||
dummy[prop] = {}; | ||
} | ||
} | ||
//additional funcs (for 3.0) | ||
var funcs = ['plugins','views','models','controllers','css','less']; | ||
for(var i =0; i < funcs.length; i++){ | ||
var prop = funcs[i]; | ||
|
||
dummy["_"+prop] = [] | ||
dummy[prop] = makeFunc(prop); | ||
} | ||
|
||
//save current steal | ||
var curSteal = steal; | ||
//replace ... | ||
|
||
steal = dummy; | ||
|
||
eval(code) | ||
|
||
steal = curSteal; | ||
for(var prop in dummy){ | ||
if(prop.substr(0,1) === "_"){ | ||
dummy[prop.substr(1)] = dummy[prop]; | ||
} | ||
} | ||
return dummy; | ||
} | ||
|
||
|
||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
steal.plugins("foo/bar", | ||
/** | ||
* Comment | ||
* @param {Object} "something/else" | ||
*/ | ||
"abc/def").then(function(){ | ||
|
||
}).plugins("something/else"); | ||
|
||
steal.plugins("one/two"); |