lib/bently/recipe.rb in bently-1.0.0 vs lib/bently/recipe.rb in bently-1.0.1

- old
+ new

@@ -84,11 +84,11 @@ def self.breakdown new.operations end - def self.name(name) @name ||= name; end + def self.title(n) @title ||= n; end def self.category(category) @category ||= category; end def self.description(description) @description ||= description; end def self.homepage(homepage=nil) @homepage ||= homepage; end def self.version(version) @version ||= version; end @@ -104,7 +104,21 @@ def remove(*args) ; operations << Remove.new(*args) end def operate(op, *args) ; operations << op.new(*args) end def todo(name) ; say(name, 'TODO', :red) end def warn(text) ; say(text, 'WARNING', :red) end def requirement(text) ; say(text, 'REQUIRED', :red) end + def usage(text) ; say(text, 'USAGE', :red) end + def code(text) ; text.each_line.each_with_index{|l,i| say(l, i+1, :magenta) } end + + protected + + def template name + f = "#{BENTLY_REPOSITORY}/lib/bently/template/#{file_name}/#{name}" + File.read(f) + end + + def file_name + string = self.class.instance_method(:initialize).source_location[0] + string = string.split('/').last.split('.').first + end end end