Sha256: 7bb0fde1075b5b4781c9f9af89682f51cb773cf63fbfaba4be218a28b9c5ed3f

Contents?: true

Size: 858 Bytes

Versions: 5

Compression:

Stored size: 858 Bytes

Contents

# encoding: UTF-8

require 'uri'
require 'net/http'
require 'pathname'

require_relative 'base_middleware'

module GoodData
  module Bricks
    class FsProjectUploadMiddleware < Bricks::Middleware
      def initialize(options = {})
        super
        @destination = options[:destination]
      end

      def call(params)
        returning(@app.call(params)) do |_result|
          destination = @destination
          (params['gdc_files_to_upload'] || []).each do |f|
            case destination.to_s
            when 'staging'
              GoodData.upload_to_project_webdav(f[:path], directory: f[:webdav_directory])
              puts "Uploaded local file \"#{f[:path]}\" to webdav."
            end
          end
        end
      end
    end

    # Alias to make it backwards compatible
    FsUploadMiddleware = FsProjectUploadMiddleware
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gooddata-0.6.15 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.14 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.13 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.12 lib/gooddata/bricks/middleware/fs_upload_middleware.rb
gooddata-0.6.11 lib/gooddata/bricks/middleware/fs_upload_middleware.rb