diff --git a/bin/pancake b/bin/pancake index 49070f1..86d6ebb 100755 --- a/bin/pancake +++ b/bin/pancake @@ -24,6 +24,10 @@ desc "list [SEARCH]", "List the available pancake tasks (--substring means .*SEA def method_missing(meth, *args, &blk) klass, task = Thor::Util.find_class_and_task_by_namespace(meth.to_s) + unless klass + puts "Could not find a generator for #{meth.to_s}" + exit(1) + end args.unshift(task) if task klass.start(args, :shell => self.shell) end diff --git a/lib/pancake/core_ext/object.rb b/lib/pancake/core_ext/object.rb index 66c079b..d585f7a 100644 --- a/lib/pancake/core_ext/object.rb +++ b/lib/pancake/core_ext/object.rb @@ -19,4 +19,4 @@ def instance_exec(*args, &block) ret end end -end \ No newline at end of file +end diff --git a/lib/pancake/hooks/inheritable_inner_classes.rb b/lib/pancake/hooks/inheritable_inner_classes.rb index 1da5fec..d3e203a 100644 --- a/lib/pancake/hooks/inheritable_inner_classes.rb +++ b/lib/pancake/hooks/inheritable_inner_classes.rb @@ -3,8 +3,9 @@ module Hooks module InheritableInnerClasses def self.extended(base) base.class_eval do - extlib_inheritable_reader :_inhertiable_inner_classes - @_inhertiable_inner_classes = [] + extlib_inheritable_reader :_inhertiable_inner_classes, :_before_inner_class_inheritance + @_inhertiable_inner_classes = [] + @_before_inner_class_inheritance = [] end end # extended @@ -40,6 +41,16 @@ def inheritable_inner_classes(*classes) _inhertiable_inner_classes end + # Runs any hooks before the inheritance of any inner classes + # + # @api public + # @since 0.3.0 + # @author Daniel Neighman + def before_inner_class_inheritance(&blk) + _before_inner_class_inheritance << blk if blk + _before_inner_class_inheritance + end + # The inherited hook that sets up inherited inner classes. Remember if you overwrite this method, you should # call super! # @@ -49,11 +60,13 @@ def inheritable_inner_classes(*classes) def inherited(base) super class_defs = inheritable_inner_classes.map do |klass| + _before_inner_class_inheritance.each{|blk| blk.call(base.superclass) } "class #{klass} < superclass::#{klass}; end\n" end base.class_eval(class_defs.join) end + end # InheritableInnerClasses end # Hooks end # Pancake diff --git a/lib/pancake/stack/stack.rb b/lib/pancake/stack/stack.rb index 07d31bd..831817e 100644 --- a/lib/pancake/stack/stack.rb +++ b/lib/pancake/stack/stack.rb @@ -23,6 +23,7 @@ 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