Class: Lolcommits::Uploldz
- Defined in:
- lib/lolcommits/plugins/uploldz.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
Attributes inherited from Plugin
Class Method Summary collapse
Instance Method Summary collapse
- #configured? ⇒ Boolean
-
#initialize(runner) ⇒ Uploldz
constructor
A new instance of Uploldz.
- #run ⇒ Object
Methods inherited from Plugin
#configuration, #configure_options!, #debug, #enabled?, #execute, #puts, #valid_configuration?
Constructor Details
#initialize(runner) ⇒ Uploldz
Returns a new instance of Uploldz.
8 9 10 11 |
# File 'lib/lolcommits/plugins/uploldz.rb', line 8 def initialize(runner) super self..concat(['endpoint', 'optional_key']) end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/lolcommits/plugins/uploldz.rb', line 6 def endpoint @endpoint end |
Class Method Details
.name ⇒ Object
32 33 34 |
# File 'lib/lolcommits/plugins/uploldz.rb', line 32 def self.name 'uploldz' end |
Instance Method Details
#configured? ⇒ Boolean
28 29 30 |
# File 'lib/lolcommits/plugins/uploldz.rb', line 28 def configured? !configuration['enabled'].nil? && configuration['endpoint'] end |
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lolcommits/plugins/uploldz.rb', line 13 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, :key => configuration['optional_key']) end end |