class Lolcommits::Plugin::Uploldz
Attributes
Public Class Methods
Initialize plugin with runner, config and set all configurable options.
# File lib/lolcommits/plugin/uploldz.rb, line 17 def initialize(runner: nil, config: nil, name: nil) super options.concat(plugin_options) end
Public Instance Methods
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 file `message` - the commit message `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
@return [RestClient::Response] response object from POST request @return [Nil] if any error occurs
# File lib/lolcommits/plugin/uploldz.rb, line 50 def run_capture_ready debug "Posting capture to #{configuration[:endpoint]}" RestClient.post( configuration[:endpoint], { 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, key: configuration[:optional_key] }, Authorization: authorization_header ) rescue => e log_error(e, "ERROR: RestClient POST FAILED #{e.class} - #{e.message}") 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)://
@return [Boolean] true/false indicating if plugin is correctly configured
# File lib/lolcommits/plugin/uploldz.rb, line 30 def valid_configuration? !!(configuration[:endpoint] =~ /^http(s)?:\/\//) end
Private Instance Methods
Returns all configuration options available for this plugin.
@return [Array] the option names
# File lib/lolcommits/plugin/uploldz.rb, line 77 def plugin_options [ :endpoint, :optional_key, :optional_http_auth_username, :optional_http_auth_password ] end