module BaseChip
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Copyright 2011 Tommy Poulter
This file is part of basechip.
basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.
Constants
- GEM_DIR
- RANDOM_NAME_PIECES
- RANDOM_NAME_PIECES_SIZE
Public Class Methods
# File lib/base_chip.rb, line 166 def self.actions ; @actions ||= get_children(self.configurations , :actions ) end
# File lib/base_chip.rb, line 99 def self. block_directories ; @@block_directories end
# File lib/base_chip.rb, line 151 def self.blocks @project.blocks.values end
# File lib/base_chip.rb, line 85 def self.build_directory_structure(dir, array) array.each do |subdir| FileUtils.mkdir_p dir + "/" + subdir end end
# File lib/base_chip.rb, line 100 def self.configuration_directories ; @@configuration_directories end
# File lib/base_chip.rb, line 165 def self.configurations ; @configurations ||= get_children(self.blocks , :configurations) end
# File lib/base_chip.rb, line 90 def self.erb_template(in_file, out_file) erb = ERB.new(File.read in_file) erb.filename = in_file File.open(out_file,'w') do |f| f.print(erb.result) end end
# File lib/base_chip.rb, line 67 def self.find_root(dir = nil, passive=false) dir ||= @work_dir ||= Dir.pwd @dirs_to_top = [] loop do @dirs_to_top << dir break if File.exist? dir + '/base_chip/settings.rb' if dir == '/' return nil if passive fault "Couldn't find file 'base_chip/settings.rb' in any directory above #{Dir.pwd}.\n" + "'base_chip/settings.rb' is expected to reside at the top of the checked " + "out project, and is generated using the command 'base_chip init'." end dir = File.expand_path(dir + '/../') end $project_root = @root = dir end
# File lib/base_chip.rb, line 154 def self.get_children(parents, child_name) a = [] parents.each do |item| item.configure tmp = item.send(child_name) next unless tmp a += tmp.values end a.uniq! a end
SAFE TO DELETE? def self.action(name, &b) SAFE TO DELETE? @action_builders ||= {} SAFE TO DELETE? @action_builders ||= [] SAFE TO DELETE? @action_builders << b SAFE TO DELETE? end
# File lib/base_chip.rb, line 142 def self.load_environment find_root file = "#{BaseChip.root}/base_chip/settings.rb" instance_eval(File.read(file),file) file = '~/.basechip' instance_eval(File.read(file),file) if File.exist? file @project.configure end
# File lib/base_chip.rb, line 183 def self.new_random_generator if @@options.seed random_generator else Random.new(random_generator.rand(0x1_0000_0000)) end end
# File lib/base_chip.rb, line 63 def self.options @@options end
# File lib/base_chip.rb, line 128 def self.project(name = nil, &blk) if name @project = Project.new @project.name = name @project.blks << blk else @project end end
# File lib/base_chip.rb, line 60 def self.project=(project) ; @project = project ; end
# File lib/base_chip.rb, line 98 def self. project_directories ; @@project_directories end
# File lib/base_chip.rb, line 176 def self.random_generator @@random_generator ||= if @@options.seed Random.new(@@options.seed ) else Random.new(rand(0x1_0000_0000)) end end
# File lib/base_chip.rb, line 49 def self.random_string(size=10) str = '' size.times do str += RANDOM_NAME_PIECES[rand(RANDOM_NAME_PIECES_SIZE)] end str end
# File lib/base_chip.rb, line 59 def self.root ; @root ; end
# File lib/base_chip.rb, line 58 def self.root=(root) ; @root = root ; end
# File lib/base_chip.rb, line 167 def self.test_lists ; @test_lists ||= get_children(self.configurations , :test_lists ) end
# File lib/base_chip.rb, line 168 def self.tests ; @tests ||= get_children(self.test_lists , :tests ) end
# File lib/base_chip.rb, line 169 def self.tools ; @tools ||= get_children(self.configurations , :tools ) end
# File lib/base_chip.rb, line 171 def self.version_control @version_control ||= (Git.new(root) if File.exist?("#{root}/.git")) end