hamler 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Hamler
2
2
 
3
- one-line haml/sass/scss compiler
3
+ one-line haml/s[ac]ss/coffeescript compiler
4
4
 
5
- simply compiles each haml/sass/scss files, and output coresponding html/css files in place, or to another directory.
5
+ simply compiles each haml/s[ac]ss/coffeescript files, and output coresponding html/css/js files in place, or to another directory.
6
6
 
7
- I would recommend `nanoc` for a more functional (non-1-on-1 assocation of files, layouts, etc) content compiler.
7
+ I would recommend `nanoc` for a more functional (non-1-on-1-assocation of files, layouts, etc) content compiler.
8
8
 
9
9
  ## Installation
10
10
 
@@ -31,6 +31,8 @@ invoke with `-i` and `-o` gives
31
31
  create /tmp/subdir1/a_haml_file.html
32
32
  compile test/subdir2/b.sass
33
33
  create /tmp/subdir2/b.css
34
+ compile test/subdir2/c.coffee
35
+ create /tmp/subdir2/c.js
34
36
 
35
37
  `-p` purge those files. empty folders remains
36
38
 
data/hamler.gemspec CHANGED
@@ -20,4 +20,6 @@ Gem::Specification.new do |gem|
20
20
  gem.add_runtime_dependency "thor"
21
21
  gem.add_runtime_dependency "haml"
22
22
  gem.add_runtime_dependency "sass"
23
+ gem.add_runtime_dependency "coffee-script"
24
+ gem.add_runtime_dependency "execjs"
23
25
  end
data/lib/hamler.rb CHANGED
@@ -37,18 +37,15 @@ module Hamler
37
37
  when ".haml"
38
38
  ::Haml::Engine.new( source ).render
39
39
  when '.sass'
40
- ::Sass::Engine.new( source, :syntax => :sass).render
40
+ ::Sass::Engine.new( source, :syntax => :sass, :quiet => true).render
41
41
  when '.scss'
42
- ::Sass::Engine.new( source, :syntax => :scss).render
42
+ ::Sass::Engine.new( source, :syntax => :scss, :quiet => true).render
43
+ when '.coffee'
44
+ ::CoffeeScript.compile source
43
45
  end
44
46
  template @@template, new_name
45
47
  end
46
48
 
47
- def copy filename,ext,main
48
- new_name = new_name( filename )
49
- #copy_file filename, new_name
50
- end
51
-
52
49
  def input_folder
53
50
  @input_folder ||= Pathname.new options[:input_folder]
54
51
  end
@@ -58,8 +55,8 @@ module Hamler
58
55
  end
59
56
 
60
57
  def handle file
61
- return unless file.file? and ['.haml','.sass','.scss'].include? file.extname
62
58
  new_file = new_name file
59
+ return unless new_file
63
60
  if options[ :dry_run ] and options[ :purge ]
64
61
  say_status :would_remove, new_file
65
62
  elsif options[ :purge ]
@@ -76,7 +73,7 @@ module Hamler
76
73
  def new_name old_name
77
74
  output_folder + old_name.relative_path_from( input_folder ).sub_ext( new_ext old_name )
78
75
  rescue
79
- output_folder + old_name.relative_path_from( input_folder )
76
+ nil
80
77
  end
81
78
 
82
79
  def new_ext old_name
@@ -85,6 +82,8 @@ module Hamler
85
82
  '.css'
86
83
  when '.haml'
87
84
  '.html'
85
+ when '.coffee'
86
+ '.js'
88
87
  else
89
88
  raise "do not what to do with #{old_ext}"
90
89
  end
@@ -102,6 +101,8 @@ module Hamler
102
101
  options = {
103
102
  :haml_available => available?("haml"),
104
103
  :sass_available => available?("sass"),
104
+ :coffeescript_available \
105
+ => available?("coffee-script"),
105
106
  :output_folder => false,
106
107
  :input_folder => false,
107
108
  :dry_run => false,
@@ -1,3 +1,3 @@
1
1
  module Hamler
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1 @@
1
+ alert()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-10 00:00:00.000000000 Z
12
+ date: 2013-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -59,6 +59,38 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: coffee-script
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: execjs
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
62
94
  description: one-line haml/sass/scss compiler
63
95
  email:
64
96
  - momocraft@gmail.com
@@ -79,10 +111,8 @@ files:
79
111
  - lib/template.erb
80
112
  - test/a.sass
81
113
  - test/a_haml_file.haml
82
- - test/a_haml_file.haml.html
83
- - test/a_haml_filehtml
84
114
  - test/subdir1/a_haml_file.haml
85
- - test/subdir2/a.js
115
+ - test/subdir2/a.coffee
86
116
  - test/subdir2/b.sass
87
117
  homepage: https://github.com/jokester/hamler
88
118
  licenses: []
@@ -111,8 +141,6 @@ summary: compile haml/sass/scss files in one command
111
141
  test_files:
112
142
  - test/a.sass
113
143
  - test/a_haml_file.haml
114
- - test/a_haml_file.haml.html
115
- - test/a_haml_filehtml
116
144
  - test/subdir1/a_haml_file.haml
117
- - test/subdir2/a.js
145
+ - test/subdir2/a.coffee
118
146
  - test/subdir2/b.sass
@@ -1,11 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>in a_haml_file</title>
5
- </head>
6
- <body>
7
- <div id='div1'>in a div</div>
8
- <div id='div2'>in another div</div>
9
- </body>
10
- </html>
11
-
data/test/a_haml_filehtml DELETED
@@ -1 +0,0 @@
1
- aaa
data/test/subdir2/a.js DELETED
@@ -1 +0,0 @@
1
- alert();