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
-
#initialize(runner) ⇒ Uploldz
constructor
A new instance of Uploldz.
- #is_configured? ⇒ Boolean
- #run ⇒ Object
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. << 'endpoint' end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/lolcommits/plugins/uploldz.rb', line 5 def endpoint @endpoint end |
Class Method Details
.name ⇒ Object
30 31 32 |
# File 'lib/lolcommits/plugins/uploldz.rb', line 30 def self.name 'uploldz' end |
Instance Method Details
#is_configured? ⇒ Boolean
26 27 28 |
# File 'lib/lolcommits/plugins/uploldz.rb', line 26 def is_configured? !configuration["enabled"].nil? && configuration["endpoint"] end |
#run ⇒ Object
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 |