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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac288df3a479098d56c66cf0a2501fd5c8d59317d1243aba52290340c60892af
4
- data.tar.gz: 74cdcf9ef45c4d7b913352b686160203aa03c6ef2722ea5fccc05020691bd3a8
3
+ metadata.gz: 3102e254b9713df61278cc81259d547f73d20015f83ee2f0ea1bb6f2399aa3c3
4
+ data.tar.gz: 714019cdae31109069f3d615dc21a18685317eb21edafeff91ab0ff58e8bd80d
5
5
  SHA512:
6
- metadata.gz: 4fc9eec533a6d826b86b1e9c227375230c114f9763463239cd8c886cdc5d0ec57a4d53ae5be11e0363512d6c172e01b764c129ef64e740fea89549b9bc88046e
7
- data.tar.gz: 981e1c6df07e8799691b69ea81528bb83db9edc2ff0b3e9c17be04ac5453a384c423e15b199d8abb86493de660ba47cf63db8eefbdf74444d312f505fba9bbd9
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.org/DannyBen/loadrunner.svg?branch=master)](https://travis-ci.org/DannyBen/loadrunner)
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
- # Create a sample hook handler
35
- $ mkdir -p handlers/myrepo
36
- $ echo "#\!/usr/bin/env bash" > handlers/myrepo/push
37
- $ echo "echo hello > output.txt" >> handlers/myrepo/push
38
- $ chmod +x handlers/myrepo/push
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
- # Start the server
41
- $ loadrunner server
45
+ # Start the server
46
+ $ loadrunner server
42
47
 
43
- # In another terminal, send a sample webhook event
44
- $ loadrunner event localhost:3000 myrepo push master
48
+ # In another terminal, send a sample webhook event
49
+ $ loadrunner event localhost:3000 myrepo push master
45
50
 
46
- # Verify the handler was executed
47
- $ cat output.txt
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
- $ loadrunner --help
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
@@ -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
- push = ActiveSupport::HashWithIndifferentAccess.new JSON.parse json_string
26
+ payload = ActiveSupport::HashWithIndifferentAccess.new JSON.parse json_string
27
27
 
28
28
  opts = {}
29
- opts[:repo] = push.dig(:repository, :name)
30
- opts[:event] = request.env['HTTP_X_GITHUB_EVENT']
31
- opts[:branch] = push[:ref].sub('refs/heads/', '') if push[:ref] =~ /refs\/heads/
32
- opts[:tag] = push[:ref].sub('refs/tags/', '') if push[:ref] =~ /refs\/tags/
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
@@ -1,3 +1,3 @@
1
1
  module LoadRunner
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.0
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-04-26 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: super_docopt