Sha256: 39c8235593d66530725b1a94f7a8283232014db6d4b9a3c4496b315cb0a5a7d7
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
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_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.1.3 | lib/blazing/recipe.rb |
blazing-0.1.2 | lib/blazing/recipe.rb |
blazing-0.1.1 | lib/blazing/recipe.rb |