haml-rails 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e64dd03ebe6296a110c03476fa4dbf4d2a9bbbe
4
- data.tar.gz: 85928597962b84a72e5df687ca2119a5e4be523e
3
+ metadata.gz: 15de4a765f67040747028e4f0faf2defe1e294ea
4
+ data.tar.gz: 6b097a064148a21243a41a45e422bd5e5c182057
5
5
  SHA512:
6
- metadata.gz: bcaf168115ca78f50b99f46d557ef56f2a7ee65b07a9aa538eef6213355dffc1b869b924f5fe1e09f36253ab138d6f2e2ad10baada6e45a463a1e9c30672acf3
7
- data.tar.gz: a71aa24d506d419a30547dba66a928b33346600de77e58899de3834d8e5af8a809520ac9c497719d99b9ad5d6820631745e133a93dc961a630f6f11531fe12c7
6
+ metadata.gz: c79295c782b7f77b9421e9df2c62536b9bef4f9bf8f9ae805ba8fe6b28c67a48b62ce95829caf2aab3fd8ae4617d0f9201d6acde662e7717e0b3597c499d89c6
7
+ data.tar.gz: 428b0e82529f5f1cb31ebc273517ba7bf5ce926fb57b08331d4a335871308cc54394a6afda2518bd9a574b3dfef6fda3f5e3e7b486a9554bd9baeec91fb60afb
data/README.md CHANGED
@@ -25,6 +25,18 @@ After the application layout file is converted successfully,
25
25
  make sure to delete `app/views/layouts/application.html.erb`, so Rails can
26
26
  start using `app/views/layouts/application.html.haml` instead.
27
27
 
28
+ ### Converting all .erb views to haml format
29
+
30
+ If you want to convert all of your .erb views into .haml, you can do so using the following command:
31
+
32
+ $ rake haml:erb2haml
33
+
34
+ If you already have .haml files for one or more of the .erb files, the rake task will give you the option of either
35
+ replacing these .haml files or leaving them in place.
36
+
37
+ Once the task is complete, you will have the option of deleting the original .erb files. Unless you are under
38
+ version control, it is recommended that you decline this option.
39
+
28
40
  ### Older versions of Rails
29
41
 
30
42
  The current version of Haml-rails requires 4.0.1 or later.
@@ -1,5 +1,5 @@
1
1
  module Haml
2
2
  module Rails
