Sha256: 91160218eb4a102dc1f24e104be0d225dd2fb7767c3835b657662f88ca7e0596

Contents?: true

Size: 749 Bytes

Versions: 3

Compression:

Stored size: 749 Bytes

Contents

require 'minarai/actions/base'

module Minarai
  module Actions
    class UrlGet < Base
      attribute :source, required: true, type: String
      attribute :destination, required: true, type: String

      def run
        url_get
      end

      private

      def url_get
        run_command("curl -o #{destination} #{source}")
      end

      def complete?
        has_url_get? && existed?
      end

      def existed?
        %i(check_file_is_file check_file_is_directory).any? do |command|
          check_specific_command(command, destination)
        end
      end

      def has_url_get?
        check_command 'which curl'
      end

      def name
        super || "url-get form #{source} to #{destination}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minarai-0.0.3 lib/minarai/actions/url_get.rb
minarai-0.0.2 lib/minarai/actions/url_get.rb
minarai-0.0.1 lib/minarai/actions/url_get.rb