appmake 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/appmake.rb +44 -5
- metadata +1 -1
data/lib/appmake.rb
CHANGED
@@ -13,20 +13,47 @@ class Appmake
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.init
|
16
|
-
|
16
|
+
unless Dir.exists? "css"
|
17
|
+
puts "=> mkdir /css"
|
18
|
+
FileUtils.mkdir "css"
|
19
|
+
end
|
20
|
+
|
21
|
+
puts "=> touch /css/main.scss"
|
17
22
|
FileUtils.touch "css/main.scss"
|
18
|
-
|
23
|
+
|
24
|
+
unless Dir.exists? "js"
|
25
|
+
puts "=> mkdir /js"
|
26
|
+
FileUtils.mkdir "js"
|
27
|
+
end
|
28
|
+
|
29
|
+
puts "=> touch /js/main.js"
|
19
30
|
FileUtils.touch "js/main.js"
|
31
|
+
|
32
|
+
puts "=> create /js/compile_templates.js"
|
20
33
|
f = File.new("js/compile_templates.js", "w+")
|
21
34
|
f.puts(COMPILE_TEMPLATES_JS)
|
22
35
|
f.close
|
23
|
-
|
36
|
+
|
37
|
+
puts "=> create /js/doT.js"
|
38
|
+
f = File.new("js/doT.js", "w+")
|
39
|
+
f.puts(DOTJS_JS)
|
40
|
+
f.close
|
41
|
+
|
42
|
+
unless Dir.exists? "tpl"
|
43
|
+
puts "mkdir /tpl"
|
44
|
+
FileUtils.mkdir "tpl"
|
45
|
+
end
|
46
|
+
|
47
|
+
puts "=> create /index.html"
|
48
|
+
f = File.new("index.html", "w+")
|
49
|
+
f.puts(INDEX_HTML)
|
50
|
+
f.close
|
24
51
|
end
|
25
52
|
|
26
53
|
def self.watch
|
27
54
|
tpl_callback = Proc.new do |modified, added, removed|
|
28
55
|
puts "=> rebuilding TPL"
|
29
|
-
system("node
|
56
|
+
system("node js/compile_templates.js")
|
30
57
|
end
|
31
58
|
|
32
59
|
tpl_listener = Listen.to "tpl", :filter => /\.html$/
|
@@ -118,7 +145,6 @@ function buildModule() {
|
|
118
145
|
|
119
146
|
return ['module.exports = {', content.join(','), '};'].join('').replace(/(\n|\r|\r\n)/, '');
|
120
147
|
}
|
121
|
-
|
122
148
|
EOS
|
123
149
|
|
124
150
|
DOTJS_JS = <<EOS
|
@@ -257,5 +283,18 @@ DOTJS_JS = <<EOS
|
|
257
283
|
return doT.template(tmpl, null, def);
|
258
284
|
};
|
259
285
|
}());
|
286
|
+
EOS
|
260
287
|
|
288
|
+
INDEX_HTML = <<EOS
|
289
|
+
<!doctype>
|
290
|
+
<html>
|
291
|
+
<head>
|
292
|
+
<title></title>
|
293
|
+
<meta http=equiv="Content-Type" content="text/html; charset=UTF-8">
|
294
|
+
<link rel="stylesheet" type="text/css" href="css/app.css">
|
295
|
+
</head>
|
296
|
+
<body>
|
297
|
+
<script type="text/javascript" src="js/app.js"></script>
|
298
|
+
</body>
|
299
|
+
</html>
|
261
300
|
EOS
|