haml-rails 0.5.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +23 -9
- data/Appraisals +11 -7
- data/Gemfile +4 -0
- data/LICENSE +1 -1
- data/README.md +37 -4
- data/Rakefile +1 -5
- data/gemfiles/rails_4_0.gemfile +4 -1
- data/gemfiles/rails_4_1.gemfile +10 -0
- data/gemfiles/rails_4_2.gemfile +10 -0
- data/gemfiles/rails_5_0.gemfile +10 -0
- data/haml-rails.gemspec +5 -4
- data/lib/generators/haml/mailer/mailer_generator.rb +28 -1
- data/lib/generators/haml/mailer/templates/layout.html.haml +3 -0
- data/lib/generators/haml/mailer/templates/layout.text.haml +1 -0
- data/lib/generators/haml/mailer/templates/view.html.haml +4 -0
- data/lib/generators/haml/scaffold/templates/_form.html.haml +2 -2
- data/lib/generators/haml/scaffold/templates/index.html.haml +13 -11
- data/lib/haml-rails.rb +18 -6
- data/lib/haml-rails/version.rb +2 -2
- data/lib/rails/generators/haml/application_layout/application_layout_generator.rb +35 -0
- data/lib/tasks/erb2haml.rake +75 -0
- data/test/lib/generators/haml/controller_generator_test.rb +8 -7
- data/test/lib/generators/haml/mailer_generator_test.rb +22 -0
- data/test/lib/generators/haml/testing_helper.rb +1 -1
- data/test/test_helper.rb +11 -7
- metadata +56 -36
- data/gemfiles/rails_3_1.gemfile +0 -7
- data/gemfiles/rails_3_2.gemfile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd4e782b975a13cfd5ef38f19650e2c9028dc006
|
4
|
+
data.tar.gz: f8ba9eb9204a69d693bb6889ff11179f99fd5055
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89b10fb1366277ed37d3022d109a94827105eecbfcb60e44adfb605b57beacd8620a1f647812deb83ab6d2a0d5e4ee4eebd99ef1fe91869b22593451d02da9a0
|
7
|
+
data.tar.gz: eeb501849dc14d680c872c5ca98bc4fe4fc0c16071836e37810ae2d06afc2a0454db610c9807a017086078ed0cae16dbf7a074536b2749c8497f0c2f99a06196
|
data/.travis.yml
CHANGED
@@ -1,16 +1,30 @@
|
|
1
|
+
sudo: false
|
1
2
|
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
before_install: "gem install bundler"
|
2
5
|
rvm:
|
3
|
-
-
|
4
|
-
-
|
6
|
+
- 2.4.1
|
7
|
+
- 2.3.1
|
8
|
+
- 2.2.5
|
9
|
+
- 2.1
|
10
|
+
- 2.0
|
5
11
|
- 1.9.3
|
6
|
-
-
|
12
|
+
- jruby-19mode
|
7
13
|
gemfile:
|
8
|
-
- gemfiles/
|
9
|
-
- gemfiles/
|
14
|
+
- gemfiles/rails_5_0.gemfile
|
15
|
+
- gemfiles/rails_4_2.gemfile
|
16
|
+
- gemfiles/rails_4_1.gemfile
|
10
17
|
- gemfiles/rails_4_0.gemfile
|
11
18
|
matrix:
|
12
19
|
exclude:
|
13
|
-
- rvm: 1
|
14
|
-
gemfile: gemfiles/
|
15
|
-
- rvm:
|
16
|
-
gemfile: gemfiles/
|
20
|
+
- rvm: 2.1
|
21
|
+
gemfile: gemfiles/rails_5_0.gemfile
|
22
|
+
- rvm: 2.0
|
23
|
+
gemfile: gemfiles/rails_5_0.gemfile
|
24
|
+
- rvm: 1.9.3
|
25
|
+
gemfile: gemfiles/rails_5_0.gemfile
|
26
|
+
- rvm: jruby-19mode
|
27
|
+
gemfile: gemfiles/rails_5_0.gemfile
|
28
|
+
- rvm: 1.9.3
|
29
|
+
gemfile: gemfiles/rails_4_1.gemfile
|
30
|
+
script: "bundle exec rake test"
|
data/Appraisals
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
-
appraise "
|
2
|
-
gem "rails", "~>
|
1
|
+
appraise "rails_4_0" do
|
2
|
+
gem "rails", "~> 4.0.1"
|
3
3
|
end
|
4
4
|
|
5
|
-
appraise "
|
6
|
-
gem "rails", "
|
5
|
+
appraise "rails_4_1" do
|
6
|
+
gem "rails", "4.1"
|
7
7
|
end
|
8
8
|
|
9
|
-
appraise "
|
10
|
-
gem "rails", "
|
11
|
-
end
|
9
|
+
appraise "rails_4_2" do
|
10
|
+
gem "rails", "4.2"
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise "rails_5_0" do
|
14
|
+
gem "rails", "5.0"
|
15
|
+
end
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,25 +1,58 @@
|
|
1
1
|
# Haml-rails
|
2
2
|
|
3
|
-
Haml-rails provides Haml generators for Rails
|
3
|
+
Haml-rails provides Haml generators for Rails 4. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah.
|
4
4
|
|
5
5
|
To use it, add this line to your Gemfile:
|
6
6
|
|
7
|
-
gem "haml-rails"
|
7
|
+
gem "haml-rails", "~> 0.9"
|
8
8
|
|
9
9
|
This ensures that:
|
10
|
-
|
10
|
+
|
11
|
+
* Any time you generate a resource, view, or mailer, you'll get Haml templates (instead of ERB)
|
11
12
|
* When your Rails application loads, Haml will be loaded and initialized automatically
|
12
13
|
* Haml templates will be respected by the view template cache digestor
|
13
14
|
|
14
15
|
Pretty fancy, eh? The modern world is just so amazing.
|
15
16
|
|
17
|
+
### Converting Rails application layout file to haml format
|
18
|
+
|
19
|
+
Once Haml-rails is installed on the Rails application,
|
20
|
+
you can convert the erb layout file, `app/views/layouts/application.html.erb`
|
21
|
+
to `app/views/layouts/application.html.haml` using this command:
|
22
|
+
|
23
|
+
$ rails generate haml:application_layout convert
|
24
|
+
|
25
|
+
After the application layout file is converted successfully,
|
26
|
+
make sure to delete `app/views/layouts/application.html.erb`, so Rails can
|
27
|
+
start using `app/views/layouts/application.html.haml` instead.
|
28
|
+
|
29
|
+
### Converting all .erb views to haml format
|
30
|
+
|
31
|
+
If you want to convert all of your .erb views into .haml, you can do so using the following command:
|
32
|
+
|
33
|
+
$ rake haml:erb2haml
|
34
|
+
|
35
|
+
If you already have .haml files for one or more of the .erb files, the rake task will give you the option of either
|
36
|
+
replacing these .haml files or leaving them in place.
|
37
|
+
|
38
|
+
Once the task is complete, you will have the option of deleting the original .erb files. Unless you are under
|
39
|
+
version control, it is recommended that you decline this option.
|
40
|
+
|
41
|
+
### Older versions of Rails
|
42
|
+
|
43
|
+
The current version of Haml-rails requires 4.0.1 or later.
|
44
|
+
|
45
|
+
Haml-rails version 0.4 is the last version to support Rails 3. To use it, add this line to your Gemfile:
|
46
|
+
|
47
|
+
gem "haml-rails", "~> 0.4.0"
|
48
|
+
|
16
49
|
### Contributors
|
17
50
|
|
18
51
|
Haml generators originally from [rails3-generators](http://github.com/indirect/rails3-generators), and written by José Valim, André Arko, Paul Barry, Anuj Dutta, Louis T, and Chris Rhoden. Tests originally written by Louis T.
|
19
52
|
|
20
53
|
### Code Status
|
21
54
|
|
22
|
-
[![Build Status](https://travis-ci.org/indirect/haml-rails.
|
55
|
+
[![Build Status](https://travis-ci.org/indirect/haml-rails.svg)](https://travis-ci.org/indirect/haml-rails)
|
23
56
|
|
24
57
|
### License
|
25
58
|
|
data/Rakefile
CHANGED
data/gemfiles/rails_4_0.gemfile
CHANGED
data/haml-rails.gemspec
CHANGED
@@ -9,21 +9,22 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ["andre@arko.net"]
|
10
10
|
s.homepage = "http://github.com/indirect/haml-rails"
|
11
11
|
s.summary = "let your Gemfile do the configuring"
|
12
|
-
s.description = "Haml-rails provides Haml generators for Rails
|
12
|
+
s.description = "Haml-rails provides Haml generators for Rails 4. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah."
|
13
13
|
s.licenses = ["MIT"]
|
14
14
|
|
15
15
|
s.rubyforge_project = "haml-rails"
|
16
16
|
s.required_rubygems_version = ">= 1.3.6"
|
17
17
|
|
18
|
-
s.add_dependency "haml", [">=
|
18
|
+
s.add_dependency "haml", [">= 4.0.6", "< 6.0"]
|
19
19
|
s.add_dependency "activesupport", [">= 4.0.1"]
|
20
20
|
s.add_dependency "actionpack", [">= 4.0.1"]
|
21
21
|
s.add_dependency "railties", [">= 4.0.1"]
|
22
|
+
s.add_dependency "html2haml", [">= 1.0.1"]
|
22
23
|
|
23
24
|
s.add_development_dependency "rails", [">= 4.0.1"]
|
24
|
-
s.add_development_dependency "bundler", "~> 1.
|
25
|
+
s.add_development_dependency "bundler", "~> 1.7"
|
25
26
|
s.add_development_dependency "rake"
|
26
|
-
s.add_development_dependency 'appraisal', '
|
27
|
+
s.add_development_dependency 'appraisal', '~> 1.0'
|
27
28
|
|
28
29
|
s.files = `git ls-files`.split("\n")
|
29
30
|
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
|
@@ -5,12 +5,39 @@ module Haml
|
|
5
5
|
class MailerGenerator < ControllerGenerator
|
6
6
|
source_root File.expand_path("../templates", __FILE__)
|
7
7
|
|
8
|
-
|
8
|
+
def copy_view_files
|
9
|
+
if ::Rails.version.to_s >= "4.2.0"
|
10
|
+
view_base_path = File.join("app/views", class_path, file_name)
|
11
|
+
empty_directory view_base_path
|
12
|
+
|
13
|
+
if self.behavior == :invoke
|
14
|
+
formats.each do |format|
|
15
|
+
layout_path = File.join("app/views/layouts", filename_with_extensions("mailer", format))
|
16
|
+
template filename_with_extensions(:layout, format), layout_path
|
17
|
+
end
|
18
|
+
end
|
9
19
|
|
20
|
+
actions.each do |action|
|
21
|
+
@action = action
|
22
|
+
|
23
|
+
formats.each do |format|
|
24
|
+
@path = File.join(view_base_path, filename_with_extensions(action, format))
|
25
|
+
template filename_with_extensions(:view, format), @path
|
26
|
+
end
|
27
|
+
end
|
28
|
+
else
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
10
34
|
def format
|
11
35
|
:text
|
12
36
|
end
|
13
37
|
|
38
|
+
def formats
|
39
|
+
[:text, :html]
|
40
|
+
end
|
14
41
|
end
|
15
42
|
end
|
16
43
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= yield
|
@@ -3,8 +3,8 @@
|
|
3
3
|
#error_explanation
|
4
4
|
%h2= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
|
5
5
|
%ul
|
6
|
-
- @<%= singular_table_name %>.errors.full_messages.each do |
|
7
|
-
%li=
|
6
|
+
- @<%= singular_table_name %>.errors.full_messages.each do |message|
|
7
|
+
%li= message
|
8
8
|
|
9
9
|
<% for attribute in attributes -%>
|
10
10
|
.field
|
@@ -1,22 +1,24 @@
|
|
1
1
|
%h1 Listing <%= plural_table_name %>
|
2
2
|
|
3
3
|
%table
|
4
|
-
%
|
4
|
+
%thead
|
5
|
+
%tr
|
5
6
|
<% for attribute in attributes -%>
|
6
|
-
|
7
|
+
%th <%= attribute.human_name %>
|
7
8
|
<% end -%>
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
%th
|
10
|
+
%th
|
11
|
+
%th
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
%tbody
|
14
|
+
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
15
|
+
%tr
|
14
16
|
<% for attribute in attributes -%>
|
15
|
-
|
17
|
+
%td= <%= singular_table_name %>.<%= attribute.name %>
|
16
18
|
<% end -%>
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
%td= link_to 'Show', <%= singular_table_name %>
|
20
|
+
%td= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
|
21
|
+
%td= link_to 'Destroy', <%= singular_table_name %>, method: :delete, data: { confirm: 'Are you sure?' }
|
20
22
|
|
21
23
|
%br
|
22
24
|
|
data/lib/haml-rails.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
require 'haml'
|
2
2
|
require 'rails'
|
3
|
+
require 'haml/railtie'
|
3
4
|
|
4
5
|
module Haml
|
5
6
|
module Rails
|
7
|
+
class Engine < ::Rails::Engine
|
8
|
+
end
|
6
9
|
class Railtie < ::Rails::Railtie
|
7
|
-
|
8
|
-
config.app_generators.template_engine :haml
|
9
|
-
else
|
10
|
-
config.generators.template_engine :haml
|
11
|
-
end
|
10
|
+
config.app_generators.template_engine :haml
|
12
11
|
|
13
12
|
config.before_initialize do
|
14
|
-
Haml.init_rails(binding)
|
15
13
|
Haml::Template.options[:format] = :html5
|
16
14
|
end
|
17
15
|
|
@@ -43,6 +41,20 @@ module Haml
|
|
43
41
|
end
|
44
42
|
end
|
45
43
|
end
|
44
|
+
|
45
|
+
# Configure source annotation on haml files (support for HAML was
|
46
|
+
# provided directly by railties 3.2..4.1 but was dropped in 4.2.
|
47
|
+
if Gem::Requirement.new(">= 4.2").satisfied_by?(Gem::Version.new(::Rails.version))
|
48
|
+
initializer 'haml_rails.configure_source_annotation' do
|
49
|
+
SourceAnnotationExtractor::Annotation.register_extensions('haml') do |tag|
|
50
|
+
/\s*-#\s*(#{tag}):?\s*(.*)/
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
rake_tasks do
|
56
|
+
load 'tasks/erb2haml.rake'
|
57
|
+
end
|
46
58
|
end
|
47
59
|
end
|
48
60
|
end
|
data/lib/haml-rails/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
module Haml
|
5
|
+
module Generators
|
6
|
+
class ApplicationLayoutGenerator < ::Rails::Generators::Base
|
7
|
+
|
8
|
+
HTML_LAYOUT_PATH = 'app/views/layouts/application.html.erb'
|
9
|
+
HAML_LAYOUT_PATH = 'app/views/layouts/application.html.haml'
|
10
|
+
|
11
|
+
# Converts existing application.html.erb to haml format,
|
12
|
+
# and creates app/views/layouts/application.html.haml
|
13
|
+
# with some error checking.
|
14
|
+
def convert
|
15
|
+
app_layout_from = ::Rails.root.join(HTML_LAYOUT_PATH).to_s
|
16
|
+
app_layout_to = ::Rails.root.join(HAML_LAYOUT_PATH).to_s
|
17
|
+
|
18
|
+
if File.exist?(app_layout_from)
|
19
|
+
|
20
|
+
if !File.exist?(app_layout_to)
|
21
|
+
`html2haml #{app_layout_from.shellescape} #{app_layout_to.shellescape}`
|
22
|
+
puts "Success! app/views/layouts/application.html.haml is created.\n" \
|
23
|
+
"Please remove the erb file: app/views/layouts/application.html.erb"
|
24
|
+
else
|
25
|
+
puts "Error! There is a file named app/views/layouts/application.html.haml already."
|
26
|
+
end
|
27
|
+
else
|
28
|
+
puts "Error! There is no file named app/views/layouts/application.html.erb."
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
namespace :haml do
|
2
|
+
desc 'Convert html.erb to html.haml each file in app/views'
|
3
|
+
task :erb2haml do
|
4
|
+
|
5
|
+
erb_files = Dir.glob('app/views/**/*.erb').select { |f| File.file? f}
|
6
|
+
haml_files = Dir.glob('app/views/**/*.haml').select { |f| File.file? f}
|
7
|
+
|
8
|
+
if erb_files.empty?
|
9
|
+
puts "No .erb files found. Task will now exit."
|
10
|
+
exit
|
11
|
+
end
|
12
|
+
|
13
|
+
haml_files_w_out_ext = haml_files.map { |f| f.gsub(/\.haml\z/, '') }
|
14
|
+
|
15
|
+
# Get a list of all those erb files that already seem to have .haml equivalents
|
16
|
+
|
17
|
+
already_existing = erb_files.select { |f| short = f.gsub(/\.erb\z/, ''); haml_files_w_out_ext.include?(short) }
|
18
|
+
|
19
|
+
puts '-'*80
|
20
|
+
|
21
|
+
if already_existing.any?
|
22
|
+
puts "Some of your .html.erb files seem to already have .haml equivalents:"
|
23
|
+
already_existing.map { |f| puts "\t#{f}" }
|
24
|
+
|
25
|
+
# Ask the user whether he/she would like to overwrite them.
|
26
|
+
begin
|
27
|
+
puts "Would you like to overwrite these .haml files? (y/n)"
|
28
|
+
should_overwrite = STDIN.gets.chomp.downcase[0]
|
29
|
+
end until ['y', 'n'].include?(should_overwrite)
|
30
|
+
puts '-'*80
|
31
|
+
|
32
|
+
# If we are not overwriting, remove each already_existing from our erb_files list
|
33
|
+
if should_overwrite == 'n'
|
34
|
+
erb_files = erb_files - already_existing
|
35
|
+
|
36
|
+
if erb_files.empty?
|
37
|
+
# It is possible no .erb files remain, after we remove already_existing
|
38
|
+
puts "No .erb files remain. Task will now exit."
|
39
|
+
return
|
40
|
+
end
|
41
|
+
else
|
42
|
+
# Delete the current .haml
|
43
|
+
already_existing.each { |f| File.delete(f.gsub(/\.erb\z/, '.haml')) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
erb_files.each do |file|
|
48
|
+
puts "Generating HAML for #{file}..."
|
49
|
+
`html2haml #{file} #{file.gsub(/\.erb\z/, '.haml')}`
|
50
|
+
end
|
51
|
+
|
52
|
+
puts '-'*80
|
53
|
+
|
54
|
+
puts "HAML generated for the following files:"
|
55
|
+
erb_files.each do |file|
|
56
|
+
puts "\t#{file}"
|
57
|
+
end
|
58
|
+
|
59
|
+
puts '-'*80
|
60
|
+
begin
|
61
|
+
puts 'Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)'
|
62
|
+
should_delete = STDIN.gets.chomp.downcase[0]
|
63
|
+
end until ['y', 'n'].include?(should_delete)
|
64
|
+
|
65
|
+
if should_delete == 'y'
|
66
|
+
puts "Deleting original .erb files."
|
67
|
+
File.delete(*erb_files)
|
68
|
+
else
|
69
|
+
puts "Please remember to delete your .erb files once you have ensured they were translated correctly."
|
70
|
+
end
|
71
|
+
|
72
|
+
puts '-'*80
|
73
|
+
puts "Task complete!"
|
74
|
+
end
|
75
|
+
end
|
@@ -2,16 +2,17 @@ require 'test_helper'
|
|
2
2
|
require 'lib/generators/haml/testing_helper'
|
3
3
|
|
4
4
|
class Haml::Generators::ControllerGeneratorTest < Rails::Generators::TestCase
|
5
|
-
destination
|
5
|
+
destination Rails.root
|
6
6
|
tests Rails::Generators::ControllerGenerator
|
7
|
-
arguments %w(Account foo bar --template-engine haml)
|
8
7
|
|
9
8
|
setup :prepare_destination
|
10
9
|
setup :copy_routes
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
arguments %w(Account foo bar --template-engine haml)
|
12
|
+
|
13
|
+
test "should invoke haml engine" do
|
14
|
+
run_generator
|
15
|
+
assert_file "app/views/account/foo.html.haml"
|
16
|
+
assert_file "app/views/account/bar.html.haml"
|
17
|
+
end
|
17
18
|
end
|
@@ -11,6 +11,28 @@ class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase
|
|
11
11
|
|
12
12
|
test "should invoke template engine" do
|
13
13
|
run_generator
|
14
|
+
|
15
|
+
if ::Rails.version.to_s >= '4.2'
|
16
|
+
|
17
|
+
assert_file "app/views/layouts/mailer.text.haml" do |view|
|
18
|
+
assert_match /\= yield/, view
|
19
|
+
end
|
20
|
+
|
21
|
+
assert_file "app/views/layouts/mailer.html.haml" do |view|
|
22
|
+
assert_match /\= yield/, view
|
23
|
+
end
|
24
|
+
|
25
|
+
assert_file "app/views/notifier/foo.html.haml" do |view|
|
26
|
+
assert_match %r(app/views/notifier/foo\.html\.haml), view
|
27
|
+
assert_match /\= @greeting/, view
|
28
|
+
end
|
29
|
+
|
30
|
+
assert_file "app/views/notifier/bar.html.haml" do |view|
|
31
|
+
assert_match %r(app/views/notifier/bar\.html\.haml), view
|
32
|
+
assert_match /\= @greeting/, view
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
14
36
|
assert_file "app/views/notifier/foo.text.haml" do |view|
|
15
37
|
assert_match %r(app/views/notifier/foo\.text\.haml), view
|
16
38
|
assert_match /\= @greeting/, view
|
@@ -1 +1 @@
|
|
1
|
-
require_generators :haml => ['scaffold', 'controller', 'mailer']
|
1
|
+
require_generators :haml => ['scaffold', 'controller', 'mailer']
|
data/test/test_helper.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'minitest/autorun'
|
3
3
|
require 'rails/all'
|
4
4
|
require 'rails/generators'
|
5
5
|
require 'rails/generators/test_case'
|
@@ -7,26 +7,24 @@ require 'rails/generators/test_case'
|
|
7
7
|
class TestApp < Rails::Application
|
8
8
|
config.root = File.dirname(__FILE__)
|
9
9
|
end
|
10
|
-
Rails.application = TestApp
|
11
10
|
|
12
11
|
module Rails
|
13
12
|
def self.root
|
14
13
|
@root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'rails'))
|
15
14
|
end
|
16
15
|
end
|
17
|
-
Rails.application.config.root = Rails.root
|
18
16
|
|
19
17
|
# Call configure to load the settings from
|
20
18
|
# Rails.application.config.generators to Rails::Generators
|
21
|
-
Rails
|
19
|
+
Rails.application.load_generators
|
22
20
|
|
23
21
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
24
22
|
|
25
23
|
def copy_routes
|
26
|
-
routes = File.
|
24
|
+
routes = File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb')
|
27
25
|
destination = File.join(Rails.root, "config")
|
28
26
|
FileUtils.mkdir_p(destination)
|
29
|
-
FileUtils.cp File.expand_path(routes), destination
|
27
|
+
FileUtils.cp File.expand_path(routes), File.expand_path(destination)
|
30
28
|
end
|
31
29
|
|
32
30
|
# Asserts the given class exists in the given content. When a block is given,
|
@@ -72,4 +70,10 @@ def require_generators(generator_list)
|
|
72
70
|
end
|
73
71
|
alias :require_generator :require_generators
|
74
72
|
|
75
|
-
require_generators generator_list
|
73
|
+
require_generators generator_list
|
74
|
+
|
75
|
+
# Remove tmp directory when test suite is completed
|
76
|
+
MiniTest::Unit.after_tests do
|
77
|
+
tmp_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp'))
|
78
|
+
FileUtils.rm_r(tmp_dir)
|
79
|
+
end
|
metadata
CHANGED
@@ -1,134 +1,148 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2017-04-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
|
-
version:
|
20
|
-
- - <
|
19
|
+
version: 4.0.6
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6.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
|
-
version:
|
30
|
-
- - <
|
29
|
+
version: 4.0.6
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6.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
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: html2haml
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 1.0.1
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 1.0.1
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: rails
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
78
92
|
requirements:
|
79
|
-
- -
|
93
|
+
- - ">="
|
80
94
|
- !ruby/object:Gem::Version
|
81
95
|
version: 4.0.1
|
82
96
|
type: :development
|
83
97
|
prerelease: false
|
84
98
|
version_requirements: !ruby/object:Gem::Requirement
|
85
99
|
requirements:
|
86
|
-
- -
|
100
|
+
- - ">="
|
87
101
|
- !ruby/object:Gem::Version
|
88
102
|
version: 4.0.1
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
104
|
name: bundler
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
92
106
|
requirements:
|
93
|
-
- - ~>
|
107
|
+
- - "~>"
|
94
108
|
- !ruby/object:Gem::Version
|
95
|
-
version: '1.
|
109
|
+
version: '1.7'
|
96
110
|
type: :development
|
97
111
|
prerelease: false
|
98
112
|
version_requirements: !ruby/object:Gem::Requirement
|
99
113
|
requirements:
|
100
|
-
- - ~>
|
114
|
+
- - "~>"
|
101
115
|
- !ruby/object:Gem::Version
|
102
|
-
version: '1.
|
116
|
+
version: '1.7'
|
103
117
|
- !ruby/object:Gem::Dependency
|
104
118
|
name: rake
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
106
120
|
requirements:
|
107
|
-
- -
|
121
|
+
- - ">="
|
108
122
|
- !ruby/object:Gem::Version
|
109
123
|
version: '0'
|
110
124
|
type: :development
|
111
125
|
prerelease: false
|
112
126
|
version_requirements: !ruby/object:Gem::Requirement
|
113
127
|
requirements:
|
114
|
-
- -
|
128
|
+
- - ">="
|
115
129
|
- !ruby/object:Gem::Version
|
116
130
|
version: '0'
|
117
131
|
- !ruby/object:Gem::Dependency
|
118
132
|
name: appraisal
|
119
133
|
requirement: !ruby/object:Gem::Requirement
|
120
134
|
requirements:
|
121
|
-
- -
|
135
|
+
- - "~>"
|
122
136
|
- !ruby/object:Gem::Version
|
123
|
-
version: 0
|
137
|
+
version: '1.0'
|
124
138
|
type: :development
|
125
139
|
prerelease: false
|
126
140
|
version_requirements: !ruby/object:Gem::Requirement
|
127
141
|
requirements:
|
128
|
-
- -
|
142
|
+
- - "~>"
|
129
143
|
- !ruby/object:Gem::Version
|
130
|
-
version: 0
|
131
|
-
description: Haml-rails provides Haml generators for Rails
|
144
|
+
version: '1.0'
|
145
|
+
description: Haml-rails provides Haml generators for Rails 4. It also enables Haml
|
132
146
|
as the templating engine for you, so you don't have to screw around in your own
|
133
147
|
application.rb when your Gemfile already clearly indicated what templating engine
|
134
148
|
you have installed. Hurrah.
|
@@ -138,20 +152,24 @@ executables: []
|
|
138
152
|
extensions: []
|
139
153
|
extra_rdoc_files: []
|
140
154
|
files:
|
141
|
-
- .gitignore
|
142
|
-
- .travis.yml
|
155
|
+
- ".gitignore"
|
156
|
+
- ".travis.yml"
|
143
157
|
- Appraisals
|
144
158
|
- Gemfile
|
145
159
|
- LICENSE
|
146
160
|
- README.md
|
147
161
|
- Rakefile
|
148
|
-
- gemfiles/rails_3_1.gemfile
|
149
|
-
- gemfiles/rails_3_2.gemfile
|
150
162
|
- gemfiles/rails_4_0.gemfile
|
163
|
+
- gemfiles/rails_4_1.gemfile
|
164
|
+
- gemfiles/rails_4_2.gemfile
|
165
|
+
- gemfiles/rails_5_0.gemfile
|
151
166
|
- haml-rails.gemspec
|
152
167
|
- lib/generators/haml/controller/controller_generator.rb
|
153
168
|
- lib/generators/haml/controller/templates/view.html.haml
|
154
169
|
- lib/generators/haml/mailer/mailer_generator.rb
|
170
|
+
- lib/generators/haml/mailer/templates/layout.html.haml
|
171
|
+
- lib/generators/haml/mailer/templates/layout.text.haml
|
172
|
+
- lib/generators/haml/mailer/templates/view.html.haml
|
155
173
|
- lib/generators/haml/mailer/templates/view.text.haml
|
156
174
|
- lib/generators/haml/scaffold/scaffold_generator.rb
|
157
175
|
- lib/generators/haml/scaffold/templates/_form.html.haml
|
@@ -161,6 +179,8 @@ files:
|
|
161
179
|
- lib/generators/haml/scaffold/templates/show.html.haml
|
162
180
|
- lib/haml-rails.rb
|
163
181
|
- lib/haml-rails/version.rb
|
182
|
+
- lib/rails/generators/haml/application_layout/application_layout_generator.rb
|
183
|
+
- lib/tasks/erb2haml.rake
|
164
184
|
- test/fixtures/routes.rb
|
165
185
|
- test/lib/generators/haml/controller_generator_test.rb
|
166
186
|
- test/lib/generators/haml/mailer_generator_test.rb
|
@@ -177,17 +197,17 @@ require_paths:
|
|
177
197
|
- lib
|
178
198
|
required_ruby_version: !ruby/object:Gem::Requirement
|
179
199
|
requirements:
|
180
|
-
- -
|
200
|
+
- - ">="
|
181
201
|
- !ruby/object:Gem::Version
|
182
202
|
version: '0'
|
183
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
204
|
requirements:
|
185
|
-
- -
|
205
|
+
- - ">="
|
186
206
|
- !ruby/object:Gem::Version
|
187
207
|
version: 1.3.6
|
188
208
|
requirements: []
|
189
209
|
rubyforge_project: haml-rails
|
190
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.6.11
|
191
211
|
signing_key:
|
192
212
|
specification_version: 4
|
193
213
|
summary: let your Gemfile do the configuring
|
data/gemfiles/rails_3_1.gemfile
DELETED