kobot 1.0.0 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a9d8a789566c49cffabd4006d13502a6222a211d9193cdf58f0523c6dd89937
4
- data.tar.gz: 993fed11502b5149ece85da3d46d69f74169cf75c479221e56becf6b195d6d97
3
+ metadata.gz: 00f2c1151ffcb202b20d4b3f9881c9570b1075ea3684f7ab3ea2cfc65baf4b33
4
+ data.tar.gz: a6f3da0260abbbfce192557ea580526698b828ed19ec7175dd64080fa437ba35
5
5
  SHA512:
6
- metadata.gz: 3fe31ae275852246a0ba1656f829352ef204278d55f4578bc160d1917b8c07a8586b621eee42ed80e1c7535c0650de0cd8a7edcbb5b7da9f7359f2fa42a8a435
7
- data.tar.gz: e904e08fe88b5c616e5c7287e77a6de4d0e7b85dba1306e4c5dd8ab9ff24938437cd69dcfed4e2da0c6904ddbfb561a96a4aea92f0d61a268b2460591d950efe
6
+ metadata.gz: 4fb7e982db990bdbf659009501f3eb028d02fdddf7e8d6ea48762495867196f5dfc748c6d14926d5239b57c4433dad3d2568c8d6ca9bf42d6de401b91391e7a3
7
+ data.tar.gz: '06482f411bfbf8f0083d0750e7d8ea4074f6740de3e9b1d6ba27c3e850356cd28c39d83d3a27f5d99bf7e21589cce65d64396793ffd018180ec621f926db7327'
@@ -1,2 +1,7 @@
1
1
  ### v1.0.0
2
2
  - Initial release
3
+
4
+ ### v1.1.0
5
+ - Deprecated lower-case environment variables for credentials configuration
6
+ - Updated option help doc to indicate weekends and public holidays are skipped by default
7
+ - Updated required_ruby_version to be >= 2.4.0 to align with the webdrivers dependency
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
- # Kobot
1
+ # Kobot [![Gem Version](https://badge.fury.io/rb/kobot.svg)](https://badge.fury.io/rb/kobot)
2
2
 
3
3
  Kobot is a simple tool to automate the clock in or clock out operation on the web service
