forked from azproduction/scalable-js-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewmodule
executable file
·52 lines (46 loc) · 945 Bytes
/
newmodule
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
name=$1
module_template="
function $name(sandboxed, exports, module) {\n
\t\"use strict\";\n
\n
\treturn {\n
\t\tinit: function(sandbox) {\n
\n
\t\t},\n
\n
\t\tdestroy: function() {\n
\n
\t\t}\n
\t};\n
}"
descriptor_template="
{\n
\t\"name\": \"$name\",\n
\n
\t\"acl\": {\n
\t\t\"listen\": [],\n
\t\t\"trigger\": [],\n
\t\t\"hook\": []\n
\t},\n
\n
\t\"resources\": { }\n
}
"
locale_template="
{\n
\t\"some_localized_text_stub\": {\n
\t\t\"en\": \"this is an english text stub, remove it\",\n
\t\t\"ru\": \"пример локализованной строки\"\n
\t}\n
}
"
echo -e $module_template > app/modules/$name.js
echo -e $descriptor_template > app/descriptors/$name.json
echo -e $locale_template > app/locales/$name.json
touch app/templates/$name.html
echo -e "Created:
app/modules/$name.js
app/descriptors/$name.json
app/templates/$name.html
app/locales/$name.json"