Sha256: ef40ffe8cfc1d7771aa9b4d74e8c43789464a02144dae790e28f92749db7e35c
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'active_support/inflector' class Blazing::Recipe include Blazing::Logger attr_reader :options def initialize(options = {}) @options = options end def run(target_options = {}) @options.merge! target_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_recipes load_recipe_gems(parse_gemfile) end def parse_gemfile(gemfile = 'Gemfile') open(gemfile).grep(/blazing-/).map { |l| l.match(/blazing-(\w+)/)[0] } end def load_recipe_gems(gems) 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blazing-0.2.7 | lib/blazing/recipe.rb |
blazing-0.2.6 | lib/blazing/recipe.rb |
blazing-0.2.5 | lib/blazing/recipe.rb |