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.
750 751 752 |
# File 'lib/buildr/core/project.rb', line 750 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.
743 744 745 |
# File 'lib/buildr/core/project.rb', line 743 def before_define(&block) callbacks.send :define_method, :before_define, &block end |
#extended(base) ⇒ Object
:nodoc:
724 725 726 727 728 729 730 731 |
# File 'lib/buildr/core/project.rb', line 724 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.
735 736 737 738 |
# File 'lib/buildr/core/project.rb', line 735 def first_time(&block) = class << callbacks ; self ; end .send :define_method, :first_time, &block end |
#included(base) ⇒ Object
:nodoc:
716 717 718 719 720 721 722 |
# File 'lib/buildr/core/project.rb', line 716 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 |