Module: Buildr::Extension::ClassMethods
- Defined in:
- lib/buildr/core/project.rb
Overview
Methods added to the extension module when including Extension.
Instance Method Summary collapse
-
#after_define(&block) ⇒ Object
This block is called once for the project with the project instance, right after running the project definition.
-
#before_define(&block) ⇒ Object
This block is called once for the project with the project instance, right before running the project definition.
-
#extended(base) ⇒ Object
:nodoc:.
-
#first_time(&block) ⇒ Object
This block will be called once for any particular extension.
-
#included(base) ⇒ Object
:nodoc:.
Instance Method Details
#after_define(&block) ⇒ Object
This block is called once for the project with the project instance, right after running the project definition. You can use this to do any post-processing that depends on the project definition.
749 750 751 |
# File 'lib/buildr/core/project.rb', line 749 def after_define(&block) callbacks.send :define_method, :after_define, &block end |
#before_define(&block) ⇒ Object
This block is called once for the project with the project instance, right before running the project definition. You can use this to add tasks and set properties that will be used in the project definition.
742 743 744 |
# File 'lib/buildr/core/project.rb', line 742 def before_define(&block) callbacks.send :define_method, :before_define, &block end |
#extended(base) ⇒ Object
:nodoc:
723 724 725 726 727 728 729 730 |
# File 'lib/buildr/core/project.rb', line 723 def extended(base) #:nodoc: # When extending project, add instance and call before_define. if Project === base callbacks = self.send(:callbacks).new callbacks.before_define(base) if callbacks.respond_to?(:before_define) base.send :add_callback, callbacks end end |
#first_time(&block) ⇒ Object
This block will be called once for any particular extension. You can use this to setup top-level and local tasks.
734 735 736 737 |
# File 'lib/buildr/core/project.rb', line 734 def first_time(&block) = class << callbacks ; self ; end .send :define_method, :first_time, &block end |
#included(base) ⇒ Object
:nodoc:
715 716 717 718 719 720 721 |
# File 'lib/buildr/core/project.rb', line 715 def included(base) #:nodoc: # When included in Project, add callback and call first_time. if Project == base && !base.callbacks.include?(callbacks) base.callbacks << callbacks callbacks.first_time if callbacks.respond_to?(:first_time) end end |