loadrunner 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +58 -13
- data/lib/load_runner/server.rb +6 -5
- data/lib/load_runner/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3102e254b9713df61278cc81259d547f73d20015f83ee2f0ea1bb6f2399aa3c3
|
4
|
+
data.tar.gz: 714019cdae31109069f3d615dc21a18685317eb21edafeff91ab0ff58e8bd80d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0547d09f0b585f3456dcdc1acc65ffc5b410108715db8a240870d6ce5b787660cfc04de3e854a58df6bd5c33292031f4373fb37564c2954fdd2851e9ceec5375
|
7
|
+
data.tar.gz: 10d21050595e15ecd56216bea4aeaa908ac17dbf9f0dfda0be7750e37adf1bfb5346778fb4a6696dc59b80f4d969946a7032dc3650cd279e28e1356c32a2b2e8
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ LoadRunner - GitHub Webhook Server and Event Simulator
|
|
2
2
|
======================================================
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/loadrunner.svg)](https://badge.fury.io/rb/loadrunner)
|
5
|
-
[![Build Status](https://travis-ci.
|
5
|
+
[![Build Status](https://travis-ci.com/DannyBen/loadrunner.svg?branch=master)](https://travis-ci.com/DannyBen/loadrunner)
|
6
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/f1aae46eaf6365ea2ec7/maintainability)](https://codeclimate.com/github/DannyBen/loadrunner/maintainability)
|
7
7
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/f1aae46eaf6365ea2ec7/test_coverage)](https://codeclimate.com/github/DannyBen/loadrunner/test_coverage)
|
8
8
|
|
@@ -21,6 +21,8 @@ It provides these features:
|
|
21
21
|
|
22
22
|
---
|
23
23
|
|
24
|
+
|
25
|
+
|
24
26
|
Install
|
25
27
|
--------------------------------------------------
|
26
28
|
|
@@ -28,28 +30,71 @@ Install
|
|
28
30
|
$ gem install loadrunner
|
29
31
|
```
|
30
32
|
|
33
|
+
|
34
|
+
|
31
35
|
Getting Started
|
32
36
|
--------------------------------------------------
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
```shell
|
39
|
+
# Create a sample hook handler
|
40
|
+
$ mkdir -p handlers/myrepo
|
41
|
+
$ echo '#!/usr/bin/env bash' > handlers/myrepo/push
|
42
|
+
$ echo 'echo hello > output.txt' >> handlers/myrepo/push
|
43
|
+
$ chmod +x handlers/myrepo/push
|
39
44
|
|
40
|
-
|
41
|
-
|
45
|
+
# Start the server
|
46
|
+
$ loadrunner server
|
42
47
|
|
43
|
-
|
44
|
-
|
48
|
+
# In another terminal, send a sample webhook event
|
49
|
+
$ loadrunner event localhost:3000 myrepo push master
|
45
50
|
|
46
|
-
|
47
|
-
|
51
|
+
# Verify the handler was executed
|
52
|
+
$ cat output.txt
|
53
|
+
```
|
48
54
|
|
49
55
|
|
50
56
|
For more options, see the [documentation][1] or run
|
51
57
|
|
52
|
-
|
58
|
+
```shell
|
59
|
+
$ loadrunner --help
|
60
|
+
```
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
Building Handlers
|
65
|
+
--------------------------------------------------
|
66
|
+
|
67
|
+
When running the server, it will look for handlers in the `./handlers`
|
68
|
+
directory, using one of these format:
|
69
|
+
|
70
|
+
handlers/<repo name>/<event type>
|
71
|
+
handlers/<repo name>/<event type>@branch=<branch name>
|
72
|
+
handlers/<repo name>/<event type>@tag=<branch name>
|
73
|
+
|
74
|
+
For example:
|
75
|
+
|
76
|
+
handlers/myrepo/push
|
77
|
+
handlers/myrepo/push@branch=master
|
78
|
+
handlers/myrepo/push@tag=release
|
79
|
+
|
80
|
+
When none of the handlers are found, LoadRunner will respond with a list of
|
81
|
+
handlers it was looking for, so you can use this response to figure out what
|
82
|
+
it needs.
|
83
|
+
|
84
|
+
The handlers can be written in any language, and should simply be
|
85
|
+
executables.
|
86
|
+
|
87
|
+
### Environment Variables
|
88
|
+
|
89
|
+
These environment variables are available to your handlers:
|
90
|
+
|
91
|
+
- `REPO`
|
92
|
+
- `EVENT`
|
93
|
+
- `BRANCH`
|
94
|
+
- `REF`
|
95
|
+
- `TAG`
|
96
|
+
- `PAYLOAD` - the entire JSON string as received from GitHub, or the client.
|
97
|
+
|
53
98
|
|
54
99
|
|
55
100
|
Running with Docker
|
data/lib/load_runner/server.rb
CHANGED
@@ -23,13 +23,14 @@ module LoadRunner
|
|
23
23
|
else
|
24
24
|
json_string = URI.decode_www_form(payload_body).to_h["payload"]
|
25
25
|
end
|
26
|
-
|
26
|
+
payload = ActiveSupport::HashWithIndifferentAccess.new JSON.parse json_string
|
27
27
|
|
28
28
|
opts = {}
|
29
|
-
opts[:repo]
|
30
|
-
opts[:event]
|
31
|
-
opts[:branch]
|
32
|
-
opts[:tag]
|
29
|
+
opts[:repo] = payload.dig(:repository, :name)
|
30
|
+
opts[:event] = request.env['HTTP_X_GITHUB_EVENT']
|
31
|
+
opts[:branch] = payload[:ref].sub('refs/heads/', '') if payload[:ref] =~ /refs\/heads/
|
32
|
+
opts[:tag] = payload[:ref].sub('refs/tags/', '') if payload[:ref] =~ /refs\/tags/
|
33
|
+
opts[:payload] = json_string
|
33
34
|
|
34
35
|
runner = Runner.new opts
|
35
36
|
success = runner.execute
|
data/lib/load_runner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loadrunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: super_docopt
|