15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/couch/actions/push.rb', line 15
def push
doc = DesignDocument.build_from_filesystem(destination_root)
say "Pushing to %s" % DesignDocument.url
resp = RestClient.put DesignDocument.url, doc.to_json
response = JSON.parse(resp.body)
if response["ok"]
rev = response["rev"]
File.open File.join(destination_root, "_rev.js"), "w" do |file|
file << "#{rev}\n"
end
say "Pushed %s" % rev
else
say "Error occured: %s" % response.inspect
end
rescue RestClient::Conflict
say "Conflict! Try to pull first or delete ./_rev."
end
|