Sha256: 4fa8d88d6f6aaf23583ac8adf33612be92f01336b790794f16834f096e14457c

Contents?: true

Size: 734 Bytes

Versions: 13

Compression:

Stored size: 734 Bytes

Contents

require 'rest_client'

module Lolcommits
  class Uploldz < Plugin
    attr_accessor :endpoint

    def initialize(runner)
      super

      self.name     = 'uploldz'
      self.default  = false
      self.options.concat(['endpoint'])
    end

    def run
      repo = self.runner.repo.to_s
      if configuration['endpoint'].empty?
        puts "Endpoint URL is empty, please run lolcommits --config to add one."
      elsif repo.empty?
        puts "Repo is empty, skipping upload"
      else
        plugdebug "Calling " + configuration['endpoint'] + " with repo " + repo
        RestClient.post(configuration['endpoint'], 
          :file => File.new(self.runner.main_image),
          :repo => repo)
      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
lolcommits-0.5.1 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.5.1.pre2 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.5.0 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.5.0.pre3 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.5.0.pre2 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.5.0.pre1 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.4.6 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.4.6.pre1 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.4.5 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.4.4 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.4.4pre1 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.4.3 lib/lolcommits/plugins/uploldz.rb
lolcommits-0.4.2 lib/lolcommits/plugins/uploldz.rb