appmake 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ require "listen"
2
+
3
+ module Appmake
4
+ module Listeners
5
+ class Coffee
6
+ include Thor::Shell
7
+
8
+ def self.listen(block = true)
9
+ callback = Proc.new do |modified, added, removed|
10
+ self.compile()
11
+ end
12
+
13
+ listener = Listen.to "coffee", :filter => /\.coffee$/
14
+ listener.change(&callback)
15
+ listener.start(block)
16
+ end
17
+
18
+ def self.compile
19
+ Basic.new.say_status :compile, "CoffeScript"
20
+
21
+ Dir.glob "coffee/*" do |f|
22
+ name = f.split("/").last
23
+ new_name = name.gsub "coffee", "js"
24
+
25
+ system "./node_modules/.bin/coffee -c coffee/#{name} coffee/#{new_name}"
26
+
27
+ if name[0] == name[0].upcase
28
+ system "./node_modules/.bin/webmake coffee/#{name} public/js/#{name}"
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Appmake
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/appmake.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "thor"
2
2
  require "appmake/version"
3
3
  require "appmake/listeners/css"
4
+ require "appmake/listeners/coffee"
4
5
  require "appmake/listeners/js"
5
6
  require "appmake/listeners/tpl"
6
7
 
@@ -22,6 +23,8 @@ module Appmake
22
23
  template "templates/css/App.scss.tt", "css/App.scss"
23
24
  template "templates/css/body.scss.tt", "css/body.scss"
24
25
 
26
+ empty_directory "coffee"
27
+
25
28
  empty_directory "js"
26
29
  template "templates/js/App.js.tt", "js/App.js"
27
30
 
@@ -40,6 +43,7 @@ module Appmake
40
43
  desc "watch", "watch for files to compile"
41
44
  def watch
42
45
  Listeners::Css.listen(false)
46
+ Listeners::Coffee.listen(false)
43
47
  Listeners::Tpl.listen(false)
44
48
  Listeners::Js.listen(true)
45
49
  end
@@ -5,7 +5,8 @@
5
5
  "preferGlobal": "true",
6
6
  "dependencies": {
7
7
  "webmake": ">= 0.3.14",
8
- "dot-module": ">= 0.0.1"
8
+ "dot-module": ">= 0.0.1",
9
+ "coffee-script": ">= 1.4.0"
9
10
  },
10
11
  "scripts": {
11
12
  "tpl": "dot-module -d tpl/ -o js/templates.js",
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.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -92,6 +92,7 @@ files:
92
92
  - appmake.gemspec
93
93
  - bin/appmake
94
94
  - lib/appmake.rb
95
+ - lib/appmake/listeners/coffee.rb
95
96
  - lib/appmake/listeners/css.rb
96
97
  - lib/appmake/listeners/js.rb
97
98
  - lib/appmake/listeners/tpl.rb