3
- VERSION = "0.7.0"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
@@ -0,0 +1,76 @@
1
+ namespace :haml do
2
+ task :erb_2_haml do
3
+
4
+ puts "This task will generate a .html.haml translation of each of the .html.erb files in app/views and its subdirectories."
5
+
6
+ erb_files = Dir.glob('app/views/**/*.erb').select { |f| File.file? f}
7
+ haml_files = Dir.glob('app/views/**/*.haml').select { |f| File.file? f}
8
+
9
+ if erb_files.empty?
10
+ puts "No .erb files found. Task will now exit."
11
+ exit
12
+ end
13
+
14
+ haml_files_w_out_ext = haml_files.map { |f| f.gsub(/\.haml\z/, '') }
15
+
16
+ # Get a list of all those erb files that already seem to have .haml equivalents
17
+
18
+ already_existing = erb_files.select { |f| short = f.gsub(/\.erb\z/, ''); haml_files_w_out_ext.include?(short) }
19
+
20
+ puts '-'*80
21
+
22
+ if already_existing.any?
23
+ puts "Some of your .html.erb files seem to already have .haml equivalents:"
24
+ already_existing.map { |f| puts "\t#{f}" }
25
+
26
+ # Ask the user whether he/she would like to overwrite them.
27
+ begin
28
+ puts "Would you like to overwrite these .haml files? (y/n)"
29
+ should_overwrite = STDIN.gets.chomp.downcase[0]
30
+ end until ['y', 'n'].include?(should_overwrite)
31
+ puts '-'*80
32
+
33
+ # If we are not overwriting, remove each already_existing from our erb_files list
34
+ if should_overwrite == 'n'
35
+ erb_files = erb_files - already_existing
36
+
37
+ if erb_files.empty?
38
+ # It is possible no .erb files remain, after we remove already_existing
39
+ puts "No .erb files remain. Task will now exit."
40
+ return
41
+ end
42
+ else
43
+ # Delete the current .haml
44
+ already_existing.each { |f| File.delete(f.gsub(/\.erb\z/, '.haml')) }
45
+ end
46
+ end
47
+
48
+ erb_files.each do |file|
49
+ puts "Generating HAML for #{file}..."
50
+ `html2haml #{file} #{file.gsub(/\.erb\z/, '.haml')}`
51
+ end
52
+
53
+ puts '-'*80
54
+
55
+ puts "HAML generated for the following files:"
56
+ erb_files.each do |file|
57
+ puts "\t#{file}"
58
+ end
59
+
60
+ puts '-'*80
61
+ begin
62
+ puts 'Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)'
63
+ should_delete = STDIN.gets.chomp.downcase[0]
64
+ end until ['y', 'n'].include?(should_delete)
65
+
66
+ if should_delete == 'y'
67
+ puts "Deleting original .erb files."
68
+ File.delete *erb_files
69
+ else
70
+ puts "Please remember to delete your .erb files once you have ensured they were translated correctly."
71
+ end
72
+
73
+ puts '-'*80
74
+ puts "Task complete!"
75
+ end
76
+ end
metadata CHANGED
@@ -1,145 +1,145 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-12 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.1'
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: activesupport
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 4.0.1
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 4.0.1
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: actionpack
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - '>='
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 4.0.1
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 4.0.1
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: railties
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - '>='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: 4.0.1
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: 4.0.1
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: html2haml
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: 1.0.1
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: 1.0.1
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rails
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: 4.0.1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - '>='
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: 4.0.1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: bundler
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ~>
107
+ - - "~>"
108
108
  - !ruby/object:Gem::Version
109
109
  version: '1.2'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ~>
114
+ - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '1.2'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rake
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '>='
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - '>='
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: appraisal
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - '>='
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: 0.3.8
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - '>='
142
+ - - ">="
143
143
  - !ruby/object:Gem::Version
144
144
  version: 0.3.8
145
145
  description: Haml-rails provides Haml generators for Rails 4. It also enables Haml
@@ -152,8 +152,8 @@ executables: []
152
152
  extensions: []
153
153
  extra_rdoc_files: []
154
154
  files:
155
- - .gitignore
156
- - .travis.yml
155
+ - ".gitignore"
156
+ - ".travis.yml"
157
157
  - Appraisals
158
158
  - Gemfile
159
159
  - LICENSE
@@ -175,6 +175,7 @@ files:
175
175
  - lib/haml-rails.rb
176
176
  - lib/haml-rails/version.rb
177
177
  - lib/rails/generators/haml/application_layout/application_layout_generator.rb
178
+ - lib/tasks/erb2haml.rake
178
179
  - test/fixtures/routes.rb
179
180
  - test/lib/generators/haml/controller_generator_test.rb
180
181
  - test/lib/generators/haml/mailer_generator_test.rb
@@ -191,17 +192,17 @@ require_paths:
191
192
  - lib
192
193
  required_ruby_version: !ruby/object:Gem::Requirement
193
194
  requirements:
194
- - - '>='
195
+ - - ">="
195
196
  - !ruby/object:Gem::Version
196
197
  version: '0'
197
198
  required_rubygems_version: !ruby/object:Gem::Requirement
198
199
  requirements:
199
- - - '>='
200
+ - - ">="
200
201
  - !ruby/object:Gem::Version
201
202
  version: 1.3.6
202
203
  requirements: []
203
204
  rubyforge_project: haml-rails
204
- rubygems_version: 2.4.4
205
+ rubygems_version: 2.4.5
205
206
  signing_key:
206
207
  specification_version: 4
207
208
  summary: let your Gemfile do the configuring