code_review_notifier 0.2.2 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 790df27d9acb825ba25b7d709407a665325c197e9ee8033569d5f86e72e0f6a0
4
- data.tar.gz: 3dd80bdd477b6f251d40d45bbaf56d574584d194d7b858ddd255fe7327443f9c
3
+ metadata.gz: 79c56b74f5987e4f35b4fb6c69fe307bcf64509feb0568d656ae4eae03b00239
4
+ data.tar.gz: b722ba34c4f8f48a060df09a33630219b9660395d4b34dadd5a53dee602870d9
5
5
  SHA512:
6
- metadata.gz: 557585a22db594cb9f12c20e3ef98898a0e81bb7ba606648f0ea526f3140d8a920652b30816a7614d13dbd6d640aefb837c57ece0df6096b87b35ce5a21f0a74
7
- data.tar.gz: 89c9687da7c0b4947b6589b65e5766f0c3bb4cf0ff3767bd3f23ae468dd96656219b515f9705ed09e97fa2e6a8316af8b7418a254867b5e385df28e887465d60
6
+ metadata.gz: 51023ef8da1ba13111274e44cc2621d7943de7a8f6e5bf87954c94de1ea8575dc2ef3954567c8eabcda8f1cbccad0883d3517e993fdc507081821c7876753776
7
+ data.tar.gz: 5f7d6cb2a7b57c54068e1f4788a3c082b0ba87720473123cdea47ba13a7b722fe5b9a56e917e64e24f9fe1cdde092ea65c7a61dbd78e8b0c4906c227b934ffba
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rubiclifier"
5
+ gem "rubiclifier", "2.0.0"
@@ -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)
@@ -51,12 +51,13 @@ class CodeReviewNotifier < Rubiclifier::BaseApplication
51
51
  ).send
52
52
  end
53
53
 
54
- def is_background_service?
55
- true
56
- end
57
-
58
- def sends_notifications?
59
- true
54
+ def features
55
+ [
56
+ Rubiclifier::Feature::BACKGROUND,
57
+ Rubiclifier::Feature::DATABASE,
58
+ Rubiclifier::Feature::IDLE_DETECTION,
59
+ Rubiclifier::Feature::NOTIFICATIONS
60
+ ]
60
61
  end
61
62
 
62
63
  def settings
@@ -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.2
4
+ version: 0.3.2
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
@@ -32,7 +32,7 @@ licenses:
32
32
  metadata:
33
33
  source_code_uri: https://github.com/MrGrinst/code_review_notifier
34
34
  post_install_message: "\n\e[32mThanks for installing code_review_notifier!\e[0m\n\e[32mSet
35
- it up by running `code_review_notifier --setup`\e[0m\n\n"
35
+ it up by running `\e[0mcode_review_notifier --setup\e[32m`\e[0m\n\n"
36
36
  rdoc_options: []
37
37
  require_paths:
38
38
  - lib