erb2haml 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/README.md +7 -6
- data/lib/erb2haml/railties/erb2haml.rake +38 -0
- data/lib/erb2haml/version.rb +1 -1
- metadata +60 -53
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
erb2haml
|
2
2
|
========
|
3
|
-
**erb2haml** adds a simple rake task to your Rails app
|
3
|
+
**erb2haml** adds a simple rake task to your Rails app to converts all ERb HTML files in `APP_HOME/app/views/` to Haml.
|
4
|
+
|
5
|
+
Existing Haml files are untouched.
|
4
6
|
|
5
7
|
Getting Started
|
6
8
|
---------------
|
@@ -14,12 +16,11 @@ Getting Started
|
|
14
16
|
...
|
15
17
|
end
|
16
18
|
|
17
|
-
2. Run `rake haml:convert_erbs`
|
19
|
+
2. Run `rake haml:convert_erbs` to convert your ERB files without removing them, or run `rake haml:replace_erbs` to convert and replace your ERB files to your new HAML files.
|
18
20
|
3. Watch your ERB files getting converted to haml.
|
19
21
|
|
20
22
|
And that's it!
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
Copyright (c) 2011 David Leung. See LICENSE for further details.
|
25
|
-
|
24
|
+
License
|
25
|
+
-------
|
26
|
+
Copyright (c) 2011-2013 David Leung and [contributors](https://github.com/dhl/erb2haml/contributors). See LICENSE for further details.
|
@@ -40,5 +40,43 @@ namespace :haml do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end #End rake task
|
43
|
+
|
44
|
+
desc "Perform bulk conversion of all html.erb files to Haml in views folder, then remove the converted html.erb files."
|
45
|
+
task :replace_erbs do
|
46
|
+
if `which html2haml`.empty?
|
47
|
+
puts "#{color "ERROR: ", RED_FG} Could not find " +
|
48
|
+
"#{color "html2haml", GREEN_FG} in your PATH. Aborting."
|
49
|
+
exit(false)
|
50
|
+
end
|
51
|
+
|
52
|
+
puts "Looking for #{color "ERB", GREEN_FG} files to convert to " +
|
53
|
+
"#{color("Haml", RED_FG)}..."
|
54
|
+
|
55
|
+
Find.find("app/views/") do |path|
|
56
|
+
if FileTest.file?(path) and path.downcase.match(/\.html\.erb$/i)
|
57
|
+
haml_path = path.slice(0...-3)+"haml"
|
58
|
+
|
59
|
+
unless FileTest.exists?(haml_path)
|
60
|
+
print "Converting: #{path}... "
|
61
|
+
|
62
|
+
if system("html2haml", path, haml_path)
|
63
|
+
puts color("Done!", GREEN_FG)
|
64
|
+
print "Removing: #{path}... "
|
65
|
+
if system("rm", path)
|
66
|
+
puts color("Removed!", GREEN_FG)
|
67
|
+
else
|
68
|
+
puts color("Failed!", RED_FG)
|
69
|
+
end
|
70
|
+
else
|
71
|
+
puts color("Failed!", RED_FG)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end #End rake task
|
80
|
+
|
43
81
|
end # End of :haml namespace
|
44
82
|
|
data/lib/erb2haml/version.rb
CHANGED
metadata
CHANGED
@@ -1,61 +1,72 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: erb2haml
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- David Leung
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: haml
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: hpricot
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
25
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: hpricot
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
36
38
|
type: :runtime
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: ruby_parser
|
40
39
|
prerelease: false
|
41
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
41
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: ruby_parser
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
47
54
|
type: :runtime
|
48
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
49
62
|
description: Simple rake task to bulk covert ERB HAML files in a Rails app to Haml.
|
50
63
|
email: david@davidslab.com
|
51
64
|
executables: []
|
52
|
-
|
53
65
|
extensions: []
|
54
|
-
|
55
|
-
extra_rdoc_files:
|
66
|
+
extra_rdoc_files:
|
56
67
|
- LICENSE
|
57
68
|
- README.md
|
58
|
-
files:
|
69
|
+
files:
|
59
70
|
- Gemfile
|
60
71
|
- Rakefile
|
61
72
|
- lib/erb2haml/railtie.rb
|
@@ -64,33 +75,29 @@ files:
|
|
64
75
|
- lib/erb2haml.rb
|
65
76
|
- LICENSE
|
66
77
|
- README.md
|
67
|
-
has_rdoc: true
|
68
78
|
homepage: http://github.com/dhl/erb2haml
|
69
79
|
licenses: []
|
70
|
-
|
71
80
|
post_install_message:
|
72
81
|
rdoc_options: []
|
73
|
-
|
74
|
-
require_paths:
|
82
|
+
require_paths:
|
75
83
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
85
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version:
|
82
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
91
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version:
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
88
96
|
requirements: []
|
89
|
-
|
90
97
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.
|
98
|
+
rubygems_version: 1.8.23
|
92
99
|
signing_key:
|
93
100
|
specification_version: 3
|
94
101
|
summary: Bulk ERB HTML to Haml conversion for Rails.
|
95
102
|
test_files: []
|
96
|
-
|
103
|
+
has_rdoc:
|