toggl-jobcan 0.5.0 → 0.7.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 +4 -4
- data/.github/workflows/rspec.yml +25 -0
- data/.gitignore +1 -0
- data/Dockerfile +3 -3
- data/README.md +0 -1
- data/lib/toggl/jobcan/cli.rb +18 -5
- data/lib/toggl/jobcan/toggl_support.rb +5 -3
- data/lib/toggl/jobcan/version.rb +1 -1
- data/toggl-jobcan.gemspec +3 -2
- metadata +26 -13
- data/.travis.yml +0 -7
- data/Gemfile.lock +0 -184
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d97f44c04aaab1de12ddf25087a02b870db237b7926db2a760f6d93888a1eff
|
|
4
|
+
data.tar.gz: 7b5833d24e69598835625fd86e2e12063053ea4ca358f835f27eaf27f8711d62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d5b2f45ee2502f36d4e4e6ca82c31d425a1efd511d2f49fec521d4af2eaf370b529bf4d129c91d9ba3de75102b166318b0220b81d1366e242defbd124cfa94d
|
|
7
|
+
data.tar.gz: 6fdeff1edb4f8cde58487cff610cfd4a7e845aef732e2e2775ae887fae3037c04bddd2aeb94a474f59bc8de986e5f9e058dc4d67e736259faf0c0adbc3d3aa81
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Run RSpec tests
|
|
2
|
+
on: [push]
|
|
3
|
+
jobs:
|
|
4
|
+
test:
|
|
5
|
+
strategy:
|
|
6
|
+
fail-fast: false
|
|
7
|
+
matrix:
|
|
8
|
+
os:
|
|
9
|
+
- ubuntu-latest
|
|
10
|
+
ruby:
|
|
11
|
+
- 3.2
|
|
12
|
+
- 3.3
|
|
13
|
+
- 3.4
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Set up Ruby
|
|
18
|
+
uses: ruby/setup-ruby@v1
|
|
19
|
+
with:
|
|
20
|
+
ruby-version: ${{ matrix.ruby }}
|
|
21
|
+
bundler: latest
|
|
22
|
+
bundler-cache: true
|
|
23
|
+
- name: Run tests
|
|
24
|
+
run: |
|
|
25
|
+
bundle exec rake spec
|
data/.gitignore
CHANGED
data/Dockerfile
CHANGED
|
@@ -20,11 +20,11 @@ RUN anyenv install rbenv
|
|
|
20
20
|
RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
|
21
21
|
|
|
22
22
|
# ruby
|
|
23
|
-
RUN rbenv install
|
|
24
|
-
RUN rbenv global
|
|
23
|
+
RUN rbenv install 3.1.4
|
|
24
|
+
RUN rbenv global 3.1.4
|
|
25
25
|
|
|
26
26
|
# toggl-jobcan
|
|
27
|
-
RUN gem install selenium-webdriver -v 4.
|
|
27
|
+
RUN gem install selenium-webdriver -v 4.21.1
|
|
28
28
|
RUN gem install toggl-jobcan
|
|
29
29
|
|
|
30
30
|
ENTRYPOINT ["toggl-jobcan"]
|
data/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Toggl::Jobcan
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-
[](https://travis-ci.com/limitusus/toggl-jobcan)
|
|
5
4
|
|
|
6
5
|
This gem provides `toggl-jobcan` command, which synchronises working time data in Toggl to JobCan.
|
|
7
6
|
|
data/lib/toggl/jobcan/cli.rb
CHANGED
|
@@ -104,27 +104,40 @@ module Toggl
|
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
# To collect time entries in an API call, target days must be in a single month
|
|
108
|
+
def validate_days_in_a_month
|
|
109
|
+
day = @target_days.first
|
|
110
|
+
y = day.year
|
|
111
|
+
m = day.month
|
|
112
|
+
unless @target_days.all? { |d| d.year == y and d.month == m }
|
|
113
|
+
raise DifferentYearMonthError, "Different year/month=#{d.year}/#{d.month}"
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
107
117
|
def register_days
|
|
118
|
+
validate_days_in_a_month
|
|
119
|
+
working_times_map = jobcan.fetch_toggl_worktime(@target_days)
|
|
108
120
|
@target_days.each do |date|
|
|
109
|
-
register_day(date)
|
|
121
|
+
register_day(working_times_map, date)
|
|
110
122
|
end
|
|
111
123
|
end
|
|
112
124
|
|
|
113
|
-
def register_day(date)
|
|
125
|
+
def register_day(working_times_map, date)
|
|
114
126
|
puts "Input date: #{date}"
|
|
115
|
-
working_times =
|
|
116
|
-
if working_times.any?(&:nil?)
|
|
127
|
+
working_times = working_times_map[date.day]&.flatten
|
|
128
|
+
if working_times.nil? || working_times.any?(&:nil?)
|
|
117
129
|
puts 'Includes nil data: skip'
|
|
118
130
|
return
|
|
119
131
|
end
|
|
120
132
|
jobcan.navigate_to_attendance_modify_day(date)
|
|
121
133
|
jobcan.input_day_worktime(date, working_times)
|
|
122
134
|
sleep 1
|
|
123
|
-
puts " - Finish: #{date}; Total time: #{jobcan.toggl.total_time}"
|
|
135
|
+
puts " - Finish: #{date}; Total time: #{jobcan.toggl.total_time(day: date.day)}"
|
|
124
136
|
end
|
|
125
137
|
end
|
|
126
138
|
end
|
|
127
139
|
|
|
128
140
|
class NoDayGivenError < StandardError; end
|
|
141
|
+
class DifferentYearMonthError < StandardError; end
|
|
129
142
|
end
|
|
130
143
|
end
|
|
@@ -4,9 +4,11 @@ module Toggl
|
|
|
4
4
|
module Jobcan
|
|
5
5
|
# Provides support methods for Toggl
|
|
6
6
|
module TogglSupport
|
|
7
|
-
def fetch_toggl_worktime(
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
def fetch_toggl_worktime(dates)
|
|
8
|
+
first_day = dates.sort.first
|
|
9
|
+
last_day = dates.sort.last
|
|
10
|
+
@toggl.merge_multi!(first_day.year, first_day.month, first_day.day, last_day.day)
|
|
11
|
+
@toggl.work_time_map
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
def toggl_time_format(date, timestamp)
|
data/lib/toggl/jobcan/version.rb
CHANGED
data/toggl-jobcan.gemspec
CHANGED
|
@@ -24,9 +24,10 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
|
|
25
25
|
spec.add_dependency 'selenium-webdriver'
|
|
26
26
|
spec.add_dependency 'thor'
|
|
27
|
-
spec.add_dependency 'toggl-worktime', '~> 0.
|
|
27
|
+
spec.add_dependency 'toggl-worktime', '~> 0.7.0', '>= 0.7.0'
|
|
28
28
|
spec.add_dependency 'webdrivers'
|
|
29
|
-
spec.add_development_dependency 'bundler'
|
|
29
|
+
spec.add_development_dependency 'bundler'
|
|
30
|
+
spec.add_development_dependency 'gem-release'
|
|
30
31
|
spec.add_development_dependency 'github_changelog_generator'
|
|
31
32
|
spec.add_development_dependency 'pry'
|
|
32
33
|
spec.add_development_dependency 'pry-byebug'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: toggl-jobcan
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomoya Kabe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-12-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: selenium-webdriver
|
|
@@ -44,20 +44,20 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.
|
|
47
|
+
version: 0.7.0
|
|
48
48
|
- - ">="
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: 0.
|
|
50
|
+
version: 0.7.0
|
|
51
51
|
type: :runtime
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
|
55
55
|
- - "~>"
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: 0.
|
|
57
|
+
version: 0.7.0
|
|
58
58
|
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 0.
|
|
60
|
+
version: 0.7.0
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
|
62
62
|
name: webdrivers
|
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,16 +76,30 @@ dependencies:
|
|
|
76
76
|
name: bundler
|
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
|
-
- - "
|
|
79
|
+
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
81
|
+
version: '0'
|
|
82
82
|
type: :development
|
|
83
83
|
prerelease: false
|
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
|
-
- - "
|
|
86
|
+
- - ">="
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
88
|
+
version: '0'
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: gem-release
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
type: :development
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
89
103
|
- !ruby/object:Gem::Dependency
|
|
90
104
|
name: github_changelog_generator
|
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -164,15 +178,14 @@ executables:
|
|
|
164
178
|
extensions: []
|
|
165
179
|
extra_rdoc_files: []
|
|
166
180
|
files:
|
|
181
|
+
- ".github/workflows/rspec.yml"
|
|
167
182
|
- ".gitignore"
|
|
168
183
|
- ".rspec"
|
|
169
184
|
- ".rubocop.yml"
|
|
170
|
-
- ".travis.yml"
|
|
171
185
|
- CHANGELOG.md
|
|
172
186
|
- CODE_OF_CONDUCT.md
|
|
173
187
|
- Dockerfile
|
|
174
188
|
- Gemfile
|
|
175
|
-
- Gemfile.lock
|
|
176
189
|
- LICENSE.txt
|
|
177
190
|
- README.md
|
|
178
191
|
- Rakefile
|
|
@@ -205,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
205
218
|
- !ruby/object:Gem::Version
|
|
206
219
|
version: '0'
|
|
207
220
|
requirements: []
|
|
208
|
-
rubygems_version: 3.
|
|
221
|
+
rubygems_version: 3.5.16
|
|
209
222
|
signing_key:
|
|
210
223
|
specification_version: 4
|
|
211
224
|
summary: Sync toggl worktime to JobCan.
|
data/.travis.yml
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
toggl-jobcan (0.4.3)
|
|
5
|
-
selenium-webdriver
|
|
6
|
-
thor
|
|
7
|
-
toggl-worktime (~> 0.5.0, >= 0.5.0)
|
|
8
|
-
webdrivers
|
|
9
|
-
|
|
10
|
-
GEM
|
|
11
|
-
remote: https://rubygems.org/
|
|
12
|
-
specs:
|
|
13
|
-
activesupport (7.1.3.3)
|
|
14
|
-
base64
|
|
15
|
-
bigdecimal
|
|
16
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
17
|
-
connection_pool (>= 2.2.5)
|
|
18
|
-
drb
|
|
19
|
-
i18n (>= 1.6, < 2)
|
|
20
|
-
minitest (>= 5.1)
|
|
21
|
-
mutex_m
|
|
22
|
-
tzinfo (~> 2.0)
|
|
23
|
-
addressable (2.8.6)
|
|
24
|
-
public_suffix (>= 2.0.2, < 6.0)
|
|
25
|
-
async (1.32.1)
|
|
26
|
-
console (~> 1.10)
|
|
27
|
-
nio4r (~> 2.3)
|
|
28
|
-
timers (~> 4.1)
|
|
29
|
-
async-http (0.64.2)
|
|
30
|
-
async (>= 1.25)
|
|
31
|
-
async-io (>= 1.28)
|
|
32
|
-
async-pool (>= 0.2)
|
|
33
|
-
protocol-http (~> 0.26.0)
|
|
34
|
-
protocol-http1 (~> 0.19.0)
|
|
35
|
-
protocol-http2 (~> 0.16.0)
|
|
36
|
-
traces (>= 0.10.0)
|
|
37
|
-
async-http-faraday (0.13.1)
|
|
38
|
-
async-http (~> 0.42)
|
|
39
|
-
faraday
|
|
40
|
-
async-io (1.43.2)
|
|
41
|
-
async
|
|
42
|
-
async-pool (0.4.0)
|
|
43
|
-
async (>= 1.25)
|
|
44
|
-
awesome_print (1.9.2)
|
|
45
|
-
base64 (0.2.0)
|
|
46
|
-
bigdecimal (3.1.8)
|
|
47
|
-
byebug (11.1.3)
|
|
48
|
-
coderay (1.1.3)
|
|
49
|
-
concurrent-ruby (1.3.1)
|
|
50
|
-
connection_pool (2.4.1)
|
|
51
|
-
console (1.24.0)
|
|
52
|
-
fiber-annotation
|
|
53
|
-
fiber-local
|
|
54
|
-
json
|
|
55
|
-
diff-lcs (1.5.1)
|
|
56
|
-
drb (2.2.1)
|
|
57
|
-
faraday (2.9.0)
|
|
58
|
-
faraday-net_http (>= 2.0, < 3.2)
|
|
59
|
-
faraday-http-cache (2.5.1)
|
|
60
|
-
faraday (>= 0.8)
|
|
61
|
-
faraday-net_http (3.1.0)
|
|
62
|
-
net-http
|
|
63
|
-
fiber-annotation (0.2.0)
|
|
64
|
-
fiber-local (1.0.0)
|
|
65
|
-
github_changelog_generator (1.16.4)
|
|
66
|
-
activesupport
|
|
67
|
-
async (>= 1.25.0)
|
|
68
|
-
async-http-faraday
|
|
69
|
-
faraday-http-cache
|
|
70
|
-
multi_json
|
|
71
|
-
octokit (~> 4.6)
|
|
72
|
-
rainbow (>= 2.2.1)
|
|
73
|
-
rake (>= 10.0)
|
|
74
|
-
i18n (1.14.5)
|
|
75
|
-
concurrent-ruby (~> 1.0)
|
|
76
|
-
json (2.7.2)
|
|
77
|
-
logger (1.6.0)
|
|
78
|
-
method_source (1.1.0)
|
|
79
|
-
mini_portile2 (2.8.7)
|
|
80
|
-
minitest (5.23.1)
|
|
81
|
-
multi_json (1.15.0)
|
|
82
|
-
mutex_m (0.2.0)
|
|
83
|
-
net-http (0.4.1)
|
|
84
|
-
uri
|
|
85
|
-
nio4r (2.7.3)
|
|
86
|
-
nokogiri (1.16.5)
|
|
87
|
-
mini_portile2 (~> 2.8.2)
|
|
88
|
-
racc (~> 1.4)
|
|
89
|
-
octokit (4.25.1)
|
|
90
|
-
faraday (>= 1, < 3)
|
|
91
|
-
sawyer (~> 0.9)
|
|
92
|
-
oj (3.16.3)
|
|
93
|
-
bigdecimal (>= 3.0)
|
|
94
|
-
pastel (0.8.0)
|
|
95
|
-
tty-color (~> 0.5)
|
|
96
|
-
protocol-hpack (1.4.3)
|
|
97
|
-
protocol-http (0.26.4)
|
|
98
|
-
protocol-http1 (0.19.1)
|
|
99
|
-
protocol-http (~> 0.22)
|
|
100
|
-
protocol-http2 (0.16.0)
|
|
101
|
-
protocol-hpack (~> 1.4)
|
|
102
|
-
protocol-http (~> 0.18)
|
|
103
|
-
pry (0.14.2)
|
|
104
|
-
coderay (~> 1.1)
|
|
105
|
-
method_source (~> 1.0)
|
|
106
|
-
pry-byebug (3.10.1)
|
|
107
|
-
byebug (~> 11.0)
|
|
108
|
-
pry (>= 0.13, < 0.15)
|
|
109
|
-
public_suffix (5.0.5)
|
|
110
|
-
racc (1.8.0)
|
|
111
|
-
rainbow (3.1.1)
|
|
112
|
-
rake (13.2.1)
|
|
113
|
-
rexml (3.2.8)
|
|
114
|
-
strscan (>= 3.0.9)
|
|
115
|
-
rspec (3.13.0)
|
|
116
|
-
rspec-core (~> 3.13.0)
|
|
117
|
-
rspec-expectations (~> 3.13.0)
|
|
118
|
-
rspec-mocks (~> 3.13.0)
|
|
119
|
-
rspec-core (3.13.0)
|
|
120
|
-
rspec-support (~> 3.13.0)
|
|
121
|
-
rspec-expectations (3.13.0)
|
|
122
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
123
|
-
rspec-support (~> 3.13.0)
|
|
124
|
-
rspec-mocks (3.13.1)
|
|
125
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
126
|
-
rspec-support (~> 3.13.0)
|
|
127
|
-
rspec-support (3.13.1)
|
|
128
|
-
rubyzip (2.3.2)
|
|
129
|
-
sawyer (0.9.2)
|
|
130
|
-
addressable (>= 2.3.5)
|
|
131
|
-
faraday (>= 0.17.3, < 3)
|
|
132
|
-
selenium-webdriver (4.21.1)
|
|
133
|
-
base64 (~> 0.2)
|
|
134
|
-
rexml (~> 3.2, >= 3.2.5)
|
|
135
|
-
rubyzip (>= 1.2.2, < 3.0)
|
|
136
|
-
websocket (~> 1.0)
|
|
137
|
-
strings (0.2.1)
|
|
138
|
-
strings-ansi (~> 0.2)
|
|
139
|
-
unicode-display_width (>= 1.5, < 3.0)
|
|
140
|
-
unicode_utils (~> 1.4)
|
|
141
|
-
strings-ansi (0.2.0)
|
|
142
|
-
strscan (3.1.0)
|
|
143
|
-
thor (1.3.1)
|
|
144
|
-
timers (4.3.5)
|
|
145
|
-
toggl-worktime (0.5.0)
|
|
146
|
-
awesome_print
|
|
147
|
-
togglv9 (>= 0.1.0)
|
|
148
|
-
tty-table
|
|
149
|
-
togglv9 (0.1.0)
|
|
150
|
-
faraday (>= 2.0.0)
|
|
151
|
-
logger
|
|
152
|
-
oj
|
|
153
|
-
traces (0.11.1)
|
|
154
|
-
tty-color (0.6.0)
|
|
155
|
-
tty-screen (0.8.2)
|
|
156
|
-
tty-table (0.12.0)
|
|
157
|
-
pastel (~> 0.8)
|
|
158
|
-
strings (~> 0.2.0)
|
|
159
|
-
tty-screen (~> 0.8)
|
|
160
|
-
tzinfo (2.0.6)
|
|
161
|
-
concurrent-ruby (~> 1.0)
|
|
162
|
-
unicode-display_width (2.5.0)
|
|
163
|
-
unicode_utils (1.4.0)
|
|
164
|
-
uri (0.13.0)
|
|
165
|
-
webdrivers (5.2.0)
|
|
166
|
-
nokogiri (~> 1.6)
|
|
167
|
-
rubyzip (>= 1.3.0)
|
|
168
|
-
selenium-webdriver (~> 4.0)
|
|
169
|
-
websocket (1.2.10)
|
|
170
|
-
|
|
171
|
-
PLATFORMS
|
|
172
|
-
ruby
|
|
173
|
-
|
|
174
|
-
DEPENDENCIES
|
|
175
|
-
bundler (~> 2.2.0)
|
|
176
|
-
github_changelog_generator
|
|
177
|
-
pry
|
|
178
|
-
pry-byebug
|
|
179
|
-
rake (~> 13.0)
|
|
180
|
-
rspec (~> 3.0)
|
|
181
|
-
toggl-jobcan!
|
|
182
|
-
|
|
183
|
-
BUNDLED WITH
|
|
184
|
-
2.2.28
|