merb-haml 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008 YOUR NAME
1
+ Copyright (c) 2008 Yehuda Katz
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ GEM_EMAIL = "ykatz@engineyard.com"
17
17
 
18
18
  GEM_NAME = "merb-haml"
19
19
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
20
- GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.7") + PKG_BUILD
20
+ GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.8") + PKG_BUILD
21
21
 
22
22
  RELEASE_NAME = "REL #{GEM_VERSION}"
23
23
 
@@ -35,7 +35,7 @@ spec = Gem::Specification.new do |s|
35
35
  s.author = GEM_AUTHOR
36
36
  s.email = GEM_EMAIL
37
37
  s.homepage = PROJECT_URL
38
- s.add_dependency('merb-core', '>= 0.9.7')
38
+ s.add_dependency('merb-core', '>= 0.9.8')
39
39
  s.add_dependency('haml', '>= 1.8.2')
40
40
  s.require_path = 'lib'
41
41
  s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
@@ -46,15 +46,33 @@ Rake::GemPackageTask.new(spec) do |pkg|
46
46
  end
47
47
 
48
48
  desc "Install the gem"
49
- task :install => [:package] do
50
- sh install_command(GEM_NAME, GEM_VERSION)
49
+ task :install do
50
+ Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
51
51
  end
52
52
 
53
- namespace :jruby do
53
+ desc "Uninstall the gem"
54
+ task :uninstall do
55
+ Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
56
+ end
54
57
 
55
- desc "Run :package and install the resulting .gem with jruby"
56
- task :install => :package do
57
- sh jinstall_command(GEM_NAME, GEM_VERSION)
58
+ desc "Create a gemspec file"
59
+ task :gemspec do
60
+ File.open("#{GEM_NAME}.gemspec", "w") do |file|
61
+ file.puts spec.to_ruby
58
62
  end
63
+ end
59
64
 
65
+ desc "Run all examples (or a specific spec with TASK=xxxx)"
66
+ Spec::Rake::SpecTask.new('spec') do |t|
67
+ t.spec_opts = ["-cfs"]
68
+ t.spec_files = begin
69
+ if ENV["TASK"]
70
+ ENV["TASK"].split(',').map { |task| "spec/**/#{task}_spec.rb" }
71
+ else
72
+ FileList['spec/**/*_spec.rb']
73
+ end
74
+ end
60
75
  end
76
+
77
+ desc 'Default: run spec examples'
78
+ task :default => 'spec'
@@ -6,7 +6,7 @@
6
6
 
7
7
  = error_messages_for :<%= singular_model %>
8
8
 
9
- = form_for(@<%= singular_model %>, :action => url(:<%= plural_model %>) ) do |f|
9
+ = form_for(@<%= singular_model %>, :action => url(:<%= plural_model %>) ) do
10
10
  <% for property in properties.select{|p| !p.key?} -%>
11
11
  %p
12
12
  %b
data/lib/merb-haml.rb CHANGED
@@ -3,12 +3,21 @@ if defined?(Merb::Plugins)
3
3
  require "haml"
4
4
  require "merb-haml/template"
5
5
  Merb::Plugins.add_rakefiles(File.join(File.dirname(__FILE__) / "merb-haml" / "merbtasks"))
6
+
7
+ Merb::Plugins.config[:sass] ||= {}
6
8
 
7
9
  Merb::BootLoader.after_app_loads do
8
- if File.directory?(Merb.dir_for(:stylesheet) / "sass")
10
+
11
+ if File.directory?(Merb::Plugins.config[:sass][:template_location] || Merb.dir_for(:stylesheet) / "sass")
9
12
  require "sass/plugin"
10
- Sass::Plugin.options = Merb::Config[:sass] if Merb::Config[:sass]
13
+ if Merb::Config[:sass]
14
+ Merb.logger.info("Please define your sass settings in Merb::Plugins.config[:sass] not Merb::Config")
15
+ Sass::Plugin.options = Merb::Config[:sass]
16
+ else
17
+ Sass::Plugin.options = Merb::Plugins.config[:sass]
18
+ end
11
19
  end
20
+
12
21
  end
13
22
 
14
23
  # Hack because Haml uses symbolize_keys
@@ -22,5 +31,4 @@ if defined?(Merb::Plugins)
22
31
  Merb.add_generators generators / "resource_controller"
23
32
  Merb.add_generators generators / "controller"
24
33
  Merb.add_generators generators / "layout"
25
-
26
- end
34
+ end
@@ -7,16 +7,17 @@ module Merb::Template
7
7
  # ==== Parameters
8
8
  # path<String>:: Path to the template file.
9
9
  # name<~to_s>:: The name of the template method.
10
+ # locals<Array[Symbol]>:: A list of locals to assign from the args passed into the compiled template.
10
11
  # mod<Class, Module>::
11
12
  # The class or module wherein this method should be defined.
12
- def self.compile_template(io, name, mod)
13
+ def self.compile_template(io, name, locals, mod)
13
14
  path = File.expand_path(io.path)
14
15
  config = (Merb::Plugins.config[:haml] || {}).inject({}) do |c, (k, v)|
15
16
  c[k.to_sym] = v
16
17
  c
17
18
  end.merge :filename => path
18
19
  template = ::Haml::Engine.new(io.read, config)
19
- template.def_method(mod, name)
20
+ template.def_method(mod, name, *locals)
20
21
  name
21
22
  end
22
23
 
@@ -1 +1 @@
1
- %p Partial
1
+ %p= text
@@ -1,2 +1,2 @@
1
1
  #foo
2
- = partial :partial_haml
2
+ = partial :partial_haml, :text => "Partial"
data/spec/haml_spec.rb CHANGED
@@ -6,7 +6,7 @@ describe "HAML" do
6
6
  c.body.should == ::Haml::Engine.new("#foo\n %p Hello").render
7
7
  end
8
8
 
9
- it "should be able to render HAML templates" do
9
+ it "should be able to render HAML templates with locals" do
10
10
  c = dispatch_to(PartialHaml, :index)
11
11
  c.body.should == ::Haml::Engine.new("#foo\n %p Partial").render
12
12
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- $TESTING=true
2
1
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
2
  require "rubygems"
4
3
  require "merb-core"
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.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-12 00:00:00 +03:00
12
+ date: 2008-10-06 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.7
23
+ version: 0.9.8
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: haml