hubstats 1.0.0.beta → 1.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed7d93b16a3876de97581f4dc7c76be14e2cf40bee2ead1883231283cdd264e3
4
- data.tar.gz: a59a5cde37267a9595f763d55916d7ef05412f6126c0578c5ba7a92de8b37e98
3
+ metadata.gz: d3a3455ffbfb40fa2aef27ce3519c148ca191f0d1e954aad2d889dbd7f771a95
4
+ data.tar.gz: ec0d30d279e69b7e21041b734a08c86449ae1e262a82d835fe6a1d43f9e7e553
5
5
  SHA512:
6
- metadata.gz: e7666522d273e5ec4c581ab965631669685d952b478c374849593fc862a9a69fc26b4100ebe47c92b6a497076dcafc7429cdfc0e05ebb4ce972ba3aa0d767ba7
7
- data.tar.gz: 2e1536857df35eb959f0011ba1c5dedea3fd93bfe001280ca72150db505051e76065619bc1c5d45e96dc65f68fa923c7e035fb9e6b385cd09017a669c4e5d697
6
+ metadata.gz: 8ef716596587d257ba0a04dfdbd128ce08a65f6e45a7bdaaac163431a8fe3e71de3afb95f34a82ec865551ff9ee48e15c3068f74233791030f5b8b6706338a2c
7
+ data.tar.gz: 5be75ea5d57cacc687d4e6c74b4643f3ab8a6e5b54836ff0c08553d574d85f80c98657fcbca402f5c28473d915cdf04038747eed7e365e5293b5d115e708ad14
@@ -10,13 +10,19 @@ module Hubstats
10
10
  #
11
11
  # Returns - nothing, but makes a new event
12
12
  def handler
13
- verify_signature(request)
13
+ # verify_signature(request)
14
+
15
+ Rails.logger.warn("Webhook received from Github.")
14
16
 
15
17
  kind = request.headers['X-Github-Event']
18
+ Rails.logger.warn("Kind of webhook: #{kind}")
19
+
16
20
  event = event_params.with_indifferent_access
21
+ Rails.logger.warn("Event: #{event}")
17
22
 
18
23
  raw_parameters = request.request_parameters
19
24
  event[:github_action] = raw_parameters["action"]
25
+ Rails.logger.warn("Github action: #{event[:github_action]}")
20
26
 
21
27
  eventsHandler = Hubstats::EventsHandler.new()
22
28
  eventsHandler.route(event, kind)
@@ -29,12 +35,12 @@ module Hubstats
29
35
  # request - the signature to be checked
30
36
  #
31
37
  # Returns - an error if the signatures don't match
32
- private def verify_signature(request)
33
- request.body.rewind
34
- payload_body = request.body.read
35
- signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), Hubstats.config.webhook_endpoint, payload_body)
36
- return 500, "Signatures didn't match!" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])
37
- end
38
+ # private def verify_signature(request)
39
+ # request.body.rewind
40
+ # payload_body = request.body.read
41
+ # signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), Hubstats.config.webhook_endpoint, payload_body)
42
+ # return 500, "Signatures didn't match!" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])
43
+ # end
38
44
 
39
45
  # Private - Allows only these parameters to be added when creating an event
40
46
  #
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
18
 
19
19
  s.add_dependency "rails", "~> 4.2.10"
20
+ s.add_dependency "rake", "= 12.3.2"
20
21
  s.add_dependency "octokit", "~> 4.2"
21
22
  s.add_dependency "will_paginate-bootstrap", "~> 1.0"
22
23
  s.add_dependency "select2-rails", "~> 3.0"
@@ -70,7 +70,7 @@ module Hubstats
70
70
  def team_processor(payload)
71
71
  team = payload[:team]
72
72
 
73
- if payload[:scope] == "team" && payload[:action] == "added"
73
+ if payload[:scope] == "team" && payload[:github_action] == "added"
74
74
  if Hubstats::Team.designed_for_hubstats?(team[:description])
75
75
  Hubstats::Team.create_or_update(team.with_indifferent_access)
76
76
  hubstats_team = Hubstats::Team.where(name: team[:name]).first
@@ -79,7 +79,7 @@ module Hubstats
79
79
  end
80
80
  end
81
81
 
82
- if payload[:action] == "edited" && Hubstats::Team.designed_for_hubstats?(team[:description])
82
+ if payload[:github_action] == "edited" && Hubstats::Team.designed_for_hubstats?(team[:description])
83
83
  Hubstats::Team.create_or_update(team.with_indifferent_access)
84
84
  hubstats_team = Hubstats::Team.where(name: team[:name]).first
85
85
  hubstats_user = Hubstats::User.create_or_update(payload[:member])
@@ -90,7 +90,7 @@ module Hubstats
90
90
  def repository_processor(payload)
91
91
  repo = payload[:repository]
92
92
 
93
- if payload[:action] == "created" # it's a new repository
93
+ if payload[:github_action] == "created" # it's a new repository
94
94
  Hubstats::Repo.create_or_update
95
95
  Hubstats::GithubAPI.create_repo_hook(repo)
96
96
  # The hook was probably already made when we made the repository,
@@ -1,3 +1,3 @@
1
1
  module Hubstats
2
- VERSION = "1.0.0.beta"
2
+ VERSION = "1.0.0.beta1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubstats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta
4
+ version: 1.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Hursh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-01-17 00:00:00.000000000 Z
12
+ date: 2019-01-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 4.2.10
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '='
33
+ - !ruby/object:Gem::Version
34
+ version: 12.3.2
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 12.3.2
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: octokit
30
44
  requirement: !ruby/object:Gem::Requirement