Method: Butler.create

Defined in:
lib/butler.rb

.create(path, botname, opts = {}) ⇒ Object

creates a new bot



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/butler.rb', line 153

def create(path, botname, opts={})
	path     ||= @path
	bot_path   = "#{path.bots}/#{botname}"
	Structure.each { |dir, mode|
		FileUtils.mkdir_p(dir.sub(/BOTPATH/, bot_path),	:mode => mode)
	}
	conf = Configuration.new(
		ConfigurationStructure.first.sub(/BOTPATH/, bot_path),
		ConfigurationStructure[1..-1]
	)
	EmptyConfig.each { |k,v|
		conf[k] = v
	}
	FileUtils.cp_r(path.plugin_repository, bot_path)
	FileUtils.cp_r(path.service_repository, bot_path)
end