Sha256: 4f11eb2e33590206ba2eb71cfb8f1c0b65d52aae84308fbc3538230882e02172
Contents?: true
Size: 1008 Bytes
Versions: 2
Compression:
Stored size: 1008 Bytes
Contents
require 'active_support/inflector' require 'blazing/cli_logging' class Blazing::Recipe include Blazing::CLILogging 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blazing-0.1.0 | lib/blazing/recipe.rb |
blazing-0.1.0.alpha6 | lib/blazing/recipe.rb |