Module: BaseChip::Base::InstanceMethods
- Defined in:
- lib/base_chip/base.rb
Instance Method Summary collapse
- #configure ⇒ Object
- #discover_configurations ⇒ Object
- #file_glob(glob, regex = nil, type = nil) ⇒ Object
- #foster=(parent) ⇒ Object
- #parent=(parent) ⇒ Object
- #update_chaining ⇒ Object
Instance Method Details
#configure ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/base_chip/base.rb', line 60 def configure return if @configured super # if self.class.children_types.keys.include?(:tool) && self.tools # self.tools.each_value do |t| # t.configure # t.selected_version.configure # t.selected_version.actions.each do |n,a| # self.actions ||= {} # if self.actions[n] # self.actions[n].blks = a.blks + self.actions[n].blks # self.actions[n].foster ||= a.parent # else # self.actions[n] = a.clone # self.actions[n].blks = self.actions[n].blks.dup # self.actions[n].foster = a.parent # self.actions[n].parent = self # end # end # end # end end |
#discover_configurations ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/base_chip/base.rb', line 83 def discover_configurations Dir.glob("#{BaseChip.root}/*/base_chip/configuration.rb").each do |f| if f =~ /(\w+)\/base_chip\/configuration\.rb$/ self.block($1.to_sym) {|b| b.file f} end end end |
#file_glob(glob, regex = nil, type = nil) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/base_chip/base.rb', line 90 def file_glob(glob, regex = nil, type = nil) Dir.glob(glob).each do |f| if regex if f =~ regex self.send(type, $1.to_sym) { |t| t.file(f) } else fault "fileglob '#{glob}' did not match regex /#{regex}/ in #{self.name}" end else self.file(f) end end end |
#foster=(parent) ⇒ Object
45 |
# File 'lib/base_chip/base.rb', line 45 def foster=(parent); @foster = parent; update_chaining; end |
#parent=(parent) ⇒ Object
44 |
# File 'lib/base_chip/base.rb', line 44 def parent=(parent); @parent = parent; update_chaining; end |
#update_chaining ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/base_chip/base.rb', line 46 def update_chaining # chain blocks, projects, and actions together @project ||= (self.is_a? BaseChip::Project ) ? self : ((parent.project if parent) || (foster.project if foster)) @block ||= (self.is_a? BaseChip::Block ) ? self : ((parent.block if parent) || (foster.block if foster)) @configuration ||= (self.is_a? BaseChip::Configuration ) ? self : ((parent.configuration if parent) || (foster.configuration if foster)) @action ||= (self.is_a? BaseChip::Action ) ? self : ((parent.action if parent) || (foster.action if foster)) @test_list ||= (self.is_a? BaseChip::TestList ) ? self : ((parent.test_list if parent) || (foster.test_list if foster)) @test ||= (self.is_a? BaseChip::Test ) ? self : ((parent.test if parent) || (foster.test if foster)) @tool ||= (self.is_a? BaseChip::Tool ) ? self : ((parent.tool if parent) || (foster.tool if foster)) @tool_version ||= (self.is_a? BaseChip::ToolVersion ) ? self : ((parent.tool_version if parent) || (foster.tool_version if foster)) @source_type ||= (self.is_a? BaseChip::SourceType ) ? self : ((parent.source_type if parent) || (foster.source_type if foster)) @source_language ||= (self.is_a? BaseChip::SourceLanguage) ? self : ((parent.source_language if parent) || (foster.source_language if foster)) end |