erb2haml-win 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "haml"
4
+ gem "hpricot"
5
+ gem "ruby_parser"
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 David Leung
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ erb2haml-win
2
+ ========
3
+ **erb2haml-win** adds a simple rake task to your Rails app to converts all ERb HTML files in `APP_HOME/app/views/` to Haml.
4
+
5
+ **Windows Only!**
6
+
7
+ Forked from https://github.com/dhl/erb2haml
8
+
9
+ Urgent Question
10
+ ---------------
11
+
12
+ Why my rake tasks are unavailable?
13
+ But after installing the original erb2haml they appears?
14
+
15
+ Getting Started
16
+ ---------------
17
+
18
+ 1. Add `gem "erb2haml"` to the development group in your Gemfile.
19
+
20
+ Either add the line `gem "erb2haml", :group => :development` to your `Gemfile`, or
21
+ group :development do
22
+ ...
23
+ gem "erb2haml-win" # Add this line
24
+ ...
25
+ end
26
+
27
+ 2. Run `rake haml:toErb`
28
+ 3. Watch your ERB files getting converted to haml.
29
+
30
+ And that's it!
31
+
32
+ Other commands:
33
+
34
+ `rake haml:delErb` for deleting *.erb
35
+
36
+ `rake haml:toDelErb` for converting & deleting *.erb
37
+
38
+ Copyright
39
+ ---------
40
+ Copyright (c) 2011 David Leung. See LICENSE for further details.
41
+
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'rake'
2
+ require File.expand_path('../lib/erb2haml/version', __FILE__)
3
+
4
+ desc "Release gem #{ERb2Haml::VERSION}"
5
+ task :release do
6
+ system "git tag -a #{ERb2Haml::VERSION} -m 'Tagging #{ERb2Haml::VERSION}'"
7
+ system "git push --tags"
8
+ system "gem push erb2haml-win-#{ERb2Haml::VERSION}.gem"
9
+ end
@@ -0,0 +1,10 @@
1
+ require 'erb2haml-win'
2
+ require 'rails'
3
+
4
+ module ERb2Haml
5
+ class Railtie < Rails::Railtie
6
+ rake_tasks do
7
+ load 'erb2haml-win/railties/erb2haml-win.rake'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,43 @@
1
+ require 'find'
2
+
3
+ RED_FG ="\033[31m"
4
+ GREEN_FG = "\033[32m"
5
+ END_TEXT_STYLE = "\033[0m"
6
+
7
+ # Helper method to inject ASCII escape sequences for colorized output
8
+ def color(text, begin_text_style)
9
+ begin_text_style + text + END_TEXT_STYLE
10
+ end
11
+
12
+ namespace :haml do
13
+ desc "Perform bulk conversion of all html.erb files to Haml in views folder. Windows only"
14
+ task :toErb do
15
+
16
+ #check dependency
17
+ if `where html2haml`.empty?
18
+ puts "#{color 'ERROR: ', RED_FG} Could not find " +
19
+ "#{color 'html2haml', GREEN_FG} in your PATH. Aborting."
20
+ exit(false)
21
+ end
22
+
23
+ puts "Looking for #{color "ERB", GREEN_FG} files to convert to " +
24
+ "#{color('Haml', RED_FG)}..."
25
+
26
+ Dir["app/views/**/*.erb"].each do |file|
27
+ puts "#{color('Converting',RED_FG)}: #{file}..."
28
+ `html2haml -e #{file} #{file.gsub(/\.erb$/, '.haml')}`
29
+ puts "#{color('Converted',GREEN_FG)}: #{file}..."
30
+ end
31
+ end #End rake task
32
+
33
+ desc "Delete erb files. Windows only"
34
+ task :delErb do
35
+ puts color('Start deleting all erb files...', RED_FG)
36
+ puts `del .\\app\\views\\*.erb /s`
37
+ puts color('All erb files deleted!!', GREEN_FG)
38
+ end #End rake task
39
+
40
+ desc "Convert and Delete erb files. Windows only"
41
+ task :toDelErb => [:toErb,:delErb]
42
+ end # End of :haml namespace
43
+
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+ module ERb2Haml
3
+ VERSION = "0.1.3"
4
+ end
@@ -0,0 +1,2 @@
1
+ require 'erb2haml-win/railtie' if defined?(Rails)
2
+
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: erb2haml-win
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Leung
9
+ - PikachuEXE
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-12-29 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: haml
17
+ requirement: &27508656 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *27508656
26
+ - !ruby/object:Gem::Dependency
27
+ name: hpricot
28
+ requirement: &27508392 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *27508392
37
+ - !ruby/object:Gem::Dependency
38
+ name: ruby_parser
39
+ requirement: &27508020 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *27508020
48
+ description: Simple rake task to bulk covert ERB HAML files in a Rails app to Haml.
49
+ email: pikachuexe@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files:
53
+ - LICENSE
54
+ - README.md
55
+ files:
56
+ - Gemfile
57
+ - Rakefile
58
+ - lib/erb2haml-win/railtie.rb
59
+ - lib/erb2haml-win/railties/erb2haml-win.rake
60
+ - lib/erb2haml-win/version.rb
61
+ - lib/erb2haml-win.rb
62
+ - LICENSE
63
+ - README.md
64
+ homepage: http://github.com/PikachuEXE/erb2haml
65
+ licenses: []
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubyforge_project:
84
+ rubygems_version: 1.8.11
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Perform bulk conversion of all html.erb files to Haml in views folder. Windows
88
+ only. Also delete erb files
89
+ test_files: []