Class: Couch::Actions::Pull

Inherits:
Base
  • Object
show all
Defined in:
lib/couch/actions/pull.rb

Instance Method Summary collapse

Methods inherited from Base

banner

Instance Method Details

#pullObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/couch/actions/pull.rb', line 11

def pull
  say "Pulling from %s" % DesignDocument.url

  resp = RestClient.get DesignDocument.url(:attachments => true)
  doc = DesignDocument.build_from_json(resp.body)

  doc.write do |filename, content|
    create_file filename, content
  end

  say "Checked out %s" % doc.rev
rescue RestClient::ResourceNotFound
  say "Error: Document %s does not exist!" % DesignDocument.id
end