loadrunner 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/load_runner/command_line.rb +8 -2
- data/lib/load_runner/runner.rb +2 -2
- data/lib/load_runner/server.rb +1 -1
- data/lib/load_runner/server_helper.rb +15 -3
- data/lib/load_runner/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d485cc0bc26a01f141b992aaed25b970e290470c
|
4
|
+
data.tar.gz: a7b1bacff31b40b289b509c626ef07720146334c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e7b9da7b9302209943c6c1a08acc43230210d9872fcd3d20817f3af9384076d3cc044c589199e13f52c9680c718b496aadf208e3a9599b112abbf96f0f526b
|
7
|
+
data.tar.gz: d726f209f0dc7d64c991fc01f546e48d12207b978aaf9bd75ab0676ef14f525938a37addb384dadb4ced30640f6fe186ae3dba81e5865acdd14cd22790105ec7
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'singleton'
|
2
2
|
require 'docopt'
|
3
|
+
require 'awesome_print'
|
3
4
|
|
4
5
|
module LoadRunner
|
5
6
|
|
@@ -33,7 +34,9 @@ module LoadRunner
|
|
33
34
|
def send
|
34
35
|
client = Client.new client_opts
|
35
36
|
response = client.send args['EVENT'], payload_opts
|
36
|
-
|
37
|
+
|
38
|
+
puts "Reesponse code: #{response.code}"
|
39
|
+
ap response
|
37
40
|
end
|
38
41
|
|
39
42
|
def server
|
@@ -44,10 +47,13 @@ module LoadRunner
|
|
44
47
|
def client_opts
|
45
48
|
{
|
46
49
|
base_url: args['URL'],
|
47
|
-
secret_token: '
|
50
|
+
secret_token: ENV['GITHUB_SECRET_TOKEN']
|
48
51
|
}
|
49
52
|
end
|
50
53
|
|
54
|
+
# Convert command line arguments to a hash suitable for consumption
|
55
|
+
# by Client#send. In essence, we are simply converting the input REF
|
56
|
+
# argument, which can come in several forms, to a valid git ref.
|
51
57
|
def payload_opts
|
52
58
|
result = { repo: args['REPO'] }
|
53
59
|
|
data/lib/load_runner/runner.rb
CHANGED
@@ -57,8 +57,8 @@ module LoadRunner
|
|
57
57
|
handlers = ["#{base}/#{opts[:event]}"]
|
58
58
|
|
59
59
|
handlers.tap do |h|
|
60
|
-
h << "#{base}/#{opts[:event]}@branch
|
61
|
-
h << "#{base}/#{opts[:event]}@tag
|
60
|
+
h << "#{base}/#{opts[:event]}@branch=#{opts[:branch]}" if opts[:branch]
|
61
|
+
h << "#{base}/#{opts[:event]}@tag=#{opts[:tag]}" if opts[:tag]
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
data/lib/load_runner/server.rb
CHANGED
@@ -1,9 +1,21 @@
|
|
1
1
|
module LoadRunner
|
2
2
|
module ServerHelper
|
3
3
|
def verify_signature(payload_body)
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
request_signature = request.env['HTTP_X_HUB_SIGNATURE']
|
5
|
+
|
6
|
+
if secret_token and !request_signature
|
7
|
+
return halt 401, "Client did not send a signature"
|
8
|
+
end
|
9
|
+
|
10
|
+
if !secret_token and request_signature
|
11
|
+
return halt 401, "Server secret token is not configured"
|
12
|
+
end
|
13
|
+
|
14
|
+
if secret_token and request_signature
|
15
|
+
signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), secret_token, payload_body)
|
16
|
+
signature_match = Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])
|
17
|
+
return halt 401, "Signature mismatch" unless signature_match
|
18
|
+
end
|
7
19
|
end
|
8
20
|
|
9
21
|
def secret_token
|
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.0.
|
4
|
+
version: 0.0.3
|
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: 2017-08-
|
11
|
+
date: 2017-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: awesome_print
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.8'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.8'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: runfile
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|