code_review_notifier 0.2.3 → 0.3.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
  SHA256:
3
- metadata.gz: 5760e7d91fa308531d0ab4c0da163525a0b4cf2ed169822c01ad5fedd5c6e28a
4
- data.tar.gz: 86a8c7f51968a37bca25eaa0406a6c3b7af9f33cf9702b4c03a349ba4f0cc577
3
+ metadata.gz: b1bbcb72b72b62c41bc0280a106b0586cf1a38c73fd03e3ecbb3d7116bb92e99
4
+ data.tar.gz: 3ec69fa1b947963d2785dc105b9aab845376e930359f9798fae20cff4933fe9d
5
5
  SHA512:
6
- metadata.gz: b0f8c25880aa149870bc5c39e13d081b35d9f95b5fcb3efea47ed272b2e7acadb860c7283d3efa9b29ec114b552ae92f9910bedaf5b57c003af0017cdb2fb3b1
7
- data.tar.gz: b0ed3ddba99bff4fe392847c7f8a5430f68fde44e32f02fdcbfb8deb35edc24526691b3150dc8b4102896667ebf56aa530c7b0647844025522050fba4156f7c1
6
+ metadata.gz: b84e5254f5d8a6b337de340bca53df13ecc29c5e06cc742815304cd5e07610c2f15708ffe89762b98e6c6a590bae89ef72385ff3c8a323d8268eaa371050cb6e
7
+ data.tar.gz: 285ec4d1709e9eec4dd27428fc00d20b81b88cccde1c5f52071a002ee071f356a8c9860a87f44be9cf117d827b1c557515398cdfecb63ef1b69b4eb4d4581131
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rubiclifier", "1.0.0"
5
+ gem "rubiclifier", "2.0.1"
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "code_review_notifier"
3
+ require_relative "../lib/code_review_notifier.rb"
4
4
 
5
- CodeReviewNotifier.new(ARGV).call
5
+ CodeReviewNotifier.new(ARGV, __FILE__.split("/").last).call
@@ -20,24 +20,24 @@ class CodeReviewNotifier < Rubiclifier::BaseApplication
20
20
 
21
21
  def run_application
22
22
  while true
23
- is_first_run = is_first_run?
24
- puts
25
- puts("Querying API...")
26
- all_code_changes = Api.current_api.all_code_changes
27
- puts("Checking for notifications to display...")
28
- all_activity = []
29
- all_code_changes.each do |cc|
30
- activity_for_code_change = cc.code_change_activity
31
- activity_for_code_change.sort! { |a, b| a.created_at <=> b.created_at }
32
- cc.activity_from_self_at = activity_for_code_change.find { |a| a.is_self }&.created_at
33
- all_activity.concat(activity_for_code_change)
34
- end
35
- all_activity.select(&:should_notify?).each do |code_change_activity|
36
- code_change_activity.notified
37
- unless is_first_run
38
- puts("Notifying of change!")
39
- CodeChangeNotification.new(code_change_activity).send
40
- sleep(SECONDS_BETWEEN_NOTIFICATIONS)
23
+ unless Rubiclifier::IdleDetector.is_idle?
24
+ is_first_run = is_first_run?
25
+ puts
26
+ puts("Querying API...")
27
+ all_code_changes = Api.current_api.all_code_changes
28
+ puts("Checking for notifications to display...")
29
+ all_activity = []
30
+ all_code_changes.each do |cc|
31
+ cc.code_change_activity.sort! { |a, b| a.created_at <=> b.created_at }
32
+ all_activity.concat(cc.code_change_activity)
33
+ end
34
+ all_activity.select(&:should_notify?).each do |code_change_activity|
35
+ code_change_activity.notified
36
+ unless is_first_run
37
+ puts("Notifying of change!")
38
+ CodeChangeNotification.new(code_change_activity).send
39
+ sleep(SECONDS_BETWEEN_NOTIFICATIONS)
40
+ end
41
41
  end
42
42
  end
43
43
  sleep(SECONDS_BETWEEN_RUNS)
@@ -55,6 +55,7 @@ class CodeReviewNotifier < Rubiclifier::BaseApplication
55
55
  [
56
56
  Rubiclifier::Feature::BACKGROUND,
57
57
  Rubiclifier::Feature::DATABASE,
58
+ Rubiclifier::Feature::IDLE_DETECTION,
58
59
  Rubiclifier::Feature::NOTIFICATIONS
59
60
  ]
60
61
  end
@@ -68,10 +69,6 @@ class CodeReviewNotifier < Rubiclifier::BaseApplication
68
69
  ]
69
70
  end
70
71
 
71
- def executable_name
72
- "code_review_notifier"
73
- end
74
-
75
72
  def data_directory
76
73
  "~/.code_review_notifier"
77
74
  end
@@ -3,7 +3,6 @@ require "date"
3
3
  class CodeChange
4
4
  attr_accessor :code_change_activity
5
5
  attr_reader :id, :owner, :project, :subject, :updated_at
6
- attr_writer :activity_from_self_at
7
6
 
8
7
  def initialize(id, owner, project, subject, updated_at)
9
8
  @id = id
@@ -14,7 +13,6 @@ class CodeChange
14
13
  end
15
14
 
16
15
  def activity_from_self_at
17
- raise "@activity_from_self_at is not set" unless instance_variable_defined?("@activity_from_self_at")
18
- @activity_from_self_at
16
+ @activity_from_self_at ||= code_change_activity.find { |a| a.is_self }&.created_at
19
17
  end
20
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_review_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Grinstead
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-09 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: kyleag@hey.com