removed doc.json special case

This commit is contained in:
Chris Anderson 2009-01-01 21:07:19 -08:00
parent 71b25a592a
commit f8dd2766d5

View file

@ -227,7 +227,6 @@ module CouchRest
design['language'] = lang if lang design['language'] = lang if lang
@db.save(design) @db.save(design)
push_directory(attachdir, docid) push_directory(attachdir, docid)
push_fields(appdir, docid) push_fields(appdir, docid)
end end
@ -235,7 +234,6 @@ module CouchRest
fields = {} fields = {}
(Dir["#{appdir}/**/*.*"] - (Dir["#{appdir}/**/*.*"] -
Dir["#{appdir}/views/**/*.*"] - Dir["#{appdir}/views/**/*.*"] -
Dir["#{appdir}/doc.json"] -
Dir["#{appdir}/_attachments/**/*.*"]).each do |file| Dir["#{appdir}/_attachments/**/*.*"]).each do |file|
farray = file.sub(appdir, '').sub(/^\//,'').split('/') farray = file.sub(appdir, '').sub(/^\//,'').split('/')
myfield = fields myfield = fields
@ -252,12 +250,8 @@ module CouchRest
myfield[fname] = fguts myfield[fname] = fguts
end end
end end
if File.exists?("#{appdir}/doc.json")
default_json = JSON.parse(File.open("#{appdir}/doc.json").read)
end
design = @db.get(docid) rescue {} design = @db.get(docid) rescue {}
design.merge!(fields) design.merge!(fields)
design.merge!(default_json) if default_json
@db.save(design) @db.save(design)
end end