Sha256: 6604707065b09560c5ef8a600b873086c2bdf83dcace07cfa4b428df2786594d

Contents?: true

Size: 717 Bytes

Versions: 4

Compression:

Stored size: 717 Bytes

Contents

require 'rest_client'

module Lolcommits
  class Uploldz < Plugin
    attr_accessor :endpoint

    def initialize(runner)
      super
      self.options << 'endpoint'
    end

    def run
      return unless valid_configuration?

      repo = self.runner.repo.to_s
      if repo.empty?
        puts "Repo is empty, skipping upload"
      else
        debug "Calling " + configuration['endpoint'] + " with repo " + repo
        RestClient.post(configuration['endpoint'],
          :file => File.new(self.runner.main_image),
          :repo => repo)
      end
    end

    def is_configured?
      !configuration["enabled"].nil? && configuration["endpoint"]
    end

    def self.name
      'uploldz'
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
lolcommits-mpv-0.5.3 lib/lolcommits/plugins/uploldz.rb
lolcommits-mpv-0.5.2 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.5.2 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.5.2.pre1 lib/lolcommits/plugins/uploldz.rb