4
- provided by [KING OF TIME](kingtime.jp) by leveraging [Selenium WebDriver](selenium.dev),
5
- and with Google Gmail service email notification can also be sent to notify the results.
4
+ provided by [KING OF TIME](https://www.kingtime.jp/) by leveraging [Selenium WebDriver](
5
+ https://www.selenium.dev/), and with Google Gmail service email notifications can also be
6
+ sent to notify the results.
6
7
 
7
8
  It is meant for use only by one working under the discretionary labor system or flexible
8
9
  hours where the daily record is still required regardless of the actual start or end time
@@ -21,10 +22,11 @@ Tested on macOS Catelina and runs on Heroku platform so it works on unix-like sy
21
22
  #### Configuration
22
23
 
23
24
  By default it uses `~/.kobot` file locally to persist credentials for reuse, but all credentials
24
- can be overridden by setting environment variables, which is the recommended way of running the
25
- job on platforms like Heroku. When running for the first time, if none of the configuration file
26
- and ENV satisfies all required credentials, an interactive prompt will be displayed for setting,
27
- so there is no need to manually prepare the file beforehand. The content looks something like:
25
+ can also be supplied or overridden by runtime environment variables, which is the recommended way
26
+ of running as scheduled jobs on platforms like Heroku. When running for the first time, if neither
27
+ the configuration file nor ENV satisfies all required credentials, `an interactive prompt will be
28
+ displayed for initial setting, so there is no need to manually prepare the file beforehand`. The
29
+ content looks something like:
28
30
  ```property
29
31
  kot_id=xxx
30
32
  kot_password=xxx
@@ -34,6 +36,7 @@ Gmail account and password (or `app` password if MFA is on) are asked when notif
34
36
  gmail_id=xxx
35
37
  gmail_password=xxx
36
38
  ```
39
+ Note: use all upper-case letters for the above variables if using environment variables, e.g. `KOT_ID`.
37
40
 
38
41
  #### Google Chrome browser
39
42
 
@@ -51,13 +54,14 @@ $ gem install kobot
51
54
  ## Usage
52
55
 
53
56
  Get help doc:
54
- ```bash
57
+ ```
55
58
  $ kobot -h
56
59
  Usage: kobot [options]
57
60
  -c, --clock CLOCK The clock action: in, out
58
61
  -l, --loglevel [LEVEL] Specify log level: debug, info, warn, error. Default is info
59
62
  -s, --skip [D1,D2,D3] Specify dates to skip clock in/out with date format YYYY-MM-DD and
60
63
  multiple values separated by comma, such as: 2020-05-01,2020-12-31
64
+ Weekends and public holidays in Japan are skipped by default.
61
65
  -t, --to [TO] Email address to send notification to. By default it is sent to
62
66
  the same self email account used in SMTP config as the sender
63
67
  -n, --notify Enable email notification
@@ -69,20 +73,25 @@ Usage: kobot [options]
69
73
  ```
70
74
 
71
75
  Dryrun to try out:
72
- ```bash
73
- $ kobot --clock in --dryrun
76
+ ```
77
+ $ kobot --clock in --notify --dryrun
74
78
  ```
75
79
 
76
80
  Clock in/out with email notification
77
- ```bash
78
- $ kobot --clock in --notify
79
- $ kobot --clock out --notify
81
+ ```
82
+ $ kobot --clock in --notify --headless
83
+ $ kobot --clock out --notify --headless
80
84
  ```
81
85
 
82
86
  Run the task with crontab
83
87
  ```cron
84
- 30 09 * * * user kobot --clock in --notify
85
- 30 18 * * * user kobot --clock out --notify
88
+ # Weekend and public holidays will be skipped by default
89
+ 30 09 * * * user kobot --cin -n -x
90
+ 30 18 * * * user kobot --cout -n -x
91
+
92
+ # Skip for weekdays planned to take leave for example
93
+ 30 09 * * * user kobot --cin -n -x -s 2020-09-01,2020-11-11
94
+ 30 18 * * * user kobot --cout -n -x -s 2020-09-01,2020-11-11
86
95
  ```
87
96
  On platforms like Heroku, an add-on called [Heroku Scheduler](https://elements.heroku.com/addons/scheduler) makes
88
97
  running scheduled tasks much easier. Tips: either clock in or clock out task can be scheduled multiple times in
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
 
18
18
  spec.homepage = 'https://github.com/yuan-jiang/kobot'
19
19
  spec.license = 'MIT'
20
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
20
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
21
21
 
22
22
  spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
23
23
  spec.metadata['homepage_uri'] = spec.homepage
@@ -41,18 +41,22 @@ module Kobot
41
41
  if File.exist? Config.credentials_file
42
42
  File.open(Config.credentials_file) do |file|
43
43
  file.each do |line|
44
- attr, value = line.chomp.split('=')
44
+ attr, value = line.strip.split('=')
45
45
  @credentials[attr] = value
46
46
  end
47
47
  end
48
48
  end
49
- @credentials['kot_id'] = ENV['kot_id'] if ENV['kot_id']
50
- @credentials['kot_password'] = ENV['kot_password'] if ENV['kot_password']
51
- @credentials['gmail_id'] = ENV['gmail_id'] if ENV['gmail_id']
52
- @credentials['gmail_password'] = ENV['gmail_password'] if ENV['gmail_password']
53
-
54
49
  required_credentials = %w[kot_id kot_password]
55
50
  required_credentials.concat %w[gmail_id gmail_password] if Config.gmail_notify_enabled
51
+ required_credentials.each do |attr|
52
+ if ENV[attr]
53
+ Kobot.logger.warn(
54
+ "[DEPRECATION] lower-case ENV variable is deprecated, please use #{attr.upcase} instead."
55
+ )
56
+ end
57
+ env_attr_value = ENV[attr.upcase] || ENV[attr]
58
+ @credentials[attr] = env_attr_value if env_attr_value
59
+ end
56
60
  required_credentials.none? do |attr|
57
61
  credential = @credentials[attr]
58
62
  !credential || credential.strip.empty?
@@ -24,7 +24,8 @@ module Kobot
24
24
 
25
25
  opt.on('-s', '--skip [D1,D2,D3]', Array,
26
26
  'Specify dates to skip clock in/out with date format YYYY-MM-DD and',
27
- 'multiple values separated by comma, such as: 2020-05-01,2020-12-31') do |skip|
27
+ 'multiple values separated by comma, such as: 2020-05-01,2020-12-31',
28
+ 'Weekends and public holidays in Japan are skipped by default.') do |skip|
28
29
  options[:skip] = skip
29
30
  end
30
31
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kobot
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
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.0.0
4
+ version: 1.1.0
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-08-10 00:00:00.000000000 Z
11
+ date: 2020-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webdrivers
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 2.3.0
103
+ version: 2.4.0
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="