asset_watcher 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 yamada996
1
+ Copyright (c) 2011 Tomohiro Yamada
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -16,6 +16,6 @@ and execute rake task.
16
16
 
17
17
  ## Copyright
18
18
 
19
- Copyright (c) 2011 yamada996. See LICENSE.txt for
19
+ Copyright (c) 2011 Tomohiro Yamada. See LICENSE.txt for
20
20
  further details.
21
21
 
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |gem|
18
18
  gem.summary = %Q{watch and auto-compile .coffee and .haml files}
19
19
  gem.description = %Q{watch and auto-compile .coffee and .haml files. Need node.js and coffee-script to compile .coffee file and haml to compile .haml.}
20
20
  gem.email = "t.yamada.996@gmail.com"
21
- gem.authors = ["yamada996"]
21
+ gem.authors = ["Tomohiro Yamada"]
22
22
  # Include your dependencies below. Runtime dependencies are required when using your gem,
23
23
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
24
  # gem.add_runtime_dependency 'jabber4r', '> 0.1'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.1.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{asset_watcher}
8
- s.version = "0.0.0"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["yamada996"]
12
- s.date = %q{2011-02-05}
11
+ s.authors = ["Tomohiro Yamada"]
12
+ s.date = %q{2011-01-21}
13
13
  s.description = %q{watch and auto-compile .coffee and .haml files. Need node.js and coffee-script to compile .coffee file and haml to compile .haml.}
14
14
  s.email = %q{t.yamada.996@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -3,7 +3,6 @@ require "coffee-haml-filter"
3
3
  require "active_support/core_ext/object/blank"
4
4
  require "active_support/core_ext/hash/keys"
5
5
  require "yaml"
6
- require "open3"
7
6
 
8
7
  class AssetWatcher
9
8
  @@yaml_path = "config/asset_watch.yml"
@@ -26,22 +25,18 @@ class AssetWatcher
26
25
  current_dir = `pwd`.strip
27
26
  default_config = {
28
27
  :src_dir => current_dir + "/src",
29
- :dest_dir => current_dir,
28
+ :dest_dir => current_dir + "/public",
30
29
  }
31
- _config = default_config.dup
32
-
33
- _config[:src_dir] = ARGV[1] if ARGV.count >= 2
34
- _config[:dest_dir] = ARGV[2] if ARGV.count >= 3
35
30
 
36
31
  # configuration file
37
32
  yaml_path = current_dir + '/' + @@yaml_path
38
33
  if File.exist? yaml_path
39
34
  yaml_config = YAML.load_file yaml_path
40
35
  yaml_config.symbolize_keys!
41
- _config.merge! yaml_config
36
+ default_config.merge! yaml_config
42
37
  end
43
38
 
44
- @config = _config.merge config
39
+ @config = default_config.merge config
45
40
  end
46
41
 
47
42
  def target_files
@@ -62,7 +57,6 @@ class AssetWatcher
62
57
  case $1
63
58
  when 'coffee' then compile_coffee src_path
64
59
  when 'haml' then compile_haml src_path
65
- else false
66
60
  end
67
61
  else
68
62
  false
@@ -79,16 +73,8 @@ class AssetWatcher
79
73
  raise "'coffee' command is not found!"
80
74
  end
81
75
 
82
- command = "coffee -b -o #{dest_dir} #{src_path}"
83
- stdin, stdout, stderr = *Open3.popen3(command)
84
- stdout.each { |line| puts line }
85
- error = stderr.read
86
-
87
- unless result = error.empty?
88
- puts error
89
- puts "fail to compile '#{src_path}'"
90
- end
91
- return result
76
+ `coffee -b -o #{dest_dir} #{src_path}`
77
+ true
92
78
  end
93
79
 
94
80
  def compile_haml src_path
@@ -10,12 +10,4 @@ namespace :asset do
10
10
  watcher.compile src_path
11
11
  end
12
12
  end
13
-
14
- desc "Compile .coffee and .haml file when it changes"
15
- task :compile do
16
- watcher = AssetWatcher.new
17
- watcher.target_files.each do |src_path|
18
- watcher.compile src_path
19
- end
20
- end
21
13
  end
@@ -6,7 +6,7 @@ describe AssetWatcher do
6
6
 
7
7
  @config = {
8
8
  :src_dir => @target_dir + "/src",
9
- :dest_dir => @target_dir,
9
+ :dest_dir => @target_dir + "/public",
10
10
  }
11
11
 
12
12
  FileUtils.makedirs @config[:src_dir]
@@ -51,7 +51,7 @@ class CoffeeKlass
51
51
  current_dir = `pwd`.strip
52
52
  @default_config = {
53
53
  :src_dir => current_dir + "/src",
54
- :dest_dir => current_dir,
54
+ :dest_dir => current_dir + "/public",
55
55
  }
56
56
  end
57
57
 
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_watcher
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 0.0.0
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
- - yamada996
13
+ - Tomohiro Yamada
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-05 00:00:00 +09:00
18
+ date: 2011-01-21 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency