Sha256: 84cb046da16d25a7fcc3a2b32dff72e3b22c9a021eb228ce0bd8b9428c24d475
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
require 'active_support/inflector' class Blazing::Recipe 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
blazing-0.2.4 | lib/blazing/recipe.rb |
blazing-0.2.3 | lib/blazing/recipe.rb |
blazing-0.2.2 | lib/blazing/recipe.rb |
blazing-0.2.1 | lib/blazing/recipe.rb |