Class: Lolcommits::Plugin::Uploldz
- Inherits:
-
Base
- Object
- Base
- Lolcommits::Plugin::Uploldz
- Defined in:
- lib/lolcommits/plugin/uploldz.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
Instance Method Summary collapse
-
#initialize(runner: nil, config: nil, name: nil) ⇒ Uploldz
constructor
Initialize plugin with runner, config and set all configurable options.
-
#run_capture_ready ⇒ RestClient::Response, Nil
Post-capture hook, runs after lolcommits captures a snapshot.
-
#valid_configuration? ⇒ Boolean
Returns true/false indicating if the plugin has been correctly configured.
Constructor Details
#initialize(runner: nil, config: nil, name: nil) ⇒ Uploldz
Initialize plugin with runner, config and set all configurable options.
17 18 19 20 |
# File 'lib/lolcommits/plugin/uploldz.rb', line 17 def initialize(runner: nil, config: nil, name: nil) super .concat() end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
11 12 13 |
# File 'lib/lolcommits/plugin/uploldz.rb', line 11 def endpoint @endpoint end |
Instance Method Details
#run_capture_ready ⇒ RestClient::Response, Nil
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
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# 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., repo: runner.vcs_info.repo, author_name: runner.vcs_info., author_email: runner.vcs_info., sha: runner.sha, key: configuration[:optional_key] }, Authorization: ) rescue => e log_error(e, "ERROR: RestClient POST FAILED #{e.class} - #{e.}") end |
#valid_configuration? ⇒ Boolean
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
30 31 32 |
# File 'lib/lolcommits/plugin/uploldz.rb', line 30 def valid_configuration? !!(configuration[:endpoint] =~ /^http(s)?:\/\//) end |