Sha256: 66302a3edbcb1e1bb5faaa9efdeffff180660b0afdb0361d3d2a22cc7eab3279

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 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
        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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
couch-0.1.2 lib/couch/actions/pull.rb
couch-0.1.1 lib/couch/actions/pull.rb