class Lolcommits::LolProtonet

Public Class Methods

name() click to toggle source
# File lib/lolcommits/plugins/lol_protonet.rb, line 59
def self.name
  'lolprotonet'
end
new(runner) click to toggle source
Calls superclass method Lolcommits::Plugin::new
# File lib/lolcommits/plugins/lol_protonet.rb, line 5
def initialize(runner)
  super
  options.concat(%w(api_token api_endpoint))
end
runner_order() click to toggle source
# File lib/lolcommits/plugins/lol_protonet.rb, line 63
def self.runner_order
  :postcapture
end

Public Instance Methods

api_url() click to toggle source
# File lib/lolcommits/plugins/lol_protonet.rb, line 24
def api_url
  configuration['api_endpoint']
end
configured?() click to toggle source
# File lib/lolcommits/plugins/lol_protonet.rb, line 53
def configured?
  !configuration['enabled'].nil? &&
    configuration['api_token'] &&
    configuration['api_endpoint']
end
message() click to toggle source
# File lib/lolcommits/plugins/lol_protonet.rb, line 28
def message
  "commited some #{random_adjective} #{random_object} to #{runner.git_info.repo}@#{runner.sha} (#{runner.git_info.branch}) "
end
random_adjective() click to toggle source
# File lib/lolcommits/plugins/lol_protonet.rb, line 38
def random_adjective
  adjectives = ['awesome', 'great', 'interesting', 'cool', 'EPIC', 'gut', 'good', 'pansy',
                'powerful', 'boring', 'quirky', 'untested', 'german', 'iranian', 'neutral', 'crazy', 'well tested',
                'jimmy style', 'nasty', 'bibliographical (we received complaints about the original wording)',
                'bombdiggidy', 'narly', 'spiffy', 'smashing', 'xing style',
                'leo apotheker style', 'black', 'white', 'yellow', 'shaggy', 'tasty', 'mind bending', 'JAY-Z',
                'Kanye (the best ever)', '* Toby Keith was here *', 'splendid', 'stupendulous',
                '(freedom fries!)', '[vote RON PAUL]', '- these are not my glasses -', 'typical pansy',
                '- ze goggles zey do nothing! -', 'almost working', 'legen- wait for it -', '-dairy!',
                ' - Tavonius would be proud of this - ', 'Meg FAILMAN!', '- very brofessional of you -',
                'heartbleeding', 'juciy', 'supercalifragilisticexpialidocious', 'failing', 'loving'
               ]
  adjectives.sample
end
random_object() click to toggle source
# File lib/lolcommits/plugins/lol_protonet.rb, line 32
def random_object
  objects = %w(screws bolts exceptions errors cookies)

  objects.sample
end
run_postcapture() click to toggle source
# File lib/lolcommits/plugins/lol_protonet.rb, line 10
def run_postcapture
  return unless valid_configuration?

  debug "Posting capture to #{configuration['endpoint']}"
  RestClient.post(
    api_url,
    {
      :files        => [File.new(runner.main_image)],
      :message      => message
    },
    'X-Protonet-Token' => configuration['api_token']
  )
end