review_request 0.1.0

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.
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "message_templates"
4
+ require_relative "support"
5
+
6
+ module ReviewRequest
7
+ # Builds the Slack message text for each feature.
8
+ module Messages
9
+ module_function
10
+
11
+ # Replaces {name} placeholders. Raises KeyError if a placeholder has no value,
12
+ # so a template/value mismatch fails loudly instead of posting "{name}".
13
+ def render(template, values)
14
+ template.gsub(/\{(\w+)\}/) { values.fetch(Regexp.last_match(1).to_sym) }
15
+ end
16
+
17
+ def review_request(user_id:, pr_url:, title:, repo_name:, formatted_reviewers:)
18
+ render(
19
+ MessageTemplates::REVIEW_REQUEST.sample,
20
+ user_mention: user_mention(user_id),
21
+ pr_url:,
22
+ title:,
23
+ repo_name: repo_name.to_s.upcase,
24
+ reviewers_section: reviewers_section(formatted_reviewers),
25
+ icon: MessageTemplates::ICONS.sample
26
+ )
27
+ end
28
+
29
+ def reminder(team_id:, total_pr:)
30
+ render(
31
+ MessageTemplates::REMINDER.sample,
32
+ team_mention: subteam_mention(team_id),
33
+ total_pr: "*#{total_pr}*"
34
+ )
35
+ end
36
+
37
+ def jira_overdue_intro(slack_group_id:, total_issues:)
38
+ team_mention = Support.blank?(slack_group_id) ? "team" : subteam_mention(slack_group_id)
39
+ render(
40
+ MessageTemplates::JIRA_OVERDUE.sample,
41
+ team_mention:,
42
+ total: "*#{total_issues}*"
43
+ )
44
+ end
45
+
46
+ def sprint_completed(sprint_name:, start_date:, end_date:, completed_by:)
47
+ render(
48
+ MessageTemplates::SPRINT_COMPLETED,
49
+ sprint_name:,
50
+ start_date:,
51
+ end_date:,
52
+ completed_by:
53
+ )
54
+ end
55
+
56
+ def user_mention(user_id)
57
+ Support.blank?(user_id) ? "" : "<@#{user_id}> "
58
+ end
59
+
60
+ def subteam_mention(team_id)
61
+ "<!subteam^#{team_id}>!"
62
+ end
63
+
64
+ def reviewers_section(formatted_reviewers)
65
+ Support.blank?(formatted_reviewers) ? "" : "cc #{formatted_reviewers}\n"
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,158 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "uri"
4
+ require_relative "date_checker"
5
+ require_relative "errors"
6
+ require_relative "github"
7
+ require_relative "messages"
8
+ require_relative "slack"
9
+ require_relative "support"
10
+
11
+ module ReviewRequest
12
+ # Builds and posts a digest of open PRs awaiting a GitHub team's review.
13
+ class PRReminderService
14
+ BOT_NAME = "Code Review"
15
+ DEFAULT_BOT_ICON = "https://github.com/github.png"
16
+
17
+ # Accepts "https://github.com/org/repo" or "git@github.com:org/repo.git"; returns [org, repo].
18
+ def self.parse_repo_url(repo_url)
19
+ path = if repo_url.start_with?("https://github.com/")
20
+ URI.parse(repo_url).path
21
+ elsif repo_url.start_with?("git@github.com:")
22
+ repo_url.delete_prefix("git@github.com:")
23
+ else
24
+ raise PRReminderError, "Unsupported repository URL format: #{repo_url}"
25
+ end
26
+
27
+ parts = path.delete_prefix("/").delete_suffix("/").delete_suffix(".git").split("/")
28
+ raise PRReminderError, "Invalid repository path: #{path}" unless parts.size == 2
29
+
30
+ parts
31
+ rescue URI::InvalidURIError => e
32
+ raise PRReminderError, "Failed to parse repository URL #{repo_url}: #{e.message}"
33
+ end
34
+
35
+ def initialize(github_token:, slack_token:, repositories:, app_url: "")
36
+ @github_token = github_token
37
+ @slack_token = slack_token
38
+ @repositories = Array(repositories).map { |repo| Support.symbolize_keys(repo) }
39
+ @app_url = app_url.to_s
40
+ end
41
+
42
+ # Returns the digest text, or nil when there is nothing to send or the config is incomplete.
43
+ def generate_reminder_message(team_config)
44
+ config = Support.symbolize_keys(team_config)
45
+ channel_id, github_team = config.values_at(:channel_id, :github_team)
46
+ if Support.blank?(channel_id) || Support.blank?(github_team)
47
+ ReviewRequest.logger.warn("Incomplete team configuration: #{team_config}")
48
+ return nil
49
+ end
50
+
51
+ subteam_id = resolve_slack_group_id(config[:slack_group_id])
52
+ prs_by_repo = @repositories.each_with_object([]) do |repo_config, acc|
53
+ prs = prs_for_repo(repo_config, github_team, config[:max_age_pr_days])
54
+ acc << [repo_config[:url], prs] unless prs.empty?
55
+ end
56
+ return nil if prs_by_repo.empty?
57
+
58
+ digest_lines(subteam_id, prs_by_repo).join("\n").strip
59
+ end
60
+
61
+ # Posts the digest for one team. Returns true on success or when there's nothing to send,
62
+ # and false if an error occurred. With dry_run: true, the message is logged instead of posted.
63
+ def send_reminder(team_config, dry_run: false)
64
+ config = Support.symbolize_keys(team_config)
65
+ unless DateChecker.should_send_reminder?(config[:remind_date])
66
+ ReviewRequest.logger.info("Skipping reminder for team #{config[:github_team] || "unknown"}: not a reminder day")
67
+ return true
68
+ end
69
+
70
+ message = generate_reminder_message(config)
71
+ unless message
72
+ ReviewRequest.logger.info("No PRs found for team #{config[:github_team] || "unknown"}")
73
+ return true
74
+ end
75
+
76
+ if dry_run
77
+ ReviewRequest.logger.info("DRY RUN - Would send message to #{config[:channel_id]}:\n#{message}")
78
+ return true
79
+ end
80
+
81
+ Slack.new(token: @slack_token, channel_ids: [config[:channel_id]])
82
+ .post_message(message, username: BOT_NAME, icon_url: bot_icon_url)
83
+ ReviewRequest.logger.info("Sent reminder message to #{config[:channel_id]}")
84
+ true
85
+ rescue ReviewRequest::Error => e
86
+ ReviewRequest.logger.error("Failed to send reminder: #{e.message}")
87
+ false
88
+ end
89
+
90
+ private
91
+
92
+ def digest_lines(subteam_id, prs_by_repo)
93
+ total = prs_by_repo.sum { |_url, prs| prs.size }
94
+ lines = [Messages.reminder(team_id: subteam_id, total_pr: total), ""]
95
+ prs_by_repo.each do |url, prs|
96
+ lines << "Repository: #{self.class.parse_repo_url(url).last}"
97
+ prs.each { |pr| lines << format_pr_line(pr) }
98
+ lines << ""
99
+ end
100
+ lines
101
+ end
102
+
103
+ def bot_icon_url
104
+ base = @app_url.strip.delete_suffix("/")
105
+ base.empty? ? DEFAULT_BOT_ICON : "#{base}/bot-icon.png"
106
+ end
107
+
108
+ def prs_for_repo(repo_config, team_slug, max_age_days)
109
+ org, repo = self.class.parse_repo_url(repo_config[:url].to_s)
110
+ GitHub.new(token: @github_token, organization: org, repo:)
111
+ .team_review_requests(team_slug:, base_branch: repo_config.fetch(:base_branch, "main"),
112
+ max_age_days:)
113
+ rescue ReviewRequest::Error => e
114
+ ReviewRequest.logger.warn("Failed to get PRs for #{repo_config[:url]}: #{e.message}")
115
+ []
116
+ end
117
+
118
+ # Turns a Slack usergroup handle ("@squad") into its ID. Values that are already IDs pass through.
119
+ def resolve_slack_group_id(slack_group_id)
120
+ return slack_group_id.to_s if Support.blank?(slack_group_id)
121
+
122
+ Slack.new(token: @slack_token).usergroups.fetch(slack_group_id, slack_group_id)
123
+ rescue APIError => e
124
+ ReviewRequest.logger.warn("Failed to get Slack group ID for #{slack_group_id}: #{e.message}")
125
+ slack_group_id
126
+ end
127
+
128
+ def format_pr_line(pr)
129
+ title = pr["title"] || "Untitled"
130
+ author = pr.dig("user", "login") || "Unknown"
131
+ url = pr["html_url"] || "#"
132
+ age = GitHub.calculate_pr_age(pr["created_at"].to_s)
133
+ "• <#{url}|#{title}> - by @#{author} - #{age} - #{review_status(pr["reviews"] || [])}"
134
+ rescue StandardError => e
135
+ ReviewRequest.logger.error("Failed to format PR #{pr["number"] || "unknown"}: #{e.message}")
136
+ "• [Error formatting PR] - #{pr["html_url"] || "#"}"
137
+ end
138
+
139
+ # Uses each reviewer's most recent decisive review. A dismissed review clears that reviewer's state.
140
+ def review_status(reviews)
141
+ latest = {}
142
+ reviews.each do |review|
143
+ state = review["state"]
144
+ next unless %w[APPROVED CHANGES_REQUESTED DISMISSED].include?(state)
145
+
146
+ latest[review.dig("user", "login")] = state == "DISMISSED" ? nil : state
147
+ end
148
+
149
+ if latest.value?("CHANGES_REQUESTED")
150
+ "Changes requested"
151
+ elsif latest.value?("APPROVED")
152
+ "Approved"
153
+ else
154
+ "Waiting for review"
155
+ end
156
+ end
157
+ end
158
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "errors"
4
+
5
+ module ReviewRequest
6
+ # Retries a block on transient API errors with exponential back-off,
7
+ # mirroring the 3 attempts / 4–10 s wait used by the Python package.
8
+ module Retry
9
+ class << self
10
+ # Replace in tests to avoid real sleeping, e.g. `Retry.sleeper = ->(_) {}`.
11
+ attr_accessor :sleeper
12
+ end
13
+
14
+ self.sleeper = ->(seconds) { Kernel.sleep(seconds) }
15
+
16
+ module_function
17
+
18
+ def with_retries(attempts: 3, min_wait: 4, max_wait: 10)
19
+ attempt = 0
20
+ begin
21
+ attempt += 1
22
+ yield
23
+ rescue APIError => e
24
+ raise unless e.transient? && attempt < attempts
25
+
26
+ sleeper.call(backoff(attempt, min_wait, max_wait))
27
+ retry
28
+ end
29
+ end
30
+
31
+ def backoff(attempt, min_wait, max_wait)
32
+ (2**(attempt - 1)).clamp(min_wait, max_wait)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,167 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "digest"
4
+ require "uri"
5
+ require_relative "cache"
6
+ require_relative "errors"
7
+ require_relative "github"
8
+ require_relative "messages"
9
+ require_relative "slack"
10
+ require_relative "support"
11
+
12
+ module ReviewRequest
13
+ # Handles a Slack slash command such as `/review <PR_URL> [@user|#channel|@group] [--scheduled=...]`:
14
+ # fetches the PR from GitHub, builds the message, and posts or schedules it in Slack.
15
+ class SendMessage
16
+ USER_ID_PATTERN = /<@([A-Z0-9]+)\|/
17
+ CHANNEL_ID_PATTERN = /<#([A-Z0-9]+)(?:\|[^>]*)?>/
18
+ GROUP_ID_PATTERN = /<!subteam\^([A-Z0-9]+)(?:\|[^>]*)?>/
19
+ PR_URL_PATTERN = %r{https?://github\.com/[^/]+/[^/]+/pull/\d+}
20
+ SCHEDULED_DATE_PATTERN = %r{--scheduled=(\d{4}/\d{2}/\d{2}\s\d{2}:\d{2}:\d{2})}
21
+ GITHUB_PR_URL_PATTERN = %r{\Ahttps?://github\.com/[^/]+/[^/]+/pull/\d+\z}
22
+ GITHUB_URL_EXTRACT_PATTERN = %r{https?://github\.com/([^/]+)/([^/]+)/pull/(\d+)}
23
+
24
+ MAX_PULL_REQUESTS = 2
25
+ USERGROUP_CACHE_TTL = 86_400
26
+
27
+ # Shared across instances, keyed by a hash of the bot token so workspaces don't collide.
28
+ USERGROUP_CACHE = Cache.new(max_size: 100, ttl: USERGROUP_CACHE_TTL)
29
+
30
+ def initialize(user_id:, message:, github_token:, bot_token:, default_channel_id: "", channel_id: nil,
31
+ slack_team_mappings: {})
32
+ @user_id = user_id
33
+ @message = message.to_s
34
+ @github_token = github_token
35
+ @bot_token = bot_token
36
+ @default_channel_id = default_channel_id.to_s
37
+ @channel_id = channel_id
38
+ @slack_team_mappings = slack_team_mappings || {}
39
+ end
40
+
41
+ def call
42
+ user_ids, channel_ids, pr_urls, group_ids, scheduled_date = parse_slack_message
43
+
44
+ raise InvalidInputError, "Please provide a valid URL" if pr_urls.empty?
45
+ raise InvalidInputError, "Please provide a valid URL" unless pr_urls.all? { |url| valid_url?(url) }
46
+
47
+ user_ids.delete(@user_id)
48
+
49
+ unless pr_urls.all? { |url| GITHUB_PR_URL_PATTERN.match?(url) }
50
+ raise InvalidInputError, "Invalid Pull Request URL. Please provide a valid GitHub PR URL."
51
+ end
52
+
53
+ pr_urls = pr_urls.uniq
54
+ if pr_urls.size > MAX_PULL_REQUESTS
55
+ raise InvalidInputError, "You can only request a review for up to #{MAX_PULL_REQUESTS} pull requests at a time."
56
+ end
57
+
58
+ pr_urls.each do |pr_url|
59
+ execute(channel_ids, user_ids, pr_url, group_ids, scheduled_date)
60
+ end
61
+ nil
62
+ end
63
+
64
+ private
65
+
66
+ def parse_slack_message
67
+ user_ids = @message.scan(USER_ID_PATTERN).flatten
68
+ channel_ids = @message.scan(CHANNEL_ID_PATTERN).flatten
69
+ group_ids = @message.scan(GROUP_ID_PATTERN).flatten
70
+ pr_urls = @message.scan(PR_URL_PATTERN).flatten
71
+ scheduled_date = SCHEDULED_DATE_PATTERN.match(@message)&.captures&.first
72
+
73
+ [user_ids, channel_ids, pr_urls, group_ids, scheduled_date]
74
+ end
75
+
76
+ def valid_url?(value)
77
+ uri = URI.parse(value)
78
+ %w[http https].include?(uri.scheme) && !Support.blank?(uri.host)
79
+ rescue URI::InvalidURIError
80
+ false
81
+ end
82
+
83
+ def execute(channel_ids, user_ids, pr_url, group_ids, scheduled_date)
84
+ pr = fetch_pr_details(pr_url)
85
+ channels = resolve_channel_ids(channel_ids)
86
+ reviewers = formatted_reviewers(user_ids, group_ids, pr[:reviewers])
87
+ message = build_message(pr, reviewers)
88
+ deliver(message, channels, scheduled_date)
89
+ end
90
+
91
+ def fetch_pr_details(pr_url)
92
+ match = GITHUB_URL_EXTRACT_PATTERN.match(pr_url)
93
+ raise InvalidInputError, "Invalid PR URL format" unless match
94
+
95
+ organization, repo, number = match.captures
96
+ github = GitHub.new(token: @github_token, organization:, repo:, pull_request_number: number)
97
+ detail = github.pr_details
98
+ raise InvalidInputError, "Pull request do not have a title." if Support.blank?(detail["title"])
99
+
100
+ { number:, detail:, reviewers: github.pr_reviewers, url: pr_url }
101
+ end
102
+
103
+ def resolve_channel_ids(channel_ids)
104
+ return channel_ids unless channel_ids.empty?
105
+ return [@channel_id] unless Support.blank?(@channel_id)
106
+
107
+ Support.blank?(@default_channel_id) ? [] : [@default_channel_id]
108
+ end
109
+
110
+ def formatted_reviewers(user_ids, group_ids, pr_reviewers)
111
+ parts = []
112
+ parts << user_ids.map { |id| "<@#{id}>" }.join(" ") unless user_ids.empty?
113
+ parts << group_ids.map { |id| "<!subteam^#{id}>" }.join(" ") unless group_ids.empty?
114
+ return parts.join(" ") unless parts.empty?
115
+ return "" if Support.blank?(pr_reviewers)
116
+
117
+ subteam_format(pr_reviewers, usergroup_map)
118
+ end
119
+
120
+ # Converts "@a, @b" from GitHub into Slack subteam mentions. Names without a match stay as plain text.
121
+ def subteam_format(pr_reviewers, usergroup_map)
122
+ pr_reviewers.split(", ").map(&:strip).map do |reviewer|
123
+ external_id = @slack_team_mappings.fetch(reviewer) { usergroup_map[reviewer] }
124
+ external_id ? "<!subteam^#{external_id}>" : reviewer
125
+ end.join(" ")
126
+ end
127
+
128
+ # Looks up Slack usergroups and caches them for 24 hours. A Slack failure degrades to plain names.
129
+ def usergroup_map
130
+ key = "usergroup_map:#{Digest::SHA256.hexdigest(@bot_token.to_s)[0, 16]}"
131
+ cached = USERGROUP_CACHE.get(key)
132
+ return cached unless cached.nil? || cached.empty?
133
+
134
+ map = Slack.new(token: @bot_token).usergroups
135
+ USERGROUP_CACHE.set(key, map) unless map.empty?
136
+ map
137
+ rescue APIError => e
138
+ ReviewRequest.logger.warn("Failed to load Slack usergroups; using plain reviewer names: #{e.message}")
139
+ {}
140
+ end
141
+
142
+ def build_message(pr, reviewers)
143
+ match = GITHUB_URL_EXTRACT_PATTERN.match(pr[:url])
144
+ Messages.review_request(
145
+ user_id: @user_id,
146
+ pr_url: pr[:url],
147
+ title: pr[:detail]["title"],
148
+ repo_name: match ? match[2] : "",
149
+ formatted_reviewers: reviewers
150
+ )
151
+ end
152
+
153
+ def deliver(message, channel_ids, scheduled_date)
154
+ if channel_ids.empty?
155
+ raise InvalidInputError, "No Slack channel to post to. Mention a channel or configure a default channel."
156
+ end
157
+
158
+ slack = Slack.new(token: @bot_token, channel_ids:)
159
+ user_info = slack.user_info(@user_id)
160
+ if scheduled_date
161
+ slack.schedule_message_with_timezone(message, scheduled_date)
162
+ else
163
+ slack.post_message(message, username: user_info["real_name"], icon_url: user_info.dig("profile", "image_48"))
164
+ end
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "time"
4
+ require_relative "errors"
5
+ require_relative "http_client"
6
+ require_relative "retry"
7
+ require_relative "support"
8
+
9
+ module ReviewRequest
10
+ # Slack Web API client. Every call retries transient failures (see Retry).
11
+ class Slack
12
+ API_URL = "https://slack.com/api"
13
+ # Asia/Bangkok is UTC+7 year-round (no DST), so a fixed offset is exact.
14
+ SCHEDULE_OFFSET = "+0700"
15
+
16
+ attr_reader :token, :channel_ids
17
+
18
+ def initialize(token:, channel_ids: [], http: HTTPClient.new)
19
+ @token = token
20
+ @channel_ids = Array(channel_ids)
21
+ @http = http
22
+ end
23
+
24
+ # Maps "@handle" => usergroup ID for every usergroup in the workspace.
25
+ def usergroups
26
+ data = api("usergroups.list")
27
+ data.fetch("usergroups", []).to_h { |group| ["@#{group["handle"]}", group["id"]] }
28
+ end
29
+
30
+ def user_info(user_id)
31
+ api("users.info", user: user_id).fetch("user")
32
+ end
33
+
34
+ # Returns the Slack user ID for an email, or nil if it can't be found.
35
+ def lookup_user_by_email(email)
36
+ api("users.lookupByEmail", email:).dig("user", "id")
37
+ rescue APIError => e
38
+ ReviewRequest.logger.warn("Failed to lookup user by email '#{email}': #{e.message}")
39
+ nil
40
+ end
41
+
42
+ def usergroup_members(usergroup_id)
43
+ api("usergroups.users.list", usergroup: usergroup_id).fetch("users", [])
44
+ rescue APIError => e
45
+ ReviewRequest.logger.error("Failed to get usergroup members for #{usergroup_id}: #{e.message}")
46
+ []
47
+ end
48
+
49
+ # Posts `text` to every configured channel. Returns one response per channel.
50
+ def post_message(text, username: nil, icon_url: nil, icon_emoji: nil)
51
+ each_channel do |channel|
52
+ api("chat.postMessage", channel:, text:, username:, icon_url:, icon_emoji:)
53
+ end
54
+ end
55
+
56
+ # Schedules `text` in every configured channel at `scheduled_date`, read as Asia/Bangkok time.
57
+ # Expected format: "YYYY/MM/DD HH:MM:SS".
58
+ def schedule_message_with_timezone(text, scheduled_date)
59
+ post_at = self.class.scheduled_timestamp(scheduled_date)
60
+ each_channel do |channel|
61
+ api("chat.scheduleMessage", channel:, text:, post_at:)
62
+ end
63
+ end
64
+
65
+ def self.scheduled_timestamp(scheduled_date)
66
+ Time.strptime("#{scheduled_date} #{SCHEDULE_OFFSET}", "%Y/%m/%d %H:%M:%S %z").to_i
67
+ rescue ArgumentError
68
+ raise InvalidInputError, "Invalid scheduled date '#{scheduled_date}'. Use YYYY/MM/DD HH:MM:SS."
69
+ end
70
+
71
+ private
72
+
73
+ # Runs the block for each channel. Every channel is attempted even if one fails;
74
+ # the first error is raised afterwards.
75
+ def each_channel
76
+ results = []
77
+ errors = []
78
+ channel_ids.each do |channel|
79
+ results << yield(channel)
80
+ rescue APIError => e
81
+ errors << e
82
+ end
83
+ raise errors.first if errors.any?
84
+
85
+ results
86
+ end
87
+
88
+ def api(method, payload = {})
89
+ body = payload.compact
90
+ Retry.with_retries do
91
+ response = @http.post_json(
92
+ "#{API_URL}/#{method}",
93
+ body:,
94
+ headers: { "Authorization" => "Bearer #{token}" }
95
+ )
96
+ handle_response(method, response, body)
97
+ end
98
+ end
99
+
100
+ def handle_response(method, response, body)
101
+ unless response.ok?
102
+ raise SlackError.new("Slack #{method} returned HTTP #{response.status}", status: response.status)
103
+ end
104
+
105
+ data = response.json
106
+ raise SlackError, "Slack #{method} returned a non-JSON response" unless data.is_a?(Hash)
107
+ return data if data["ok"]
108
+
109
+ code = data["error"].to_s
110
+ if code == "channel_not_found"
111
+ raise ChannelNotFoundError,
112
+ "Channel #{body[:channel]} not found. For private channels, invite the bot first " \
113
+ "(e.g. /invite @bot-name)."
114
+ end
115
+
116
+ raise SlackError.new("Slack #{method} failed: #{code}", code:)
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReviewRequest
4
+ # Small helpers shared across the gem.
5
+ module Support
6
+ module_function
7
+
8
+ # Shallow symbol-key copy so callers can pass string-keyed JSON or symbol-keyed Ruby hashes.
9
+ def symbolize_keys(hash)
10
+ (hash || {}).to_h { |key, value| [key.to_sym, value] }
11
+ end
12
+
13
+ def blank?(value)
14
+ value.nil? || value.to_s.strip.empty?
15
+ end
16
+
17
+ def presence(value)
18
+ blank?(value) ? nil : value
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReviewRequest
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "logger"
4
+
5
+ require_relative "review_request/version"
6
+ require_relative "review_request/errors"
7
+ require_relative "review_request/support"
8
+ require_relative "review_request/cache"
9
+ require_relative "review_request/retry"
10
+ require_relative "review_request/http_client"
11
+ require_relative "review_request/date_checker"
12
+ require_relative "review_request/message_templates"
13
+ require_relative "review_request/messages"
14
+ require_relative "review_request/github"
15
+ require_relative "review_request/slack"
16
+ require_relative "review_request/jira"
17
+ require_relative "review_request/send_message"
18
+ require_relative "review_request/pr_reminder_service"
19
+ require_relative "review_request/jira_overdue_reminder_service"
20
+ require_relative "review_request/jira_sprint_notification_service"
21
+
22
+ module ReviewRequest
23
+ class << self
24
+ attr_writer :logger
25
+
26
+ # Defaults to warnings and above on stderr. Replace with your app's logger:
27
+ # ReviewRequest.logger = Rails.logger
28
+ def logger
29
+ @logger ||= Logger.new($stderr, level: :warn)
30
+ end
31
+ end
32
+ end