appmake 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/appmake.rb +44 -5
  2. 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
- FileUtils.mkdir "css"
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
- FileUtils.mkdir "js"
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
- FileUtils.mkdir "tpl"
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 -e \"#{COMPILE_TEMPLATES_JS}\"")
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appmake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: