forked from jupiterjs/jquerymx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller
35 lines (28 loc) · 971 Bytes
/
controller
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if (_args.length < 1) {
print("USAGE : steal/js steal/generate/controller Company.Widget")
print("EX : steal/js steal/generate/controller Company.WidgetName");
print(" > company/widget_name/widget_name.js")
print();
quit();
}
load('steal/rhino/steal.js');
steal( '//steal/generate/generate',
'//steal/generate/system',
function(steal){
var upper = function(parts){
for(var i =0; i < parts.length; i++){
parts[i] = parts[i].charAt(0).toUpperCase()+parts[i].substr(1)
}
return parts
}
if(_args[0].charAt(0) !== _args[0].charAt(0).toUpperCase()){
var caps = upper( _args[0].split(/_|-/) ).join(''),
name = upper(caps.split("/")).join('.');
print(" Creating "+name);
_args[0] = name;
}
var md = steal.generate.convert(_args[0]),
path = _args[0].toLowerCase().replace('.',"/");
md.path_to_steal = new steal.File(path).pathToRoot()
steal.generate("jquery/generate/templates/controller",md.path+"/"+md.underscore,md)
});