haml-rails 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/README.md +5 -1
- data/Rakefile +10 -1
- data/haml-rails.gemspec +5 -4
- data/lib/generators/haml/controller/controller_generator.rb +4 -2
- data/lib/generators/haml/mailer/mailer_generator.rb +16 -0
- data/lib/generators/haml/mailer/templates/view.text.haml +3 -0
- data/lib/generators/haml/scaffold/scaffold_generator.rb +11 -18
- data/lib/generators/haml/scaffold/templates/_form.html.haml +15 -0
- data/lib/generators/haml/scaffold/templates/edit.html.haml +7 -0
- data/lib/generators/haml/scaffold/templates/index.html.haml +23 -0
- data/lib/generators/haml/scaffold/templates/new.html.haml +5 -0
- data/lib/generators/haml/scaffold/templates/show.html.haml +11 -0
- data/lib/haml-rails/version.rb +1 -1
- data/test/fixtures/routes.rb +58 -0
- data/test/lib/generators/haml/controller_generator_test.rb +17 -0
- data/test/lib/generators/haml/mailer_generator_test.rb +24 -0
- data/test/lib/generators/haml/scaffold_generator_test.rb +31 -0
- data/test/lib/generators/haml/testing_helper.rb +1 -0
- data/test/test_helper.rb +75 -0
- metadata +33 -17
- data/lib/generators/haml.rb +0 -9
- data/lib/generators/haml/scaffold/templates/_form.html.haml.erb +0 -15
- data/lib/generators/haml/scaffold/templates/edit.html.haml.erb +0 -7
- data/lib/generators/haml/scaffold/templates/index.html.haml.erb +0 -23
- data/lib/generators/haml/scaffold/templates/new.html.haml.erb +0 -5
- data/lib/generators/haml/scaffold/templates/show.html.haml.erb +0 -9
data/.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
*.gem
|
1
|
+
*.gem
|
2
|
+
tmp/
|
data/README.md
CHANGED
@@ -8,4 +8,8 @@ To use it, add this line to your Gemfile:
|
|
8
8
|
|
9
9
|
Pretty fancy, eh?
|
10
10
|
|
11
|
-
Once you've done that, any time you generate a controller or scaffold, you'll get Haml instead of ERB templates. On top of that, when your Rails application loads, Haml will be loaded and initialized completely automatically! The modern world is just so amazing.
|
11
|
+
Once you've done that, any time you generate a controller or scaffold, you'll get Haml instead of ERB templates. On top of that, when your Rails application loads, Haml will be loaded and initialized completely automatically! The modern world is just so amazing.
|
12
|
+
|
13
|
+
### Contributors
|
14
|
+
|
15
|
+
Haml generators originally from [rails3-generators](http://github.com/indirect/rails3-generators), and written by Paul Barry, Anuj Dutta, Louis T, and Chris Rhoden. Tests originally written by Louis T.
|
data/Rakefile
CHANGED
@@ -1,2 +1,11 @@
|
|
1
1
|
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rake/testtask'
|
5
|
+
Rake::TestTask.new(:test) do |test|
|
6
|
+
test.libs << 'lib' << 'test'
|
7
|
+
test.pattern = 'test/**/*_test.rb'
|
8
|
+
test.verbose = true
|
9
|
+
end
|
10
|
+
|
11
|
+
task :default => :test
|
data/haml-rails.gemspec
CHANGED
@@ -14,11 +14,12 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.rubyforge_project = "haml-rails"
|
15
15
|
s.required_rubygems_version = ">= 1.3.6"
|
16
16
|
|
17
|
-
s.add_dependency "rails", "~>3.0.0
|
18
|
-
s.add_dependency "haml",
|
19
|
-
|
17
|
+
s.add_dependency "rails", "~> 3.0.0"
|
18
|
+
s.add_dependency "haml", "~> 3.0.18"
|
19
|
+
|
20
|
+
s.add_development_dependency "bundler", "~> 1.0.0"
|
20
21
|
|
21
22
|
s.files = `git ls-files`.split("\n")
|
22
23
|
s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
|
23
24
|
s.require_path = 'lib'
|
24
|
-
end
|
25
|
+
end
|
@@ -1,14 +1,16 @@
|
|
1
|
-
require 'generators/haml'
|
2
1
|
require 'rails/generators/erb/controller/controller_generator'
|
3
2
|
|
4
3
|
module Haml
|
5
4
|
module Generators
|
6
5
|
class ControllerGenerator < Erb::Generators::ControllerGenerator
|
7
|
-
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
8
|
protected
|
9
|
+
|
9
10
|
def handler
|
10
11
|
:haml
|
11
12
|
end
|
13
|
+
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'generators/haml/controller/controller_generator'
|
2
|
+
|
3
|
+
module Haml
|
4
|
+
module Generators
|
5
|
+
class MailerGenerator < ControllerGenerator
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def format
|
11
|
+
:text
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,18 +1,14 @@
|
|
1
|
-
require 'generators/haml'
|
2
1
|
require 'rails/generators/erb/scaffold/scaffold_generator'
|
3
2
|
|
4
3
|
module Haml
|
5
4
|
module Generators
|
6
5
|
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
|
7
|
-
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
7
|
|
9
8
|
def copy_view_files
|
10
|
-
|
11
|
-
views.delete("index") if options[:singleton]
|
12
|
-
|
13
|
-
views.each do |view|
|
9
|
+
available_views.each do |view|
|
14
10
|
filename = filename_with_extensions(view)
|
15
|
-
template
|
11
|
+
template "#{view}.html.haml", File.join("app/views", controller_file_path, filename)
|
16
12
|
end
|
17
13
|
end
|
18
14
|
|
@@ -21,23 +17,20 @@ module Haml
|
|
21
17
|
def copy_form_file
|
22
18
|
if options[:form_builder].nil?
|
23
19
|
filename = filename_with_extensions("_form")
|
24
|
-
template
|
20
|
+
template "_form.html.haml", File.join("app/views", controller_file_path, filename)
|
25
21
|
end
|
26
22
|
end
|
27
23
|
|
28
|
-
|
24
|
+
protected
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
def available_views
|
27
|
+
%w(index edit show new)
|
28
|
+
end
|
33
29
|
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
def handler
|
31
|
+
:haml
|
32
|
+
end
|
37
33
|
|
38
|
-
def template_filename_with_extensions(name)
|
39
|
-
[name, format, handler, :erb].compact.join(".")
|
40
|
-
end
|
41
34
|
end
|
42
35
|
end
|
43
36
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
= form_for @<%= singular_table_name %> do |f|
|
2
|
+
-if @<%= singular_table_name %>.errors.any?
|
3
|
+
#error_explanation
|
4
|
+
%h2= "#{pluralize(@<%= singular_table_name %>.errors.count, "error")} prohibited this <%= singular_table_name %> from being saved:"
|
5
|
+
%ul
|
6
|
+
- @<%= singular_table_name %>.errors.full_messages.each do |msg|
|
7
|
+
%li= msg
|
8
|
+
|
9
|
+
<% for attribute in attributes -%>
|
10
|
+
.field
|
11
|
+
= f.label :<%= attribute.name %>
|
12
|
+
= f.<%= attribute.field_type %> :<%= attribute.name %>
|
13
|
+
<% end -%>
|
14
|
+
.actions
|
15
|
+
= f.submit 'Save'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
%h1 Listing <%= plural_table_name %>
|
2
|
+
|
3
|
+
%table
|
4
|
+
%tr
|
5
|
+
<% for attribute in attributes -%>
|
6
|
+
%th <%= attribute.human_name %>
|
7
|
+
<% end -%>
|
8
|
+
%th
|
9
|
+
%th
|
10
|
+
%th
|
11
|
+
|
12
|
+
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
13
|
+
%tr
|
14
|
+
<% for attribute in attributes -%>
|
15
|
+
%td= <%= singular_table_name %>.<%= attribute.name %>
|
16
|
+
<% end -%>
|
17
|
+
%td= link_to 'Show', <%= singular_table_name %>
|
18
|
+
%td= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
|
19
|
+
%td= link_to 'Destroy', <%= singular_table_name %>, :confirm => 'Are you sure?', :method => :delete
|
20
|
+
|
21
|
+
%br
|
22
|
+
|
23
|
+
= link_to 'New <%= human_name %>', new_<%= singular_table_name %>_path
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%p#notice= notice
|
2
|
+
|
3
|
+
<% for attribute in attributes -%>
|
4
|
+
%p
|
5
|
+
%b <%= attribute.human_name %>:
|
6
|
+
= @<%= singular_table_name %>.<%= attribute.name %>
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
|
10
|
+
\|
|
11
|
+
= link_to 'Back', <%= index_helper %>_path
|
data/lib/haml-rails/version.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
TestApp.routes.draw do |map|
|
2
|
+
# The priority is based upon order of creation:
|
3
|
+
# first created -> highest priority.
|
4
|
+
|
5
|
+
# Sample of regular route:
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
8
|
+
|
9
|
+
# Sample of named route:
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
12
|
+
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
14
|
+
# resources :products
|
15
|
+
|
16
|
+
# Sample resource route with options:
|
17
|
+
# resources :products do
|
18
|
+
# member do
|
19
|
+
# get :short
|
20
|
+
# post :toggle
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# collection do
|
24
|
+
# get :sold
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
# Sample resource route with sub-resources:
|
29
|
+
# resources :products do
|
30
|
+
# resources :comments, :sales
|
31
|
+
# resource :seller
|
32
|
+
# end
|
33
|
+
|
34
|
+
# Sample resource route with more complex sub-resources
|
35
|
+
# resources :products do
|
36
|
+
# resources :comments
|
37
|
+
# resources :sales do
|
38
|
+
# get :recent, :on => :collection
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
|
42
|
+
# Sample resource route within a namespace:
|
43
|
+
# namespace :admin do
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
46
|
+
# resources :products
|
47
|
+
# end
|
48
|
+
|
49
|
+
# You can have the root of your site routed with "root"
|
50
|
+
# just remember to delete public/index.html.
|
51
|
+
# root :to => "welcome#index"
|
52
|
+
|
53
|
+
# See how all your routes lay out with "rake routes"
|
54
|
+
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
58
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'lib/generators/haml/testing_helper'
|
3
|
+
|
4
|
+
class Haml::Generators::ControllerGeneratorTest < Rails::Generators::TestCase
|
5
|
+
destination File.join(Rails.root)
|
6
|
+
tests Rails::Generators::ControllerGenerator
|
7
|
+
arguments %w(Account foo bar --template-engine haml)
|
8
|
+
|
9
|
+
setup :prepare_destination
|
10
|
+
setup :copy_routes
|
11
|
+
|
12
|
+
test "should invoke template engine" do
|
13
|
+
run_generator
|
14
|
+
assert_file "app/views/account/foo.html.haml", %r(app/views/account/foo\.html\.haml)
|
15
|
+
assert_file "app/views/account/bar.html.haml", %r(app/views/account/bar\.html\.haml)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'lib/generators/haml/testing_helper'
|
3
|
+
|
4
|
+
class Haml::Generators::MailerGeneratorTest < Rails::Generators::TestCase
|
5
|
+
destination File.join(Rails.root)
|
6
|
+
tests Rails::Generators::MailerGenerator
|
7
|
+
arguments %w(notifier foo bar --template-engine haml)
|
8
|
+
|
9
|
+
setup :prepare_destination
|
10
|
+
setup :copy_routes
|
11
|
+
|
12
|
+
test "should invoke template engine" do
|
13
|
+
run_generator
|
14
|
+
assert_file "app/views/notifier/foo.text.haml" do |view|
|
15
|
+
assert_match %r(app/views/notifier/foo\.text\.haml), view
|
16
|
+
assert_match /\= @greeting/, view
|
17
|
+
end
|
18
|
+
|
19
|
+
assert_file "app/views/notifier/bar.text.haml" do |view|
|
20
|
+
assert_match %r(app/views/notifier/bar\.text\.haml), view
|
21
|
+
assert_match /\= @greeting/, view
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'lib/generators/haml/testing_helper'
|
3
|
+
|
4
|
+
class Haml::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
|
5
|
+
destination File.join(Rails.root)
|
6
|
+
tests Rails::Generators::ScaffoldGenerator
|
7
|
+
arguments %w(product_line title:string price:integer --template-engine haml)
|
8
|
+
|
9
|
+
setup :prepare_destination
|
10
|
+
setup :copy_routes
|
11
|
+
|
12
|
+
test "should invoke template engine" do
|
13
|
+
run_generator
|
14
|
+
|
15
|
+
%w(index edit new show _form).each { |view| assert_file "app/views/product_lines/#{view}.html.haml" }
|
16
|
+
assert_no_file "app/views/layouts/product_lines.html.haml"
|
17
|
+
end
|
18
|
+
|
19
|
+
test "should revoke template engine" do
|
20
|
+
run_generator
|
21
|
+
run_generator ["product_line"], :behavior => :revoke
|
22
|
+
|
23
|
+
assert_no_file "app/views/product_lines"
|
24
|
+
assert_no_file "app/views/layouts/product_lines.html.haml"
|
25
|
+
end
|
26
|
+
|
27
|
+
test "should invoke form builder" do
|
28
|
+
run_generator %w(product_line title:string price:integer --template-engine haml --form-builder some-form-builder)
|
29
|
+
assert_no_file "app/views/product_lines/_form.html.haml"
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_generators :haml => ['scaffold', 'controller', 'mailer']
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'rails/all'
|
4
|
+
require 'rails/generators'
|
5
|
+
require 'rails/generators/test_case'
|
6
|
+
|
7
|
+
class TestApp < Rails::Application
|
8
|
+
config.root = File.dirname(__FILE__)
|
9
|
+
end
|
10
|
+
Rails.application = TestApp
|
11
|
+
|
12
|
+
module Rails
|
13
|
+
def self.root
|
14
|
+
@root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'rails'))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
Rails.application.config.root = Rails.root
|
18
|
+
|
19
|
+
# Call configure to load the settings from
|
20
|
+
# Rails.application.config.generators to Rails::Generators
|
21
|
+
Rails::Generators.configure!
|
22
|
+
|
23
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
24
|
+
|
25
|
+
def copy_routes
|
26
|
+
routes = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb'))
|
27
|
+
destination = File.join(Rails.root, "config")
|
28
|
+
FileUtils.mkdir_p(destination)
|
29
|
+
FileUtils.cp File.expand_path(routes), destination
|
30
|
+
end
|
31
|
+
|
32
|
+
# Asserts the given class exists in the given content. When a block is given,
|
33
|
+
# it yields the content of the class.
|
34
|
+
#
|
35
|
+
# assert_file "test/functional/accounts_controller_test.rb" do |controller_test|
|
36
|
+
# assert_class "AccountsControllerTest", controller_test do |klass|
|
37
|
+
# assert_match /context "index action"/, klass
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
def assert_class(klass, content)
|
42
|
+
assert content =~ /class #{klass}(\(.+\))?(.*?)\nend/m, "Expected to have class #{klass}"
|
43
|
+
yield $2.strip if block_given?
|
44
|
+
end
|
45
|
+
|
46
|
+
def generator_list
|
47
|
+
{
|
48
|
+
:rails => ['scaffold', 'controller', 'mailer'],
|
49
|
+
:haml => ['scaffold', 'controller', 'mailer']
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
def path_prefix(name)
|
54
|
+
case name
|
55
|
+
when :rails
|
56
|
+
'rails/generators'
|
57
|
+
else
|
58
|
+
'generators'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def require_generators(generator_list)
|
63
|
+
generator_list.each do |name, generators|
|
64
|
+
generators.each do |generator_name|
|
65
|
+
if name.to_s == 'rails' && generator_name.to_s == 'mailer'
|
66
|
+
require File.join(path_prefix(name), generator_name.to_s, "#{generator_name}_generator")
|
67
|
+
else
|
68
|
+
require File.join(path_prefix(name), name.to_s, generator_name.to_s, "#{generator_name}_generator")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
alias :require_generator :require_generators
|
74
|
+
|
75
|
+
require_generators generator_list
|
metadata
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 13
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
version: "0.
|
8
|
+
- 3
|
9
|
+
version: "0.3"
|
9
10
|
platform: ruby
|
10
11
|
authors:
|
11
12
|
- "Andr\xC3\xA9 Arko"
|
@@ -13,51 +14,55 @@ autorequire:
|
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
16
|
|
16
|
-
date: 2010-
|
17
|
+
date: 2010-10-02 00:00:00 -07:00
|
17
18
|
default_executable:
|
18
19
|
dependencies:
|
19
20
|
- !ruby/object:Gem::Dependency
|
20
21
|
name: rails
|
21
22
|
prerelease: false
|
22
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
23
25
|
requirements:
|
24
26
|
- - ~>
|
25
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 7
|
26
29
|
segments:
|
27
30
|
- 3
|
28
31
|
- 0
|
29
32
|
- 0
|
30
|
-
|
31
|
-
version: 3.0.0.rc
|
33
|
+
version: 3.0.0
|
32
34
|
type: :runtime
|
33
35
|
version_requirements: *id001
|
34
36
|
- !ruby/object:Gem::Dependency
|
35
37
|
name: haml
|
36
38
|
prerelease: false
|
37
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
38
41
|
requirements:
|
39
42
|
- - ~>
|
40
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 35
|
41
45
|
segments:
|
42
46
|
- 3
|
43
47
|
- 0
|
44
|
-
|
48
|
+
- 18
|
49
|
+
version: 3.0.18
|
45
50
|
type: :runtime
|
46
51
|
version_requirements: *id002
|
47
52
|
- !ruby/object:Gem::Dependency
|
48
53
|
name: bundler
|
49
54
|
prerelease: false
|
50
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
51
57
|
requirements:
|
52
|
-
- -
|
58
|
+
- - ~>
|
53
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 23
|
54
61
|
segments:
|
55
62
|
- 1
|
56
63
|
- 0
|
57
64
|
- 0
|
58
|
-
|
59
|
-
- 6
|
60
|
-
version: 1.0.0.rc.6
|
65
|
+
version: 1.0.0
|
61
66
|
type: :development
|
62
67
|
version_requirements: *id003
|
63
68
|
description: Haml-rails provides Haml generators for Rails 3. 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.
|
@@ -75,17 +80,24 @@ files:
|
|
75
80
|
- README.md
|
76
81
|
- Rakefile
|
77
82
|
- haml-rails.gemspec
|
78
|
-
- lib/generators/haml.rb
|
79
83
|
- lib/generators/haml/controller/controller_generator.rb
|
80
84
|
- lib/generators/haml/controller/templates/view.html.haml
|
85
|
+
- lib/generators/haml/mailer/mailer_generator.rb
|
86
|
+
- lib/generators/haml/mailer/templates/view.text.haml
|
81
87
|
- lib/generators/haml/scaffold/scaffold_generator.rb
|
82
|
-
- lib/generators/haml/scaffold/templates/_form.html.haml
|
83
|
-
- lib/generators/haml/scaffold/templates/edit.html.haml
|
84
|
-
- lib/generators/haml/scaffold/templates/index.html.haml
|
85
|
-
- lib/generators/haml/scaffold/templates/new.html.haml
|
86
|
-
- lib/generators/haml/scaffold/templates/show.html.haml
|
88
|
+
- lib/generators/haml/scaffold/templates/_form.html.haml
|
89
|
+
- lib/generators/haml/scaffold/templates/edit.html.haml
|
90
|
+
- lib/generators/haml/scaffold/templates/index.html.haml
|
91
|
+
- lib/generators/haml/scaffold/templates/new.html.haml
|
92
|
+
- lib/generators/haml/scaffold/templates/show.html.haml
|
87
93
|
- lib/haml-rails.rb
|
88
94
|
- lib/haml-rails/version.rb
|
95
|
+
- test/fixtures/routes.rb
|
96
|
+
- test/lib/generators/haml/controller_generator_test.rb
|
97
|
+
- test/lib/generators/haml/mailer_generator_test.rb
|
98
|
+
- test/lib/generators/haml/scaffold_generator_test.rb
|
99
|
+
- test/lib/generators/haml/testing_helper.rb
|
100
|
+
- test/test_helper.rb
|
89
101
|
has_rdoc: true
|
90
102
|
homepage: http://github.com/indirect/haml-rails
|
91
103
|
licenses: []
|
@@ -96,16 +108,20 @@ rdoc_options: []
|
|
96
108
|
require_paths:
|
97
109
|
- lib
|
98
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
99
112
|
requirements:
|
100
113
|
- - ">="
|
101
114
|
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
102
116
|
segments:
|
103
117
|
- 0
|
104
118
|
version: "0"
|
105
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
106
121
|
requirements:
|
107
122
|
- - ">="
|
108
123
|
- !ruby/object:Gem::Version
|
124
|
+
hash: 23
|
109
125
|
segments:
|
110
126
|
- 1
|
111
127
|
- 3
|
@@ -114,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
130
|
requirements: []
|
115
131
|
|
116
132
|
rubyforge_project: haml-rails
|
117
|
-
rubygems_version: 1.3.
|
133
|
+
rubygems_version: 1.3.7
|
118
134
|
signing_key:
|
119
135
|
specification_version: 3
|
120
136
|
summary: let your Gemfile do the configuring
|
data/lib/generators/haml.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
= form_for @<%= singular_name %> do |f|
|
2
|
-
-if @<%= singular_name %>.errors.any?
|
3
|
-
#errorExplanation
|
4
|
-
%h2= "#{pluralize(@<%= singular_name %>.errors.count, "error")} prohibited this <%= singular_name %> from being saved:"
|
5
|
-
%ul
|
6
|
-
- @<%= singular_name %>.errors.full_messages.each do |msg|
|
7
|
-
%li= msg
|
8
|
-
|
9
|
-
<% for attribute in attributes -%>
|
10
|
-
.field
|
11
|
-
= f.label :<%= attribute.name %>
|
12
|
-
= f.<%= attribute.field_type %> :<%= attribute.name %>
|
13
|
-
<% end -%>
|
14
|
-
.actions
|
15
|
-
= f.submit 'Save'
|
@@ -1,23 +0,0 @@
|
|
1
|
-
%h1 Listing <%= plural_name %>
|
2
|
-
|
3
|
-
%table
|
4
|
-
%tr
|
5
|
-
<% for attribute in attributes -%>
|
6
|
-
%th <%= attribute.human_name %>
|
7
|
-
<% end -%>
|
8
|
-
%th
|
9
|
-
%th
|
10
|
-
%th
|
11
|
-
|
12
|
-
- @<%= plural_name %>.each do |<%= singular_name %>|
|
13
|
-
%tr
|
14
|
-
<% for attribute in attributes -%>
|
15
|
-
%td= <%= singular_name %>.<%= attribute.name %>
|
16
|
-
<% end -%>
|
17
|
-
%td= link_to 'Show', <%= singular_name %>
|
18
|
-
%td= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>)
|
19
|
-
%td= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete
|
20
|
-
|
21
|
-
%br
|
22
|
-
|
23
|
-
= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path
|