Skip to content

Commit

Permalink
Coupla bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neighman committed Jun 20, 2010
1 parent 220527a commit 4348229
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/pancake/mixins/render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def template(name, opts = {})
when Template
name
when String, Symbol

template_names = case __template = _template_name_for(name, opts)
when String, Symbol
[__template]
Expand Down Expand Up @@ -176,7 +175,7 @@ def _template_name_for(name, opts = {})
end

def _partial_template_name_for(name, opts)
"_#{_template_name_for(name, opts)}"
"_#{name}"
end
end # InstanceMethods
end # Render
Expand Down
18 changes: 9 additions & 9 deletions lib/pancake/stack/stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Pancake
class Stack
attr_accessor :app_name

class_inheritable_array :_after_stack_initialze, :_after_build_stack, :_before_build_stack
self._after_stack_initialze = []
class_inheritable_array :_after_stack_initialize, :_after_build_stack, :_before_build_stack
self._after_stack_initialize = []
self._after_build_stack = []
self._before_build_stack = []

Expand All @@ -23,7 +23,6 @@ class Stack

#Iterates the list of roots in the stack, and initializes the app found their
def self.initialize_stack(opts = {})
return if @initialized
raise "Stack root not set" if roots.empty?
master = opts.delete(:master)
set_as_master! if master
Expand All @@ -37,13 +36,13 @@ def self.initialize_stack(opts = {})
set_as_master! if master
@initialized = true
# run the hook for after mounting
after_stack_initialze.each{ |blk| blk.call(self) }
after_stack_initialize.each{ |blk| blk.call(self) }
end # initiailze stack


def self.after_stack_initialze(&blk)
_after_stack_initialze << blk if blk
_after_stack_initialze
def self.after_stack_initialize(&blk)
_after_stack_initialize << blk if blk
_after_stack_initialize
end

def self.after_build_stack(&blk)
Expand Down Expand Up @@ -94,7 +93,7 @@ def initialize(app = nil, opts = {})

@app ||= self.class.new_endpoint_instance

self.class.before_build_stack{|b| b.call(self, @app_name, opts)}
self.class.before_build_stack.each{|b| b.call(self, @app_name, opts)}

mwares = self.class.middlewares

Expand All @@ -103,8 +102,9 @@ def initialize(app = nil, opts = {})
app_config.stack = self.class
app_config.router.configuration = app_config
router = Pancake.configuration.configs[@app_name].router
router.mount_applications!
router.default(@stack)
self.class.after_build_stack{ |blk| blk.call(self, @app_name, opts) }
self.class.after_build_stack.each{ |blk| blk.call(self, @app_name, opts) }
end

# Construct a stack using the application, wrapped in the middlewares
Expand Down

0 comments on commit 4348229

Please sign in to comment.