Sha256: aca5eb4dedb07928e539e1e54070166fedf3ee45eee95210c1f62248ba214ef4

Contents?: true

Size: 594 Bytes

Versions: 7

Compression:

Stored size: 594 Bytes

Contents

require 'rid/actions/base'
require 'rid/design_document'

require "rest_client"

module Rid
  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

7 entries across 7 versions & 1 rubygems

Version Path
rid-0.5.2 lib/rid/actions/pull.rb
rid-0.5.1 lib/rid/actions/pull.rb
rid-0.5.0 lib/rid/actions/pull.rb
rid-0.4.1 lib/rid/actions/pull.rb
rid-0.4.0 lib/rid/actions/pull.rb
rid-0.3.1 lib/rid/actions/pull.rb
rid-0.3.0 lib/rid/actions/pull.rb