lib/lolcommits/plugin/uploldz.rb in lolcommits-uploldz-0.2.0 vs lib/lolcommits/plugin/uploldz.rb in lolcommits-uploldz-0.3.0

- old
+ new

@@ -9,37 +9,38 @@ class Uploldz < Base attr_accessor :endpoint ## - # Initialize plugin with runner, config and set all configurable options. + # Initialize plugin with runner, config and set all configurable + # options. # def initialize(runner: nil, config: nil, name: nil) super options.concat(plugin_options) end ## # Returns true/false indicating if the plugin has been correctly - # configured. The `endpoint` option must be set with a URL beginning with - # http(s):// + # configured. The `endpoint` option must be set with a URL + # beginning with http(s):// # # @return [Boolean] true/false indicating if plugin is correctly # configured # def valid_configuration? !!(configuration[:endpoint] =~ /^http(s)?:\/\//) end ## - # Post-capture hook, runs after lolcommits captures a snapshot. Uploads - # the lolcommit image to the remote server with an optional Authorization - # header and the following request params. + # Post-capture hook, runs after lolcommits captures a snapshot. + # Uploads # the lolcommit to the remote server with an optional + # Authorization header and the following request params. # - # `file` - captured lolcommit image file + # `file` - captured lolcommit file # `message` - the commit message - # `repo` - repository name e.g. mroth/lolcommits + # `repo` - repository name e.g. lolcommits/lolcommits # `sha` - commit SHA # `key` - key (string) from plugin configuration (optional) # `author_name` - the commit author name # `author_email` - the commit author email address # @@ -49,11 +50,11 @@ def run_capture_ready debug "Posting capture to #{configuration[:endpoint]}" RestClient.post( configuration[:endpoint], { - file: File.new(runner.main_image), + file: File.new(runner.lolcommit_path), message: runner.message, repo: runner.vcs_info.repo, author_name: runner.vcs_info.author_name, author_email: runner.vcs_info.author_email, sha: runner.sha, @@ -81,13 +82,13 @@ :optional_http_auth_password ] end ## - # Builds an HTTP basic auth header from plugin options. If both the - # username and password options are empty nil is returned. + # Builds an HTTP basic auth header from plugin options. If both + # the username and password options are empty nil is returned. # - # @return [String] the HTTP basic auth header string (Base64 encoded u:p) + # @return [String] the HTTP basic auth header string (Base64 encoded) # @return [Nil] if no username or password option set # def authorization_header user = configuration[:optional_http_auth_username] password = configuration[:optional_http_auth_password]