Sha256: e557089f230fc742cbfec9ecdf001dc257798de304587afd40a5562b709e176a
Contents?: true
Size: 947 Bytes
Versions: 1
Compression:
Stored size: 947 Bytes
Contents
require 'active_support/inflector' class Blazing::Recipe attr_reader :options def initialize(options = {}) @options = options end class << self def init_by_name(name, options = {}) "Blazing::Recipe::#{name.to_s.camelize}".constantize.new(options) end def list descendants = [] ObjectSpace.each_object(Class) do |k| descendants.unshift k if k < self end descendants end def load_gem_recipes # TODO: I'm sure there is a better way to do this... gems = open('Gemfile').grep(/blazing-/).map { |l| l.match(/(blazing-.*)\'\,/)[1] } gems.each do |gem| gem_lib_path = $:.find { |p| p.include? gem } recipes_path = File.join(gem_lib_path, gem, 'recipes') recipes = Dir.entries(recipes_path).delete_if { |r| r == '.' || r == '..' } recipes.each { |recipe| require File.join(gem, 'recipes', recipe) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blazing-0.1.0.alpha5 | lib/blazing/recipe.rb |