don't error when the given directories don't exist

This commit is contained in:
Matt Lyon 2009-01-04 03:28:08 -08:00
parent 189cd910a3
commit eca3b06461
2 changed files with 7 additions and 2 deletions

View file

@ -26,8 +26,8 @@ module CouchRest
attachdir = File.join(appdir,"_attachments")
@doc = dir_to_fields(appdir)
package_forms(@doc["forms"])
package_views(@doc["views"])
package_forms(@doc["forms"]) if @doc['forms']
package_views(@doc["views"]) if @doc['views']
docid = "_design/#{appname}"
design = @db.get(docid) rescue {}

View file

@ -108,6 +108,11 @@ describe CouchRest::FileManager, "pushing an app" do
doc = @db.get("_design/couchapp")
doc['magical'].should == "so magic"
end
it "handles not having a forms directory" do
`rm -rf #{@appdir}/forms`
lambda { @fm.push_app(@appdir, "couchapp") }.should_not raise_error
`mkdir -p #{@appdir}/forms`
end
end