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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/kobot/engine.rb +12 -10
- data/lib/kobot/exception.rb +3 -11
- data/lib/kobot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e8cedf9053f994144d21b233b2c68fb4e03aff011192f1273e1ad24d347c4f9
|
|
4
|
+
data.tar.gz: 8daab86f87c5ffe5e0588c9029ccd062954ca7ad3557769861ef19fd07347c79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4aaaa2f0e8eebe98487536158b0f571e794b76db95dec5cd2eb268037dfd0888045d6cebbeb46876162ed9944813f7429e8a4466da20ca9010ecacfd552cd302
|
|
7
|
+
data.tar.gz: 9ede3410f3ad664982db308f382140eb19bc8140970fc4991f68829a0c63fe664a6978b99ef5753036954a0bbabb9731b3f7e5fe08aff11c589798898ce0ec59
|
data/CHANGELOG.md
CHANGED
|
@@ -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
|
data/lib/kobot/engine.rb
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
data/lib/kobot/exception.rb
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Kobot
|
|
4
|
-
class
|
|
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
|
data/lib/kobot/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: webdrivers
|