lita-github-pinger 0.5.2 → 0.5.3

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
  SHA1:
3
- metadata.gz: 65346744bb187008871cc23309602ba31ddc4097
4
- data.tar.gz: a16658ae864ecf9cf98696bd0ee48e581f91449a
3
+ metadata.gz: c26a2437490fd7521095ea3c345ccb443f1ada88
4
+ data.tar.gz: 7c0021876098ad0b23850b19b6b4b7bcf4e8b9e3
5
5
  SHA512:
6
- metadata.gz: 3033410fcff08f75c0133e78d782309f10a400d2ac59b7692f2ab4b76bb3f439c35081aa7f0864039f841a4c2b016d9d3e573b96d8fb9619c53953edfd251b59
7
- data.tar.gz: eb45a2df2f19e56235aa2839895273abb810b86d242488e41761e0df8a4a7d0b2c11a851dcd22430036f60081e7daaf22fdef899a75b59993e462e843b01b62c
6
+ metadata.gz: 020c687669dc372ecb43091f7864c4154a1494212deed619072766dcd16ada5d70fb5b10cec2cb68237aa025219e2a49371862d6913d260964291418c312826d
7
+ data.tar.gz: 7146ae56e06a20cf9f2fa96e87086364156620a4559acdf29522c4697ec3b0865f34c4927603bca5b3b35d6a7fda417520db58b75ee54d31ea4cee70373edc6b
@@ -7,10 +7,14 @@ module Lita
7
7
  ####
8
8
 
9
9
  # example entry: {
10
- # :slack => "taylor"
11
- # :github => "taylorlapeyre"
12
- # :frequency => "only_mentions"
13
- # :ping_location => "dm"
10
+ # :usernames => {
11
+ # :slack => "taylor",
12
+ # :github => "taylorlapeyre"
13
+ # },
14
+ # :github_preferences => {
15
+ # :frequency => "only_mentions",
16
+ # :ping_location => "dm"
17
+ # }
14
18
  #}
15
19
  #
16
20
  # :ping_location can be...
@@ -40,6 +44,12 @@ module Lita
40
44
  end
41
45
  end
42
46
 
47
+ def travisping(request, response)
48
+ puts "########## New Travis Event! ##########"
49
+ body = MultiJson.load(request.body)
50
+ p MultiJson.dump(body)
51
+ end
52
+
43
53
  def act_on_assign(body, response)
44
54
  puts "Detected that someone got assigned to a pull request."
45
55
  assignee = find_engineer(github: body["pull_request"]["assignee"]["login"])
@@ -50,7 +60,7 @@ module Lita
50
60
  message = "*Heads up!* You've been assigned to review a pull request:\n#{pr_url}"
51
61
 
52
62
  puts "Sending DM to #{assignee}..."
53
- send_dm(assignee[:slack], message)
63
+ send_dm(assignee[:usernames][:slack], message)
54
64
 
55
65
  response
56
66
  end
@@ -76,7 +86,7 @@ module Lita
76
86
  # automatically include the creator of the PR, unless he's
77
87
  # commenting on his own PR
78
88
 
79
- if commenter != pr_owner && ["all_discussion", nil].include?(pr_owner[:frequency])
89
+ if commenter != pr_owner && ["all_discussion", nil].include?(pr_owner[:github_preferences][:frequency])
80
90
  puts "PR owner was not the commenter, and has a :frequency of 'all_discussion' or nil"
81
91
  puts "Therefore, adding the PR owner to list of engineers to ping."
82
92
  engineers_to_ping << pr_owner
@@ -104,17 +114,17 @@ module Lita
104
114
  puts "Starting pinging process for each engineer..."
105
115
  engineers_to_ping.each do |engineer|
106
116
  puts "looking at #{engineer}'s preferences..'"
107
- next if engineer[:frequency] == "off"
117
+ next if engineer[:github_preferences][:frequency] == "off"
108
118
 
109
- case engineer[:ping_location]
119
+ case engineer[:github_preferences][:ping_location]
110
120
  when "dm", nil
111
121
  puts "Preference was either 'dm' or nil, so sending DM."
112
- private_message = "New PR comment from @#{commenter[:slack]}:\n"
122
+ private_message = "New PR comment from @#{commenter[:usernames][:slack]}:\n"
113
123
  private_message += "#{comment_url}\n#{comment}"
114
- send_dm(engineer[:slack], private_message)
124
+ send_dm(engineer[:usernames][:slack], private_message)
115
125
  when "eng-pr", "eng_pr"
116
126
  puts "Preference was either 'eng-pr' or 'eng_pr', so alerting #eng-pr."
117
- public_message = "@#{engineer[:slack]}, new PR mention: "
127
+ public_message = "@#{engineer[:usernames][:slack]}, new PR mention: "
118
128
  public_message += "#{comment_url}\n#{comment}"
119
129
  alert_eng_pr(public_message)
120
130
  end
@@ -136,9 +146,9 @@ module Lita
136
146
  def find_engineer(slack: nil, github: nil)
137
147
  config.engineers.select do |eng|
138
148
  if slack
139
- eng[:slack] == slack
149
+ eng[:usernames][:slack] == slack
140
150
  elsif github
141
- eng[:github] == github
151
+ eng[:usernames][:github] == github
142
152
  end
143
153
  end.first
144
154
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-github-pinger"
3
- spec.version = "0.5.2"
3
+ spec.version = "0.5.3"
4
4
  spec.authors = ["Taylor Lapeyre"]
5
5
  spec.email = ["taylorlapeyre@gmail.com"]
6
6
  spec.description = "A Lita handler that detects github comment notifications and regurgitates a ping to the correct slack username."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-github-pinger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Lapeyre