Sha256: e9aef1f41a11aea6a0fd38b0a64515c31a230c999848c577dd0972d3fc598f55

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

require 'couch/actions/base'
require 'couch/design_document'

require "rest_client"

module Couch
  module Actions
    class Pull < Base
      add_runtime_options!

      def pull
        doc = DesignDocument.new
        say "Pulling %s" % doc.url

        resp = RestClient.get doc.url(:attachments => true)
        doc.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!" % doc.id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
couch-0.2.0 lib/couch/actions/pull.rb