Class: Lolcommits::Lolzinary
- Inherits:
-
Plugin
- Object
- Plugin
- Lolcommits::Lolzinary
- Defined in:
- lib/lolzinary_plugin.rb
Class Method Summary collapse
Instance Method Summary collapse
- #auth_details ⇒ Object
-
#initialize(runner) ⇒ Lolzinary
constructor
A new instance of Lolzinary.
- #run_postcapture ⇒ Object
- #upload_metadata ⇒ Object
Constructor Details
#initialize(runner) ⇒ Lolzinary
Returns a new instance of Lolzinary.
8 9 10 11 12 13 14 15 |
# File 'lib/lolzinary_plugin.rb', line 8 def initialize(runner) super .concat(%w( cloud_name api_key secret )) end |
Class Method Details
.name ⇒ Object
48 49 50 |
# File 'lib/lolzinary_plugin.rb', line 48 def self.name 'lolzinary' end |
.runner_order ⇒ Object
52 53 54 |
# File 'lib/lolzinary_plugin.rb', line 52 def self.runner_order :postcapture end |
Instance Method Details
#auth_details ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/lolzinary_plugin.rb', line 33 def auth_details { cloud_name: "#{configuration['cloud_name']}", api_key: "#{configuration['api_key']}", api_secret: "#{configuration['secret']}" } end |
#run_postcapture ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lolzinary_plugin.rb', line 17 def run_postcapture return unless valid_configuration? if runner.git_info.repo.empty? puts 'Repo is empty, skipping upload' else debug "Posting capture to Cloudinary!" upload = Cloudinary::Uploader.upload(runner.main_image, ) if upload.present? puts "Upload complete! view me at #{upload["secure_url"]}" else puts "Upload failed. :-(" end end end |
#upload_metadata ⇒ Object
41 42 43 44 45 46 |
# File 'lib/lolzinary_plugin.rb', line 41 def auth_details.merge!(tags: ["lolcommits", "#{runner.git_info.repo}"], context: {caption: "Uploaded by #{runner.git_info.} while working on #{runner.git_info.repo}"}, folder: "lolcommits/#{runner.git_info.repo}", public_id: "#{runner.sha}") end |