calendar-assistant 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +152 -67
- data/Rakefile +13 -3
- data/bin/calendar-assistant +3 -1
- data/lib/calendar_assistant.rb +0 -1
- data/lib/calendar_assistant/calendar_assistant.rb +16 -14
- data/lib/calendar_assistant/cli.rb +9 -233
- data/lib/calendar_assistant/cli/authorizer.rb +88 -0
- data/lib/calendar_assistant/cli/commands.rb +284 -0
- data/lib/calendar_assistant/cli/config.rb +51 -0
- data/lib/calendar_assistant/cli/event_presenter.rb +71 -0
- data/lib/calendar_assistant/cli/event_set_presenter.rb +69 -0
- data/lib/calendar_assistant/cli/helpers.rb +54 -0
- data/lib/calendar_assistant/cli/linter_event_presenter.rb +56 -0
- data/lib/calendar_assistant/cli/linter_event_set_presenter.rb +23 -0
- data/lib/calendar_assistant/cli/printer.rb +90 -0
- data/lib/calendar_assistant/config.rb +21 -45
- data/lib/calendar_assistant/event.rb +16 -12
- data/lib/calendar_assistant/event_repository.rb +18 -9
- data/lib/calendar_assistant/event_repository_factory.rb +2 -2
- data/lib/calendar_assistant/version.rb +1 -1
- metadata +78 -38
- data/lib/calendar_assistant/authorizer.rb +0 -86
- data/lib/calendar_assistant/cli_helpers.rb +0 -228
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e7456770368242baeb04b1645ee98ccf2b4d0c1061df5a2d935903c59c3cbe4
|
4
|
+
data.tar.gz: 58c65019e44c91fbe216ff0dd151073cc1113dc73597995553f44f9a5b6bddf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93b5438be7365f06fc0b2cf79258ec491d29dd751d48cbea218a56f505441cf937e1406c7bb8418c6d195ead78ccd0e9453580664a4ebbe4d4a8573ac7bf3bc5
|
7
|
+
data.tar.gz: c490f565590ffdebfb3119833bd8b907a8b457644f8c93d2fc9d9902c7869b325c70dbdd8cc9d84deabb459915cb966bd5261c7a9fb674fdfee14b436d124b80
|
data/README.md
CHANGED
@@ -10,6 +10,9 @@ A command-line tool to help you manage your Google Calendar.
|
|
10
10
|
|
11
11
|
[![Concourse CI](https://ci.nokogiri.org/api/v1/teams/calendar-assistants/pipelines/calendar-assistant/jobs/rake-spec/badge)](https://ci.nokogiri.org/teams/calendar-assistants/pipelines/calendar-assistant)
|
12
12
|
[![Maintainability](https://api.codeclimate.com/v1/badges/3525792e1feeccfd8875/maintainability)](https://codeclimate.com/github/flavorjones/calendar-assistant/maintainability)
|
13
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/3525792e1feeccfd8875/test_coverage)](https://codeclimate.com/github/flavorjones/calendar-assistant/test_coverage)
|
14
|
+
|
15
|
+
## Contents
|
13
16
|
|
14
17
|
<!-- toc -->
|
15
18
|
|
@@ -28,9 +31,12 @@ A command-line tool to help you manage your Google Calendar.
|
|
28
31
|
* [`location-set`: Tell people where you are in the world](#location-set-tell-people-where-you-are-in-the-world)
|
29
32
|
* [`location`: View where you're going to be in the world](#location-view-where-youre-going-to-be-in-the-world)
|
30
33
|
* [`show`: View your calendar events](#show-view-your-calendar-events)
|
34
|
+
* [`lint`: Calendar events that require action](#lint-calendar-events-that-require-action)
|
31
35
|
* [`config`: View your configuration parameters](#config-view-your-configuration-parameters)
|
32
36
|
- [Development](#development)
|
33
|
-
* [Tests](#tests)
|
37
|
+
* [Running Tests Locally](#running-tests-locally)
|
38
|
+
* [Continuous Integration](#continuous-integration)
|
39
|
+
* [Code Quality](#code-quality)
|
34
40
|
* [Generate README](#generate-readme)
|
35
41
|
- [References](#references)
|
36
42
|
- [License](#license)
|
@@ -65,6 +71,11 @@ Some duration-related preferences are interpreted by [ChronicDuration](https://g
|
|
65
71
|
|
66
72
|
All tokens and preferences will be stored in `~/.calendar-assistant` which is in TOML format for easy editing.
|
67
73
|
|
74
|
+
The location of `.calendar-assistant` defaults to the user's home directory. This location may be overridden by setting the environment variable `CA_HOME`
|
75
|
+
|
76
|
+
#### Location Emoji
|
77
|
+
|
78
|
+
There is a `[settings]` key called `location-icons` that may be set to an array denoting all emoji that indicate a location event. The first icon in the array will be used as the default. The default emoji included are `["🗺 ", "🌎"]` with the map icon first
|
68
79
|
|
69
80
|
## Setup
|
70
81
|
|
@@ -80,14 +91,16 @@ Usage:
|
|
80
91
|
calendar-assistant setup
|
81
92
|
|
82
93
|
Options:
|
83
|
-
-h, -?, [--help], [--no-help]
|
84
|
-
[--debug], [--no-debug]
|
94
|
+
-h, -?, [--help], [--no-help]
|
95
|
+
[--debug], [--no-debug] # how dare you suggest there are bugs
|
96
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
97
|
+
# Default: true
|
85
98
|
|
86
99
|
Description:
|
87
|
-
This command will walk you through setting up a Google Cloud Project, enabling the Google Calendar
|
100
|
+
This command will walk you through setting up a Google Cloud Project, enabling the Google Calendar
|
88
101
|
API, and saving the credentials necessary to access the API on behalf of users.
|
89
102
|
|
90
|
-
If you already have downloaded client credentials, you don't need to run this command. Instead,
|
103
|
+
If you already have downloaded client credentials, you don't need to run this command. Instead,
|
91
104
|
rename the downloaded JSON file to `/home/user/.calendar-assistant.client`
|
92
105
|
</pre>
|
93
106
|
|
@@ -99,17 +112,19 @@ Usage:
|
|
99
112
|
calendar-assistant authorize PROFILE_NAME
|
100
113
|
|
101
114
|
Options:
|
102
|
-
-h, -?, [--help], [--no-help]
|
103
|
-
[--debug], [--no-debug]
|
115
|
+
-h, -?, [--help], [--no-help]
|
116
|
+
[--debug], [--no-debug] # how dare you suggest there are bugs
|
117
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
118
|
+
# Default: true
|
104
119
|
|
105
120
|
Description:
|
106
|
-
Create and authorize a named profile (e.g., "work", "home", "flastname@company.tld") to access
|
107
|
-
|
121
|
+
Create and authorize a named profile (e.g., "work", "home", "flastname@company.tld") to access your
|
122
|
+
calendar.
|
108
123
|
|
109
|
-
When setting up a profile, you'll be asked to visit a URL to authenticate, grant authorization,
|
110
|
-
|
124
|
+
When setting up a profile, you'll be asked to visit a URL to authenticate, grant authorization, and
|
125
|
+
generate and persist an access token.
|
111
126
|
|
112
|
-
In order for this to work, you'll need to have set up your API client credentials. Run
|
127
|
+
In order for this to work, you'll need to have set up your API client credentials. Run
|
113
128
|
`calendar-assistant help setup` for instructions.
|
114
129
|
</pre>
|
115
130
|
|
@@ -123,6 +138,7 @@ Commands:
|
|
123
138
|
calendar-assistant config # Dump your configuration param...
|
124
139
|
calendar-assistant help [COMMAND] # Describe available commands o...
|
125
140
|
calendar-assistant join [TIME] # Open the URL for a video call...
|
141
|
+
calendar-assistant lint [DATE | DATERANGE | TIMERANGE] # Lint your events for a date o...
|
126
142
|
calendar-assistant location [DATE | DATERANGE] # Show your location for a date...
|
127
143
|
calendar-assistant location-set LOCATION [DATE | DATERANGE] # Set your location to LOCATION...
|
128
144
|
calendar-assistant setup # Link your local calendar-assi...
|
@@ -130,8 +146,10 @@ Commands:
|
|
130
146
|
calendar-assistant version # Display the version of calend...
|
131
147
|
|
132
148
|
Options:
|
133
|
-
-h, -?, [--help], [--no-help]
|
134
|
-
[--debug], [--no-debug]
|
149
|
+
-h, -?, [--help], [--no-help]
|
150
|
+
[--debug], [--no-debug] # how dare you suggest there are bugs
|
151
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
152
|
+
# Default: true
|
135
153
|
</pre>
|
136
154
|
|
137
155
|
|
@@ -142,12 +160,14 @@ Usage:
|
|
142
160
|
calendar-assistant join [TIME]
|
143
161
|
|
144
162
|
Options:
|
145
|
-
[--join], [--no-join]
|
146
|
-
|
147
|
-
-p, [--profile=PROFILE]
|
148
|
-
[--local-store=FILENAME]
|
149
|
-
-h, -?, [--help], [--no-help]
|
150
|
-
[--debug], [--no-debug]
|
163
|
+
[--join], [--no-join] # launch a browser to join the video call URL
|
164
|
+
# Default: true
|
165
|
+
-p, [--profile=PROFILE] # the profile you'd like to use (if different from default)
|
166
|
+
[--local-store=FILENAME] # Load events from a local file instead of Google Calendar
|
167
|
+
-h, -?, [--help], [--no-help]
|
168
|
+
[--debug], [--no-debug] # how dare you suggest there are bugs
|
169
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
170
|
+
# Default: true
|
151
171
|
|
152
172
|
Open the URL for a video call attached to your meeting at time TIME (default 'now')
|
153
173
|
</pre>
|
@@ -189,6 +209,8 @@ Options:
|
|
189
209
|
[--local-store=FILENAME] # Load events from a local file instead of Google Calendar
|
190
210
|
-h, -?, [--help], [--no-help]
|
191
211
|
[--debug], [--no-debug] # how dare you suggest there are bugs
|
212
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
213
|
+
# Default: true
|
192
214
|
|
193
215
|
Show your availability for a date or range of dates (default 'today')
|
194
216
|
</pre>
|
@@ -280,10 +302,12 @@ Usage:
|
|
280
302
|
calendar-assistant location-set LOCATION [DATE | DATERANGE]
|
281
303
|
|
282
304
|
Options:
|
283
|
-
-p, [--profile=PROFILE]
|
284
|
-
[--local-store=FILENAME]
|
285
|
-
-h, -?, [--help], [--no-help]
|
286
|
-
[--debug], [--no-debug]
|
305
|
+
-p, [--profile=PROFILE] # the profile you'd like to use (if different from default)
|
306
|
+
[--local-store=FILENAME] # Load events from a local file instead of Google Calendar
|
307
|
+
-h, -?, [--help], [--no-help]
|
308
|
+
[--debug], [--no-debug] # how dare you suggest there are bugs
|
309
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
310
|
+
# Default: true
|
287
311
|
|
288
312
|
Set your location to LOCATION for a date or range of dates (default 'today')
|
289
313
|
</pre>
|
@@ -322,10 +346,12 @@ Usage:
|
|
322
346
|
calendar-assistant location [DATE | DATERANGE]
|
323
347
|
|
324
348
|
Options:
|
325
|
-
-p, [--profile=PROFILE]
|
326
|
-
[--local-store=FILENAME]
|
327
|
-
-h, -?, [--help], [--no-help]
|
328
|
-
[--debug], [--no-debug]
|
349
|
+
-p, [--profile=PROFILE] # the profile you'd like to use (if different from default)
|
350
|
+
[--local-store=FILENAME] # Load events from a local file instead of Google Calendar
|
351
|
+
-h, -?, [--help], [--no-help]
|
352
|
+
[--debug], [--no-debug] # how dare you suggest there are bugs
|
353
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
354
|
+
# Default: true
|
329
355
|
|
330
356
|
Show your location for a date or range of dates (default 'today')
|
331
357
|
</pre>
|
@@ -336,8 +362,8 @@ For example:
|
|
336
362
|
<b>$</b> calendar-assistant location "2018-09-24...2018-09-28"
|
337
363
|
<i>me@example.com (all times in America/New_York)
|
338
364
|
</i>
|
339
|
-
2018-09-24 - 2018-09-28 <b> | 🗺
|
340
|
-
2018-09-28 <b> | 🗺
|
365
|
+
2018-09-24 - 2018-09-28 <b> | 🗺 Gondolin</b><i> (not-busy)</i>
|
366
|
+
2018-09-28 <b> | 🗺 Rivendell</b><i> (not-busy)</i>
|
341
367
|
</pre>
|
342
368
|
|
343
369
|
|
@@ -354,6 +380,8 @@ Options:
|
|
354
380
|
-a, [--attendees=ATTENDEE1[,ATTENDEE2[,...]]] # [default 'me'] people (email IDs) to whom this command will be applied
|
355
381
|
-h, -?, [--help], [--no-help]
|
356
382
|
[--debug], [--no-debug] # how dare you suggest there are bugs
|
383
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
384
|
+
# Default: true
|
357
385
|
|
358
386
|
Show your events for a date or range of dates (default 'today')
|
359
387
|
</pre>
|
@@ -364,28 +392,28 @@ For example: display all events scheduled for tomorrow:
|
|
364
392
|
<b>$</b> calendar-assistant show 2018-10-01
|
365
393
|
<i>me@example.com (all times in America/New_York)
|
366
394
|
</i>
|
367
|
-
<strike>2018-10-01 03:30 - 05:00 |
|
368
|
-
<strike>2018-10-01 07:30 - 08:30 |
|
369
|
-
<strike>2018-10-01 07:30 - 08:30 |
|
370
|
-
2018-10-01 10:30 - 10:55<b> |
|
371
|
-
2018-10-01 11:00 - 11:30<b> |
|
372
|
-
2018-10-01 11:30 - 12:00<b> |
|
373
|
-
|
374
|
-
2018-10-01 12:00 - 12:30<b> |
|
375
|
-
<strike>2018-10-01 12:15 - 12:30 |
|
376
|
-
<strike>2018-10-01 12:30 - 13:30 |
|
377
|
-
2018-10-01 12:30 - 13:30<b> |
|
378
|
-
2018-10-01 13:30 - 14:50<b> |
|
379
|
-
<strike>2018-10-01 13:30 - 14:30 |
|
380
|
-
2018-10-01 15:00 - 15:30<b> |
|
381
|
-
2018-10-01 16:00 - 17:00<b> |
|
382
|
-
2018-10-01 16:45 - 17:00<b> |
|
383
|
-
2018-10-01 17:00 - 17:30<b> |
|
384
|
-
2018-10-01 17:30 - 17:55<b> |
|
385
|
-
<strike>2018-10-01 18:00 - 20:30 |
|
386
|
-
<strike>2018-10-01 18:30 - 19:00 |
|
387
|
-
|
388
|
-
2018-10-01 <b> | 🗺
|
395
|
+
<strike>2018-10-01 03:30 - 05:00 | Repurpose end-to-end convergence</strike>
|
396
|
+
<strike>2018-10-01 07:30 - 08:30 | Iterate clicks-and-mortar vortals</strike>
|
397
|
+
<strike>2018-10-01 07:30 - 08:30 | Grow viral portals</strike>
|
398
|
+
2018-10-01 10:30 - 10:55<b> | Enable rich roi</b><i> (1:1, recurring)</i>
|
399
|
+
2018-10-01 11:00 - 11:30<b> | Leverage rich e-services</b><i> (recurring)</i>
|
400
|
+
2018-10-01 11:30 - 12:00<b> | Grow leading-edge communities</b><i> (1:1, recurring)</i>
|
401
|
+
2018-10-01 11:50 - 12:00<b> | Cultivate revolutionary experiences</b><i> (awaiting)</i>
|
402
|
+
2018-10-01 12:00 - 12:30<b> | Incentivize ubiquitous mindshare</b><i> (self)</i>
|
403
|
+
<strike>2018-10-01 12:15 - 12:30 | Disintermediate next-generation niches</strike>
|
404
|
+
<strike>2018-10-01 12:30 - 13:30 | Drive viral communities</strike>
|
405
|
+
2018-10-01 12:30 - 13:30<b> | Synergize integrated supply-chains</b><i> (awaiting, recurring)</i>
|
406
|
+
2018-10-01 13:30 - 14:50<b> | Transform revolutionary users</b><i> (self)</i>
|
407
|
+
<strike>2018-10-01 13:30 - 14:30 | Enable interactive networks</strike>
|
408
|
+
2018-10-01 15:00 - 15:30<b> | Evolve global applications</b><i> (1:1)</i>
|
409
|
+
2018-10-01 16:00 - 17:00<b> | Implement b2c architectures</b><i> (1:1, recurring)</i>
|
410
|
+
2018-10-01 16:45 - 17:00<b> | Enable rich niches</b><i> (recurring)</i>
|
411
|
+
2018-10-01 17:00 - 17:30<b> | Implement frictionless e-markets</b><i> (recurring)</i>
|
412
|
+
2018-10-01 17:30 - 17:55<b> | Streamline world-class portals</b><i> (1:1, recurring)</i>
|
413
|
+
<strike>2018-10-01 18:00 - 20:30 | Recontextualize rich paradigms</strike>
|
414
|
+
<strike>2018-10-01 18:30 - 19:00 | Synergize dot-com functionalities</strike>
|
415
|
+
2018-10-01 19:00 - 19:30<b> | Revolutionize transparent e-markets</b><i> (awaiting)</i>
|
416
|
+
2018-10-01 <b> | 🗺 Country Round</b><i> (not-busy)</i>
|
389
417
|
</pre>
|
390
418
|
|
391
419
|
Display _only_ the commitments I have to other people using the `-c` option:
|
@@ -394,15 +422,52 @@ Display _only_ the commitments I have to other people using the `-c` option:
|
|
394
422
|
<b>$</b> calendar-assistant show -c 2018-10-01
|
395
423
|
<i>me@example.com (all times in America/New_York)
|
396
424
|
</i>
|
397
|
-
2018-10-01 10:30 - 10:55<b> |
|
398
|
-
2018-10-01 11:00 - 11:30<b> |
|
399
|
-
2018-10-01 11:30 - 12:00<b> |
|
400
|
-
2018-10-01
|
401
|
-
2018-10-01
|
402
|
-
2018-10-01
|
403
|
-
2018-10-01 16:
|
404
|
-
2018-10-01
|
405
|
-
2018-10-01 17:
|
425
|
+
2018-10-01 10:30 - 10:55<b> | Enable rich roi</b><i> (1:1, recurring)</i>
|
426
|
+
2018-10-01 11:00 - 11:30<b> | Leverage rich e-services</b><i> (recurring)</i>
|
427
|
+
2018-10-01 11:30 - 12:00<b> | Grow leading-edge communities</b><i> (1:1, recurring)</i>
|
428
|
+
2018-10-01 11:50 - 12:00<b> | Cultivate revolutionary experiences</b><i> (awaiting)</i>
|
429
|
+
2018-10-01 12:30 - 13:30<b> | Synergize integrated supply-chains</b><i> (awaiting, recurring)</i>
|
430
|
+
2018-10-01 15:00 - 15:30<b> | Evolve global applications</b><i> (1:1)</i>
|
431
|
+
2018-10-01 16:00 - 17:00<b> | Implement b2c architectures</b><i> (1:1, recurring)</i>
|
432
|
+
2018-10-01 16:45 - 17:00<b> | Enable rich niches</b><i> (recurring)</i>
|
433
|
+
2018-10-01 17:00 - 17:30<b> | Implement frictionless e-markets</b><i> (recurring)</i>
|
434
|
+
2018-10-01 17:30 - 17:55<b> | Streamline world-class portals</b><i> (1:1, recurring)</i>
|
435
|
+
2018-10-01 19:00 - 19:30<b> | Revolutionize transparent e-markets</b><i> (awaiting)</i>
|
436
|
+
</pre>
|
437
|
+
|
438
|
+
|
439
|
+
### `lint`: Calendar events that require action
|
440
|
+
|
441
|
+
<pre>
|
442
|
+
Usage:
|
443
|
+
calendar-assistant lint [DATE | DATERANGE | TIMERANGE]
|
444
|
+
|
445
|
+
Options:
|
446
|
+
-p, [--profile=PROFILE] # the profile you'd like to use (if different from default)
|
447
|
+
[--local-store=FILENAME] # Load events from a local file instead of Google Calendar
|
448
|
+
-a, [--attendees=ATTENDEE1[,ATTENDEE2[,...]]] # [default 'me'] people (email IDs) to whom this command will be applied
|
449
|
+
-h, -?, [--help], [--no-help]
|
450
|
+
[--debug], [--no-debug] # how dare you suggest there are bugs
|
451
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
452
|
+
# Default: true
|
453
|
+
|
454
|
+
Lint your events for a date or range of dates (default 'today')
|
455
|
+
</pre>
|
456
|
+
|
457
|
+
For example: display all events that require action scheduled for tomorrow:
|
458
|
+
|
459
|
+
<pre>
|
460
|
+
<b>$</b> calendar-assistant lint 2018-10-01
|
461
|
+
me@example.com
|
462
|
+
- looking for events that need attention
|
463
|
+
- all times in America/New_York
|
464
|
+
|
465
|
+
2018-10-01 11:50 - 12:00<b> | Cultivate revolutionary experiences</b><i> (awaiting)</i>
|
466
|
+
attendees: 👍 three@example.com, 🤷 four@example.com
|
467
|
+
2018-10-01 12:30 - 13:30<b> | Synergize integrated supply-chains</b><i> (awaiting, recurring)</i>
|
468
|
+
attendees: 👍 three@example.com, 🤷 four@example.com
|
469
|
+
2018-10-01 19:00 - 19:30<b> | Revolutionize transparent e-markets</b><i> (awaiting)</i>
|
470
|
+
attendees: 👍 three@example.com, 🤷 four@example.com
|
406
471
|
</pre>
|
407
472
|
|
408
473
|
|
@@ -415,8 +480,10 @@ Usage:
|
|
415
480
|
calendar-assistant config
|
416
481
|
|
417
482
|
Options:
|
418
|
-
-h, -?, [--help], [--no-help]
|
419
|
-
[--debug], [--no-debug]
|
483
|
+
-h, -?, [--help], [--no-help]
|
484
|
+
[--debug], [--no-debug] # how dare you suggest there are bugs
|
485
|
+
[--formatting], [--no-formatting] # Enable Text Formatting
|
486
|
+
# Default: true
|
420
487
|
|
421
488
|
Dump your configuration parameters (merge of defaults and overrides from /home/user/.calendar-assistant)
|
422
489
|
</pre>
|
@@ -428,31 +495,49 @@ The output is TOML, which is suitable for dumping into `~/.calendar-assistant` a
|
|
428
495
|
|
429
496
|
[settings]
|
430
497
|
end-of-day = "6pm"
|
498
|
+
location-icons = ["🌎","🗺 "]
|
431
499
|
meeting-length = "30m"
|
432
500
|
profile = "work"
|
433
501
|
start-of-day = "9am"
|
434
502
|
</pre>
|
435
503
|
|
504
|
+
|
436
505
|
## Development
|
437
506
|
|
438
|
-
### Tests
|
507
|
+
### Running Tests Locally
|
439
508
|
|
440
509
|
```bash
|
441
510
|
gem install bundler
|
442
511
|
bundle install
|
443
512
|
|
444
|
-
rake spec
|
513
|
+
bundle exec rake spec # Run all tests except feature tests
|
514
|
+
bundle exec rake features # Run only feature tests
|
515
|
+
bundle exec rake # Default task runs both feature and non feature tests
|
445
516
|
```
|
446
517
|
|
518
|
+
**Note:** Feature tests are excluded by default in [.rspec](.rspec)
|
519
|
+
|
520
|
+
|
521
|
+
### Continuous Integration
|
522
|
+
|
523
|
+
CI is running in a [Concourse](https://concourse-ci.org) pipeline at [https://ci.nokogiri.org](https://ci.nokogiri.org/teams/calendar-assistants/pipelines/calendar-assistant).
|
524
|
+
|
525
|
+
|
526
|
+
### Code Quality
|
527
|
+
|
528
|
+
We're running [Code Climate](https://codeclimate.com/github/flavorjones/calendar-assistant) to monitor code quality and test coverage.
|
529
|
+
|
530
|
+
|
447
531
|
### Generate README
|
448
532
|
|
449
|
-
*
|
450
|
-
*
|
533
|
+
* Note that doing this requires npm to be installed
|
534
|
+
* Generation will use a fixture file rather than connecting to a remote calendar. Fixtures can be updated/regenerated in [generate-fixtures](generate-fixtures) script
|
451
535
|
|
452
536
|
```bash
|
453
537
|
./generate-readme
|
454
538
|
```
|
455
539
|
|
540
|
+
|
456
541
|
## References
|
457
542
|
|
458
543
|
Google Calendar Concepts: https://developers.google.com/calendar/concepts/
|
data/Rakefile
CHANGED
@@ -5,7 +5,17 @@ require "license_finder"
|
|
5
5
|
|
6
6
|
Concourse.new("calendar-assistant").create_tasks!
|
7
7
|
|
8
|
-
RSpec::Core::RakeTask.new(:
|
8
|
+
RSpec::Core::RakeTask.new(:test)
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
11
|
+
t.rspec_opts ||= []
|
12
|
+
t.rspec_opts << " --tag=~type:aruba"
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec::Core::RakeTask.new(:features) do |t|
|
16
|
+
t.rspec_opts ||= []
|
17
|
+
t.rspec_opts << " --tag=type:aruba"
|
18
|
+
end
|
9
19
|
|
10
20
|
desc "Ensure all dependencies meet license requirements."
|
11
21
|
task :license_finder do
|
@@ -13,5 +23,5 @@ task :license_finder do
|
|
13
23
|
LicenseFinder::CLI::Main.start([])
|
14
24
|
end
|
15
25
|
|
16
|
-
desc "Run specs and license finder"
|
17
|
-
task :default => [:
|
26
|
+
desc "Run specs, features and license finder"
|
27
|
+
task :default => [:test, :license_finder]
|
data/bin/calendar-assistant
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
libdir = File.join( File.dirname(__FILE__), "..", "lib")
|
3
|
+
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
2
4
|
|
3
5
|
require "calendar_assistant"
|
4
6
|
|
5
7
|
Rainbow.enabled = true
|
6
8
|
|
7
9
|
begin
|
8
|
-
CalendarAssistant::CLI.start ARGV
|
10
|
+
CalendarAssistant::CLI::Commands.start ARGV
|
9
11
|
rescue Google::Apis::AuthorizationError, CalendarAssistant::BaseException => e
|
10
12
|
printf "ERROR: %s\n", e
|
11
13
|
exit 1
|
data/lib/calendar_assistant.rb
CHANGED
@@ -27,7 +27,6 @@ require "calendar_assistant/calendar_assistant"
|
|
27
27
|
class CalendarAssistant
|
28
28
|
autoload :VERSION, "calendar_assistant/version"
|
29
29
|
autoload :Config, "calendar_assistant/config"
|
30
|
-
autoload :Authorizer, "calendar_assistant/authorizer"
|
31
30
|
autoload :StringHelpers, "calendar_assistant/string_helpers"
|
32
31
|
autoload :DateHelpers, "calendar_assistant/date_helpers"
|
33
32
|
autoload :Event, "calendar_assistant/event"
|
@@ -2,17 +2,11 @@
|
|
2
2
|
class CalendarAssistant
|
3
3
|
class BaseException < RuntimeError ; end
|
4
4
|
|
5
|
-
EMOJI_WORLDMAP = "🗺" # U+1F5FA WORLD MAP
|
6
5
|
EMOJI_PLANE = "🛪" # U+1F6EA NORTHEAST-POINTING AIRPLANE
|
7
6
|
EMOJI_1_1 = "👫" # MAN AND WOMAN HOLDING HANDS
|
8
7
|
|
9
8
|
attr_reader :service, :calendar, :config
|
10
9
|
|
11
|
-
def self.authorize profile_name
|
12
|
-
config = CalendarAssistant::Config.new
|
13
|
-
Authorizer.new(profile_name, config.token_store).authorize
|
14
|
-
end
|
15
|
-
|
16
10
|
def self.date_range_cast time_range
|
17
11
|
time_range.first.to_date..(time_range.last + 1.day).to_date
|
18
12
|
end
|
@@ -35,17 +29,16 @@ class CalendarAssistant
|
|
35
29
|
|
36
30
|
|
37
31
|
def initialize config=Config.new,
|
38
|
-
event_repository_factory: EventRepositoryFactory
|
32
|
+
event_repository_factory: EventRepositoryFactory,
|
33
|
+
service:
|
39
34
|
@config = config
|
35
|
+
@service = service
|
40
36
|
|
41
|
-
if filename = config.setting(Config::Keys::Options::LOCAL_STORE)
|
42
|
-
@service = CalendarAssistant::LocalService.new(file: filename)
|
43
|
-
else
|
44
|
-
@service = Authorizer.new(config.profile_name, config.token_store).service
|
45
|
-
end
|
46
37
|
@calendar = service.get_calendar Config::DEFAULT_CALENDAR_ID
|
47
38
|
@event_repository_factory = event_repository_factory
|
48
39
|
@event_repositories = {} # calendar_id → event_repository
|
40
|
+
|
41
|
+
@emoji_worldmap = Array(@config.setting(CalendarAssistant::Config::Keys::Settings::LOCATION_ICONS)).first
|
49
42
|
end
|
50
43
|
|
51
44
|
def in_env &block
|
@@ -63,6 +56,15 @@ class CalendarAssistant
|
|
63
56
|
end
|
64
57
|
end
|
65
58
|
|
59
|
+
def lint_events time_range
|
60
|
+
calendar_ids = config.attendees
|
61
|
+
if calendar_ids.length > 1
|
62
|
+
raise BaseException, "CalendarAssistant#lint_events only supports one person (for now)"
|
63
|
+
end
|
64
|
+
|
65
|
+
event_repository(calendar_ids.first).find(time_range, predicates: { needs_action?: true })
|
66
|
+
end
|
67
|
+
|
66
68
|
def find_events time_range
|
67
69
|
calendar_ids = config.attendees
|
68
70
|
if calendar_ids.length > 1
|
@@ -94,7 +96,7 @@ class CalendarAssistant
|
|
94
96
|
deleted_events = []
|
95
97
|
modified_events = []
|
96
98
|
|
97
|
-
event = event_repository.create(transparency: CalendarAssistant::Event::Transparency::TRANSPARENT, start: range.first, end: range.last , summary: "#{
|
99
|
+
event = event_repository.create(transparency: CalendarAssistant::Event::Transparency::TRANSPARENT, start: range.first, end: range.last , summary: "#{@emoji_worldmap} #{location}")
|
98
100
|
|
99
101
|
existing_event_set.events.each do |existing_event|
|
100
102
|
if existing_event.start_date >= event.start_date && existing_event.end_date <= event.end_date
|
@@ -117,6 +119,6 @@ class CalendarAssistant
|
|
117
119
|
end
|
118
120
|
|
119
121
|
def event_repository calendar_id=Config::DEFAULT_CALENDAR_ID
|
120
|
-
@event_repositories[calendar_id] ||= @event_repository_factory.new_event_repository(@service, calendar_id)
|
122
|
+
@event_repositories[calendar_id] ||= @event_repository_factory.new_event_repository(@service, calendar_id, config: config)
|
121
123
|
end
|
122
124
|
end
|