Class: Lolcommits::Uploldz

Inherits:
Plugin
  • Object
show all
Defined in:
lib/lolcommits/plugins/uploldz.rb

Instance Attribute Summary collapse

Attributes inherited from Plugin

#options, #runner

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Plugin

#configuration, #configure_options!, #debug, #execute, #is_enabled?, #puts, #valid_configuration?

Constructor Details

#initialize(runner) ⇒ Uploldz

Returns a new instance of Uploldz.



7
8
9
10
# File 'lib/lolcommits/plugins/uploldz.rb', line 7

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

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint.



5
6
7
# File 'lib/lolcommits/plugins/uploldz.rb', line 5

def endpoint
  @endpoint
end

Class Method Details

.nameObject



30
31
32
# File 'lib/lolcommits/plugins/uploldz.rb', line 30

def self.name
  'uploldz'
end

Instance Method Details

#is_configured?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/lolcommits/plugins/uploldz.rb', line 26

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

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/lolcommits/plugins/uploldz.rb', line 12

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