merb-haml 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
 
4
4
  PLUGIN = "merb-haml"
5
5
  NAME = "merb-haml"
6
- VERSION = "0.9.2"
6
+ VERSION = "0.9.3"
7
7
  AUTHOR = "Yehuda Katz"
8
8
  EMAIL = "ykatz@engineyard.com"
9
9
  HOMEPAGE = "http://merb-plugins.rubyforge.org/merb-haml/"
@@ -20,25 +20,28 @@ spec = Gem::Specification.new do |s|
20
20
  s.author = AUTHOR
21
21
  s.email = EMAIL
22
22
  s.homepage = HOMEPAGE
23
- s.add_dependency('merb-core', '>= 0.9.2')
23
+ s.add_dependency('merb-core', '>= 0.9.3')
24
+ s.add_dependency('haml', '>= 1.8.2')
24
25
  s.require_path = 'lib'
25
26
  s.autorequire = PLUGIN
26
- s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*")
27
+ s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
27
28
  end
28
29
 
29
30
  Rake::GemPackageTask.new(spec) do |pkg|
30
31
  pkg.gem_spec = spec
31
32
  end
32
33
 
34
+ install_home = ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : ""
35
+
33
36
  task :install => [:package] do
34
- sh %{sudo gem install pkg/#{NAME}-#{VERSION} --no-update-sources}
37
+ sh %{sudo gem install #{install_home} pkg/#{NAME}-#{VERSION} --no-update-sources}
35
38
  end
36
39
 
37
40
  namespace :jruby do
38
41
 
39
42
  desc "Run :package and install the resulting .gem with jruby"
40
43
  task :install => :package do
41
- sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
44
+ sh %{#{SUDO} jruby -S gem install #{install_home} pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
42
45
  end
43
46
 
44
47
  end
@@ -0,0 +1,31 @@
1
+ class HamlController < Merb::Controller
2
+ self._template_root = File.dirname(__FILE__) / "views"
3
+ def index
4
+ render
5
+ end
6
+ end
7
+
8
+ class PartialHaml < HamlController
9
+ end
10
+
11
+ class HamlConfig < HamlController
12
+ end
13
+
14
+ class PartialIvars < HamlController
15
+ def index
16
+ @var1 = "Partial"
17
+ render
18
+ end
19
+ end
20
+
21
+ class CaptureHaml < HamlController
22
+ end
23
+
24
+ module Merb::ConcatHamlHelper
25
+ def concatter(&blk)
26
+ concat("<p>Concat</p>", blk.binding)
27
+ end
28
+ end
29
+
30
+ class ConcatHaml < HamlController
31
+ end
@@ -0,0 +1,3 @@
1
+ - x = capture do
2
+ %p Hello
3
+ = x
@@ -0,0 +1,2 @@
1
+ - concatter do
2
+ Hello
@@ -0,0 +1,2 @@
1
+ #foo
2
+ %foo
@@ -0,0 +1,2 @@
1
+ #foo
2
+ %p Hello
@@ -0,0 +1,2 @@
1
+ #foo
2
+ = partial :partial_haml
@@ -0,0 +1 @@
1
+ %p== #{@var1} #{@var2}
@@ -0,0 +1,3 @@
1
+ #foo
2
+ - @var2 = "HAML"
3
+ = partial :partial_haml
data/spec/haml_spec.rb ADDED
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "HAML" do
4
+ it "should be able to render HAML templates" do
5
+ c = dispatch_to(HamlController, :index)
6
+ c.body.should == ::Haml::Engine.new("#foo\n %p Hello").render
7
+ end
8
+
9
+ it "should be able to render HAML templates" do
10
+ c = dispatch_to(PartialHaml, :index)
11
+ c.body.should == ::Haml::Engine.new("#foo\n %p Partial").render
12
+ end
13
+
14
+ it "should use the haml configuration in Merb::Config" do
15
+ c = dispatch_to(HamlConfig, :index)
16
+ c.body.should == ::Haml::Engine.new("#foo\n %foo", :autoclose => ["foo"]).render
17
+ end
18
+
19
+ it "should be able to have ivars defined in both the controller and the parent template" do
20
+ c = dispatch_to(PartialIvars, :index)
21
+ c.body.should == ::Haml::Engine.new("#foo\n %p Partial HAML").render
22
+ end
23
+
24
+ it "should support capture" do
25
+ c = dispatch_to(CaptureHaml, :index)
26
+ c.body.should == "<p>Hello</p>\n"
27
+ end
28
+
29
+ it "should support concat" do
30
+ c = dispatch_to(ConcatHaml, :index)
31
+ c.body.should == "<p>Concat</p>"
32
+ end
33
+ end
@@ -0,0 +1,15 @@
1
+ $TESTING=true
2
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require "rubygems"
4
+ require "merb-core"
5
+ require "spec"
6
+
7
+ require "merb-haml"
8
+ require File.dirname(__FILE__) / "controllers" / "haml"
9
+
10
+ Merb::Plugins.config[:haml] = { "autoclose" => ["foo"] }
11
+ Merb.start :environment => 'test'
12
+
13
+ Spec::Runner.configure do |config|
14
+ config.include Merb::Test::RequestHelper
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
@@ -9,7 +9,7 @@ autorequire: merb-haml
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-24 00:00:00 -05:00
12
+ date: 2008-05-04 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -19,7 +19,16 @@ dependencies:
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.9.2
22
+ version: 0.9.3
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: haml
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 1.8.2
23
32
  version:
24
33
  description: Merb plugin that provides HAML support
25
34
  email: ykatz@engineyard.com
@@ -40,6 +49,25 @@ files:
40
49
  - lib/merb-haml/merbtasks.rb
41
50
  - lib/merb-haml/template.rb
42
51
  - lib/merb-haml.rb
52
+ - spec/controllers
53
+ - spec/controllers/haml.rb
54
+ - spec/controllers/views
55
+ - spec/controllers/views/capture_haml
56
+ - spec/controllers/views/capture_haml/index.html.haml
57
+ - spec/controllers/views/concat_haml
58
+ - spec/controllers/views/concat_haml/index.html.haml
59
+ - spec/controllers/views/haml_config
60
+ - spec/controllers/views/haml_config/index.html.haml
61
+ - spec/controllers/views/haml_controller
62
+ - spec/controllers/views/haml_controller/index.html.haml
63
+ - spec/controllers/views/partial_haml
64
+ - spec/controllers/views/partial_haml/_partial_haml.html.haml
65
+ - spec/controllers/views/partial_haml/index.html.haml
66
+ - spec/controllers/views/partial_ivars
67
+ - spec/controllers/views/partial_ivars/_partial_haml.html.haml
68
+ - spec/controllers/views/partial_ivars/index.html.haml
69
+ - spec/haml_spec.rb
70
+ - spec/spec_helper.rb
43
71
  has_rdoc: true
44
72
  homepage: http://merb-plugins.rubyforge.org/merb-haml/
45
73
  post_install_message: