class CookbookCreator::Generator::Context
This is here to hold attr_accessor data for Generator
context variables
Public Class Methods
add_attr(name)
click to toggle source
# File lib/cookbook_creator/generator.rb, line 16 def self.add_attr(name) @attributes ||= [ ] if !@attributes.include?(name) @attributes << name attr_accessor(name) end end
cookbook_full_path()
click to toggle source
# File lib/cookbook_creator/generator.rb, line 29 def self.cookbook_full_path File.expand_path(cookbook_name_or_path, Dir.pwd) end
cookbook_name()
click to toggle source
# File lib/cookbook_creator/generator.rb, line 46 def self.cookbook_name File.basename(cookbook_full_path) end
cookbook_name_or_path()
click to toggle source
# File lib/cookbook_creator/generator.rb, line 33 def self.cookbook_name_or_path name = ARGV[0] File.expand_path(name, Dir.pwd) end
cookbook_root()
click to toggle source
# File lib/cookbook_creator/generator.rb, line 25 def self.cookbook_root File.dirname(cookbook_full_path) end
have_git?()
click to toggle source
# File lib/cookbook_creator/generator.rb, line 50 def self.have_git? path = ENV["PATH"] || "" paths = path.split(File::PATH_SEPARATOR) paths.any? {|bin_path| File.exist?(File.join(bin_path, "git#{RbConfig::CONFIG['EXEEXT']}"))} end
recipe()
click to toggle source
# File lib/cookbook_creator/generator.rb, line 38 def self.recipe "cookbook" end
recipe_name()
click to toggle source
# File lib/cookbook_creator/generator.rb, line 42 def self.recipe_name "default" end
reset()
click to toggle source
# File lib/cookbook_creator/generator.rb, line 56 def self.reset return if @attributes.nil? @attributes.each do |attr| remove_method(attr) end @attributes = nil end