kobot 1.2.3 → 1.2.4

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: 3eba14b1e3b076a368dd700c2ac46a9db4fd13bf57a58e29797de7db7eb16fc3
4
- data.tar.gz: 1926333cefbaf4272ae117cc7afb12284ed85d6ff41aa96a02094904599b5312
3
+ metadata.gz: 0e8cedf9053f994144d21b233b2c68fb4e03aff011192f1273e1ad24d347c4f9
4
+ data.tar.gz: 8daab86f87c5ffe5e0588c9029ccd062954ca7ad3557769861ef19fd07347c79
5
5
  SHA512:
6
- metadata.gz: '08ad9cb2d55c2931a34ed4243884a7e16c189d1d914e5aa935cfd4d32fc3d3d7567cdaecdb53de54e980e84ec4c6e696761b7f9b15fb65e3a0eef11f829370e5'
7
- data.tar.gz: f8662e41fe53d35df04b1b530f946621330124684d6bd955e6b18e53830efaef74c22db66818a8a3958aa8a4745b4d37090419f538962c3a4876e8dbb9b6c1d7
6
+ metadata.gz: 4aaaa2f0e8eebe98487536158b0f571e794b76db95dec5cd2eb268037dfd0888045d6cebbeb46876162ed9944813f7429e8a4466da20ca9010ecacfd552cd302
7
+ data.tar.gz: 9ede3410f3ad664982db308f382140eb19bc8140970fc4991f68829a0c63fe664a6978b99ef5753036954a0bbabb9731b3f7e5fe08aff11c589798898ce0ec59
@@ -22,3 +22,6 @@
22
22
  ### v1.2.3
23
23
  - Improved validation logic to skip running due to weekend or intentional skips
24
24
  - Refactored engine by reducing methods length based on reports by Rubocop
25
+
26
+ ### v1.2.4
27
+ - Changed to use boolean values for validation instead of raising exceptions
@@ -14,7 +14,7 @@ module Kobot
14
14
 
15
15
  # The entrance where the whole flow starts.
16
16
  #
17
- # It exits early if today is weekend or treated as holiday by
17
+ # It exits early if today is weekend or marked as to skip by
18
18
  # the #{Config.skip} specified from command line option --skip.
19
19
  #
20
20
  # Unexpected behavior such as record appearing as holiday on
@@ -24,7 +24,8 @@ module Kobot
24
24
  # System errors or any unknown exceptions occurred if any are
25
25
  # to be popped up and should be handled by the outside caller.
26
26
  def start
27
- validate_today!
27
+ return unless should_run_today?
28
+
28
29
  launch_browser
29
30
  login
30
31
  read_today_record
@@ -35,8 +36,6 @@ module Kobot
35
36
  clock_out!
36
37
  end
37
38
  logout
38
- rescue KotSkip => e
39
- Kobot.logger.warn(e.message)
40
39
  rescue KotRecordError => e
41
40
  Kobot.logger.warn(e.message)
42
41
  Mailer.send(clock_notify_message(status: e.message))
@@ -60,13 +59,16 @@ module Kobot
60
59
 
61
60
  private
62
61
 
63
- def validate_today!
64
- raise KotSkip, "Today=#{@today} is skipped as per: --skip=#{Config.skip}" if skip?
65
-
66
- return unless weekend?
67
- raise KotSkip, "Today=#{@today} is weekend" unless Config.force
62
+ def should_run_today?
63
+ if skip?
64
+ Kobot.logger.warn("Today=#{@today} is skipped as per: --skip=#{Config.skip}")
65
+ return false
66
+ end
67
+ return true unless weekend?
68
68
 
69
- Kobot.logger.info("[Force] should have exited: today=#{@today} is weekend")
69
+ Kobot.logger.info("[Force] should have exited: today=#{@today} is weekend") if Config.force
70
+ Kobot.logger.warn("Today=#{@today} is weekend") unless Config.force
71
+ Config.force
70
72
  end
71
73
 
72
74
  def launch_browser
@@ -1,15 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kobot
4
- class KotSkip < StandardError
5
- end
6
-
7
- class KotRecordError < StandardError
8
- end
9
-
10
- class KotClockInError < StandardError
11
- end
12
-
13
- class KotClockOutError < StandardError
14
- end
4
+ class KotRecordError < StandardError; end
5
+ class KotClockInError < StandardError; end
6
+ class KotClockOutError < StandardError; end
15
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kobot
4
- VERSION = '1.2.3'
4
+ VERSION = '1.2.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-05 00:00:00.000000000 Z
11
+ date: 2020-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webdrivers