class CPEE::ModelManagement::CreateDir
Public Instance Methods
response()
click to toggle source
# File lib/cpee-model-management/implementation.rb, line 330 def response name = @p[0].value conns = @a[0] models = @a[1] fname = File.join(models,name + '.dir') counter = 0 while File.exists?(fname) counter += 1 fname = File.join(models,name + counter.to_s + '.dir') end dn = CPEE::ModelManagement::get_dn @h['DN'] creator = dn['GN'] + ' ' + dn['SN'] Dir.mkdir(fname) FileUtils.touch(File.join(fname,'.gitignore')) attrs = JSON::load File.open(fname + '.attrs') attrs['creator'] = creator attrs['author'] = creator File.write(fname + '.attrs',JSON::pretty_generate(attrs)) CPEE::ModelManagement::op creator, 'add', models, name + '.dir' CPEE::ModelManagement::notify conns, 'create', models, fname nil end