Class: Loadrunner::CommandLine

Inherits:
SuperDocopt::Base
  • Object
show all
Includes:
Colsole
Defined in:
lib/loadrunner/command_line.rb

Overview

Handles the command line interface

Instance Method Summary collapse

Instance Method Details

#eventObject



18
19
20
21
22
# File 'lib/loadrunner/command_line.rb', line 18

def event
  client = Client.new client_opts
  response = client.send_event args['EVENT'], payload_opts
  show response
end

#payloadObject

Raises:

  • (ArgumentError)


24
25
26
27
28
29
30
31
32
# File 'lib/loadrunner/command_line.rb', line 24

def payload
  client = Client.new client_opts
  file = args['FILE']
  raise ArgumentError, "File not found: #{file}" unless File.exist? file

  json = File.read file
  response = client.send_payload args['EVENT'], json
  show response
end

#serverObject



34
35
36
37
# File 'lib/loadrunner/command_line.rb', line 34

def server
  Server.prepare port: args['--port'], bind: args['--bind']
  Server.run!
end

#statusObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/loadrunner/command_line.rb', line 39

def status
  response = Status.update repo: args['REPO'], 
    sha: args['SHA'], 
    state: args['STATE'], 
    context: args['--context'],
    description: args['--desc'],
    url: args['--url']

  show response
end