class Chake::ConfigManager
Attributes
Public Class Methods
Source
# File lib/chake/config_manager.rb, line 64 def self.accept?(_node) false end
Source
# File lib/chake/config_manager.rb, line 55 def self.get(node) available = @subclasses.sort_by(&:priority) manager = available.find { |c| c.short_name == node.data['config_manager'] } manager ||= available.find { |c| c.accept?(node) } raise ArgumentError, "Can't find configuration manager class for node #{node.hostname}. Available: #{available}.join(', ')}" unless manager manager.new(node) end
Source
# File lib/chake/config_manager.rb, line 49 def self.inherited(klass) super @subclasses ||= [] @subclasses << klass end
Calls superclass method
Source
# File lib/chake/config_manager.rb, line 72 def self.init skel = Pathname(__FILE__).parent / 'config_manager' / 'skel' / short_name skel.glob('**/*').each do |source| target = source.relative_path_from(skel) if target.exist? puts "exists: #{target}" else if source.directory? FileUtils.mkdir_p target else FileUtils.cp source, target end puts "create: #{target}" end end end
Source
# File lib/chake/config_manager.rb, line 45 def self.priority(new_priority = nil) @priority ||= new_priority || 50 end
Source
# File lib/chake/config_manager.rb, line 37 def self.short_name name.split('::').last.gsub(/([[:lower:]])([[:upper:]])/) do first = Regexp.last_match(1) last = Regexp.last_match(2).downcase "#{first}-#{last}" end.downcase end
Public Instance Methods
Source
# File lib/chake/config_manager.rb, line 27 def bootstrap_steps base = File.join(File.absolute_path(File.dirname(__FILE__)), 'bootstrap') steps = Dir[File.join(base, '*.sh')] + Dir[File.join(base, name, '*.sh')] steps.sort_by { |f| File.basename(f) } end
Source
# File lib/chake/config_manager.rb, line 15 def path "/var/tmp/#{name}.#{node.username}" end