tadpole 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ module Tadpole
9
9
  super
10
10
 
11
11
  erb = ERB.new(content, nil, '<>')
12
- instance_eval(<<-eof, full_path, -4)
12
+ instance_eval(<<-eof, full_path, -2)
13
13
  def render(locals = nil, &block)
14
14
  if locals
15
15
  opts = owner.options
@@ -11,7 +11,7 @@ module Tadpole
11
11
  end
12
12
 
13
13
  class SectionProvider
14
- attr_accessor :owner, :content
14
+ attr_accessor :owner, :content, :full_path
15
15
 
16
16
  EXTENSIONS = []
17
17
 
@@ -42,6 +42,7 @@ module Tadpole
42
42
  end
43
43
 
44
44
  def initialize(full_path, owner = nil)
45
+ self.full_path = full_path
45
46
  self.owner = owner
46
47
  self.content = File.read(full_path)
47
48
  end
@@ -7,6 +7,7 @@ module Tadpole
7
7
 
8
8
  def initialize(full_path, owner)
9
9
  self.owner = owner
10
+ self.full_path = full_path
10
11
  Tadpole.template_paths.each do |template_path|
11
12
  if full_path.index(template_path) == 0
12
13
  path = full_path[template_path.length..-1]
@@ -123,14 +123,19 @@ module Tadpole
123
123
  self.options = old_opts
124
124
  out
125
125
  rescue => e
126
- me = NoMethodError.new("In #{self.inspect}: #{e.message}")
127
- me.set_backtrace(e.backtrace)
126
+ provider = find_section_provider(current_section)
127
+ line = provider.full_path
128
+ line += " (template)" if provider.is_a?(SectionProviders::TemplateProvider)
129
+ line += ":1:in#{@compiled_sections ? ' compiled' : ''} section `#{current_section}'"
130
+ me = NoMethodError.new(e.message)
131
+ me.set_backtrace([line] + e.backtrace)
128
132
  raise me
129
133
  end
130
134
  alias to_s run
131
135
 
132
136
  def run_sections(sects, break_first = false, locals = {}, &block)
133
137
  out = ''
138
+ raise ArgumentError, "Template(#{path}) is missing sections" unless sects
134
139
  sects = sects.first if sects.first.is_a?(Array)
135
140
  sects.each_with_index do |section, i|
136
141
  (break_first ? break : next) if section.is_a?(Array)
data/lib/tadpole.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
 
3
3
  module Tadpole
4
- Version = '0.1.1'
4
+ Version = '0.1.2'
5
5
  Root = File.dirname(__FILE__)
6
6
 
7
7
  module SectionProviders
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tadpole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loren Segal
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-09 00:00:00 -04:00
12
+ date: 2009-07-10 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15