timet 0.9.2 → 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 +4 -4
- data/CHANGELOG.md +28 -1
- data/README.md +131 -105
- data/bin/tt +6 -0
- data/btc.png +0 -0
- data/lib/timet/application.rb +32 -12
- data/lib/timet/application_helper.rb +31 -0
- data/lib/timet/version.rb +2 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cf486dcc89da9e06f1a77b36d3183a1f8c55a11ce51e79a761cbb84280af9ba
|
4
|
+
data.tar.gz: fe4cbc8baf03c019cfbb8b31514a9e5fd99ba1320c8cf27945dacf6fd1033784
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d2ddea11803e4d0225858ed1edb2b3143ad7579959f057a9025ff9db82acccaf3de1aed4018f99c856ed97c896d3d775a2d14224251e9d325b9aceef223db11
|
7
|
+
data.tar.gz: d6b6b852de2aea0966aa0e108ee73a64c30bbdb88217ad8806ab66ce732de32641f71692c3eaf4fd1fc9421c4722d6300ae86ce8051f5c3ec9d34f6d4631ad96
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,40 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.0.0] - 2024-10-07
|
4
|
+
|
5
|
+
**Improvements:**
|
6
|
+
|
7
|
+
- Added a `pomodoro` option to the `start` command to specify Pomodoro time in minutes.
|
8
|
+
- Updated the `start` method to accept an optional `pomodoro` parameter and call `play_sound_and_notify` if Pomodoro time is provided.
|
9
|
+
- Improved the `stop` method to accept an optional `display` parameter and conditionally call `summary`.
|
10
|
+
- Added `play_sound_and_notify` method to `application_helper.rb` for playing a sound and sending a notification after a specified time.
|
11
|
+
- Updated RSpec tests to reflect the new `pomodoro` parameter and `display` parameter in the `start` and `stop` methods, respectively.
|
12
|
+
- Converted Pomodoro time from minutes to seconds before passing it to `play_sound_and_notify`.
|
13
|
+
|
14
|
+
### Bug fixes:
|
15
|
+
|
16
|
+
- Ensured Pomodoro time is a positive integer before invoking `play_sound_and_notify`.
|
17
|
+
|
18
|
+
#### Tasks:
|
19
|
+
|
20
|
+
- Update README.md to document the new Pomodoro feature.
|
21
|
+
|
22
|
+
### Additional Considerations:
|
23
|
+
|
24
|
+
- The `pomodoro` option is designed to be flexible, allowing users to specify any duration in minutes for their Pomodoro sessions. This flexibility caters to users who may prefer different interval lengths based on their work habits and preferences.
|
25
|
+
- The `play_sound_and_notify` method is a new addition to the `application_helper.rb` file, providing a mechanism for notifying users when their Pomodoro session ends. This feature includes both a sound notification and a system notification to ensure users are aware of the end of their work interval.
|
26
|
+
- The `stop` method has been improved to accept an optional `display` parameter, which allows users to conditionally call the `summary` method. This enhancement provides more control over when the summary of the time tracking session is displayed.
|
27
|
+
- The RSpec tests have been updated to reflect the new parameters and functionality introduced in this pull request, ensuring that the code remains robust and reliable.
|
28
|
+
|
3
29
|
## [0.9.2] - 2024-10-06
|
4
30
|
|
5
31
|
**Improvements:**
|
32
|
+
|
6
33
|
- Improved the description of the 'start' command to clarify the usage of optional notes.
|
7
34
|
|
8
35
|
**Bug fixes:**
|
9
|
-
- Modified the 'display_item' method to handle cases where 'updated_item' is nil, ensuring that the original 'item' is displayed instead.
|
10
36
|
|
37
|
+
- Modified the 'display_item' method to handle cases where 'updated_item' is nil, ensuring that the original 'item' is displayed instead.
|
11
38
|
|
12
39
|
## [0.9.1] - 2024-10-04
|
13
40
|
|
data/README.md
CHANGED
@@ -20,147 +20,166 @@ In addition, if possible, export your time tracking data to CSV for analysis and
|
|
20
20
|
|
21
21
|
## Requirements
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
- Ruby version: >= 3.0.0
|
24
|
+
- sqlite3: > 1.7
|
26
25
|
|
27
26
|
Old versions of Ruby and Sqlite:
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
* [Ruby >= 2.4](https://github.com/frankvielma/timet/tree/ruby-2.4.0)
|
32
|
-
|
28
|
+
- [Ruby >= 2.7](https://github.com/frankvielma/timet/tree/ruby-2.7.0)
|
33
29
|
|
30
|
+
- [Ruby >= 2.4](https://github.com/frankvielma/timet/tree/ruby-2.4.0)
|
34
31
|
|
35
32
|
## Installation
|
36
33
|
|
37
34
|
Install the gem by executing:
|
35
|
+
|
38
36
|
```bash
|
39
37
|
gem install timet
|
40
38
|
```
|
41
39
|
|
42
40
|
## Usage
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
42
|
+
### Command Aliases
|
43
|
+
|
44
|
+
- `timet`: The primary command for interacting with the Timet application.
|
45
|
+
- `tt`: An alias for the `timet` command, providing a shorter alternative.
|
46
|
+
|
47
|
+
---
|
48
|
+
- **timet start [tag] --notes="" --pomodoro=[minutes]**: Starts tracking time for a task labeled with the provided [tag], notes and "pomodoro time" in minutes (optional). Example:
|
49
|
+
|
50
|
+
```bash
|
51
|
+
timet start task1 --notes="Meeting with client" --pomodoro=25
|
52
|
+
|
53
|
+
or
|
54
|
+
|
55
|
+
tt start task1 "Meeting with client" 25
|
56
|
+
```
|
57
|
+
|
58
|
+
```
|
59
|
+
Tracked time report [today]:
|
60
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
61
|
+
| Id | Date | Tag | Start | End | Duration | Notes |
|
62
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
63
|
+
| 1 | 2024-08-09 | task1 | 14:55:07 | - | 00:00:00 | Meeting with client |
|
64
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
65
|
+
| Total: | 00:00:00 | |
|
66
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
67
|
+
```
|
68
|
+
|
69
|
+
This command will initiate a 25-minute Pomodoro session for the task "task1" with the provided description.
|
70
|
+
|
71
|
+
### Pomodoro Integration
|
72
|
+
|
73
|
+
The `pomodoro` option in the `start` command enhances time tracking by integrating the Pomodoro Technique. Users can specify a Pomodoro session length in minutes, like `pomodoro=25`, to start a 25-minute work interval. The app automatically tracks time and notifies users when the interval ends, helping maintain focus.
|
74
|
+
|
75
|
+
**Benefits**
|
76
|
+
|
77
|
+
- **Flexibility**: Supports various productivity strategies.
|
78
|
+
- **Focus**: Encourages disciplined work practices.
|
79
|
+
- **Productivity**: Helps achieve higher productivity and better time management.
|
80
|
+
|
81
|
+
---
|
63
82
|
|
64
83
|
- **timet stop**: Stops tracking the current task, records the elapsed time, and displays the total time spent on all tasks.
|
65
84
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
```
|
71
|
-
Tracked time report [today]:
|
72
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
73
|
-
| Id | Date | Tag | Start | End | Duration | Notes |
|
74
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
75
|
-
| 1 | 2024-08-09 | task1 | 14:55:07 | 15:55:07 | 01:00:00 | Meeting with client |
|
76
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
77
|
-
| Total: | 01:00:00 | |
|
78
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
79
|
-
```
|
85
|
+
```bash
|
86
|
+
timet stop
|
87
|
+
```
|
80
88
|
|
89
|
+
```
|
90
|
+
Tracked time report [today]:
|
91
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
92
|
+
| Id | Date | Tag | Start | End | Duration | Notes |
|
93
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
94
|
+
| 1 | 2024-08-09 | task1 | 14:55:07 | 15:55:07 | 01:00:00 | Meeting with client |
|
95
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
96
|
+
| Total: | 01:00:00 | |
|
97
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
98
|
+
```
|
99
|
+
---
|
81
100
|
- **timet resume**: It allows users to quickly resume tracking a task that was previously in progress.
|
82
|
-
```
|
83
|
-
Tracked time report [today]:
|
84
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
85
|
-
| Id | Date | Tag | Start | End | Duration | Notes |
|
86
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
87
|
-
| 2 | 2024-08-09 | task1 | 16:15:07 | - | 00:00:00 | Meeting with client |
|
88
|
-
| 1 | | task1 | 14:55:07 | 15:55:07 | 01:00:00 | Meeting with client |
|
89
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
90
|
-
| Total: | 01:00:00 | |
|
91
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
92
|
-
```
|
93
|
-
|
94
101
|
|
102
|
+
```
|
103
|
+
Tracked time report [today]:
|
104
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
105
|
+
| Id | Date | Tag | Start | End | Duration | Notes |
|
106
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
107
|
+
| 2 | 2024-08-09 | task1 | 16:15:07 | - | 00:00:00 | Meeting with client |
|
108
|
+
| 1 | | task1 | 14:55:07 | 15:55:07 | 01:00:00 | Meeting with client |
|
109
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
110
|
+
| Total: | 01:00:00 | |
|
111
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
112
|
+
```
|
113
|
+
---
|
95
114
|
- **timet edit**: It allows users to update a task's notes, tag, start, or end fields. Users can either interactively select the field and provide a new value or specify them directly in the command.
|
96
115
|
|
97
116
|
- **Interactive Mode:**
|
98
|
-
```bash
|
99
|
-
timet e 1
|
100
|
-
```
|
101
|
-
|
102
|
-
```
|
103
|
-
Tracked time report [today]:
|
104
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
105
|
-
| Id | Date | Tag | Start | End | Duration | Notes |
|
106
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
107
|
-
| 2 | 2024-08-09 | task1 | 16:15:07 | - | 00:00:00 | Meeting with client |
|
108
|
-
| 1 | | task1 | 14:55:07 | 15:55:07 | 01:00:00 | Meeting with client |
|
109
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
110
|
-
| Total: | 01:00:00 | |
|
111
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
112
|
-
Edit Field? (Press ↑/↓ arrow to move and Enter to select)
|
113
|
-
‣ Notes
|
114
|
-
Tag
|
115
|
-
Start
|
116
|
-
End
|
117
|
-
```
|
118
117
|
|
118
|
+
```bash
|
119
|
+
timet edit 1
|
120
|
+
```
|
119
121
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
122
|
+
```
|
123
|
+
Tracked time report [today]:
|
124
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
125
|
+
| Id | Date | Tag | Start | End | Duration | Notes |
|
126
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
127
|
+
| 2 | 2024-08-09 | task1 | 16:15:07 | - | 00:00:00 | Meeting with client |
|
128
|
+
| 1 | | task1 | 14:55:07 | 15:55:07 | 01:00:00 | Meeting with client |
|
129
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
130
|
+
| Total: | 01:00:00 | |
|
131
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
132
|
+
Edit Field? (Press ↑/↓ arrow to move and Enter to select)
|
133
|
+
‣ Notes
|
134
|
+
Tag
|
135
|
+
Start
|
136
|
+
End
|
137
|
+
```
|
124
138
|
|
125
|
-
|
126
|
-
Tracked time report [today]:
|
127
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
128
|
-
| Id | Date | Tag | Start | End | Duration | Notes |
|
129
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
130
|
-
| 2 | 2024-08-09 | task1 | 16:15:07 | - | 00:00:00 | Meeting with client |
|
131
|
-
| 1 | | task1 | 14:55:07 | 15:55:07 | 01:00:00 | New Meeting Note |
|
132
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
133
|
-
| Total: | 01:00:00 | |
|
134
|
-
+-------+------------+--------+----------+----------+----------+--------------------------+
|
135
|
-
```
|
139
|
+
- **Direct Specification Mode:**
|
136
140
|
|
141
|
+
```bash
|
142
|
+
timet e 1 notes "New Meeting Notes"
|
143
|
+
```
|
137
144
|
|
145
|
+
```
|
146
|
+
Tracked time report [today]:
|
147
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
148
|
+
| Id | Date | Tag | Start | End | Duration | Notes |
|
149
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
150
|
+
| 2 | 2024-08-09 | task1 | 16:15:07 | - | 00:00:00 | Meeting with client |
|
151
|
+
| 1 | | task1 | 14:55:07 | 15:55:07 | 01:00:00 | New Meeting Note |
|
152
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
153
|
+
| Total: | 01:00:00 | |
|
154
|
+
+-------+------------+--------+----------+----------+----------+--------------------------+
|
155
|
+
```
|
138
156
|
|
139
157
|
## Command Reference
|
140
158
|
|
141
|
-
| Command
|
142
|
-
|
143
|
-
| `timet start [tag] --notes='
|
144
|
-
| `timet stop`
|
145
|
-
| `timet summary today (t)`
|
146
|
-
| `timet summary yesterday (y)`
|
147
|
-
| `timet summary week (w)`
|
148
|
-
| `timet summary month (m)`
|
149
|
-
| `timet su t --csv=[filename]`
|
150
|
-
| `timet summary resume (r)`
|
151
|
-
| `timet delete [id]`
|
152
|
-
| `timet cancel`
|
153
|
-
| `timet edit [id]`
|
154
|
-
| `timet su [date]`
|
155
|
-
| `timet su [start_date]..[end_date]`
|
156
|
-
|
159
|
+
| Command | Description | Example Usage |
|
160
|
+
| ----------------------------------- | --------------------------------------------------------------------------- | --------------------------------- |
|
161
|
+
| `timet start [tag] --notes='' --pomodoro=[time]` | Start tracking time for a task labeled [tag] and notes (optional). | `timet start Task "My notes" 25` |
|
162
|
+
| `timet stop` | Stop tracking time. | `timet start Task "My notes"` |
|
163
|
+
| `timet summary today (t)` | Display a report of tracked time for today. | `timet su t` or `timet su` |
|
164
|
+
| `timet summary yesterday (y)` | Display a report of tracked time for yesterday. | `timet su y` |
|
165
|
+
| `timet summary week (w)` | Display a report of tracked time for the week. | `timet su w` |
|
166
|
+
| `timet summary month (m)` | Resume tracking the last month. | `timet su m` |
|
167
|
+
| `timet su t --csv=[filename]` | Display a report of tracked time for today and export it to `filename.csv`. | `timet su t --csv=file.csv` |
|
168
|
+
| `timet summary resume (r)` | Resume tracking the last task. | `timet su r` |
|
169
|
+
| `timet delete [id]` | Delete a task by its ID. | `timet d [id]` |
|
170
|
+
| `timet cancel` | Cancel active time tracking. | `timet c` |
|
171
|
+
| `timet edit [id]` | Update a task's notes, tag, start or end fields. | `timet e [1]` |
|
172
|
+
| `timet su [date]` | Display a report of tracked time for a specific date. | `timet su 2024-01-03` |
|
173
|
+
| `timet su [start_date]..[end_date]` | Display a report of tracked time for a date range. | `timet su 2024-01-02..2024-01-03` |
|
157
174
|
|
158
175
|
### Date Range in Summary
|
159
176
|
|
160
177
|
The `timet summary` command now supports specifying a date range for generating reports. This allows users to filter and summarize data within specific date intervals. The date format is in ISO 8601 format (YYYY-MM-DD).
|
161
178
|
|
162
179
|
#### Examples:
|
180
|
+
|
163
181
|
- **Single Date**: Display a report for a specific date.
|
182
|
+
|
164
183
|
```sh
|
165
184
|
timet su 2024-01-03
|
166
185
|
```
|
@@ -170,10 +189,9 @@ The `timet summary` command now supports specifying a date range for generating
|
|
170
189
|
timet su 2024-01-02..2024-01-03
|
171
190
|
```
|
172
191
|
|
173
|
-
|
174
192
|
## Data
|
175
|
-
Timet's data is stored in ~/.timet.db
|
176
193
|
|
194
|
+
Timet's data is stored in ~/.timet.db
|
177
195
|
|
178
196
|
## Development
|
179
197
|
|
@@ -185,6 +203,14 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
185
203
|
|
186
204
|
Bug reports and pull requests are welcome on GitHub at https://github.com/frankvielma/timet. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/frankvielma/timet/blob/master/CODE_OF_CONDUCT.md).
|
187
205
|
|
206
|
+
## Buy Me A Coffee! ☕
|
207
|
+
|
208
|
+
Many people have contacted me asking how to contribute. Any contribution, from a virtual coffee to a kind word, is greatly appreciated and helps me continue my work. Please only donate if you're able, as there are no refunds. Your support is entirely voluntary, and I thank you for your consideration.
|
209
|
+
|
210
|
+

|
211
|
+
|
212
|
+
bc1qkg9me2jsuhpzu2hp9kkpxagwtf9ewnyfl4kszl
|
213
|
+
|
188
214
|
## License
|
189
215
|
|
190
216
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/bin/tt
ADDED
data/btc.png
ADDED
Binary file
|
data/lib/timet/application.rb
CHANGED
@@ -37,26 +37,37 @@ module Timet
|
|
37
37
|
|
38
38
|
desc "start [tag] --notes='[notes]'", 'Start time tracking for a specific tag with optional notes'
|
39
39
|
option :notes, type: :string, desc: 'Add a note'
|
40
|
+
option :pomodoro, type: :numeric, desc: 'Pomodoro time in minutes'
|
40
41
|
# Starts a new tracking session with the given tag and optional notes.
|
41
42
|
#
|
43
|
+
# This method initializes a new tracking session by inserting a new item into the database
|
44
|
+
# with the provided tag and optional notes. If a Pomodoro time is specified, it will also
|
45
|
+
# trigger a sound and notification after the specified time has elapsed.
|
46
|
+
#
|
42
47
|
# @param tag [String] The tag associated with the tracking session. This is a required parameter.
|
43
48
|
# @param notes [String, nil] Optional notes to be associated with the tracking session. If not provided, it defaults to the value in `options[:notes]`.
|
49
|
+
# @param pomodoro [Numeric, nil] Optional Pomodoro time in minutes. If not provided, it defaults to the value in `options[:pomodoro]`.
|
44
50
|
#
|
45
|
-
# @return [void] This method does not return a value; it performs side effects such as inserting a tracking item and generating a summary.
|
51
|
+
# @return [void] This method does not return a value; it performs side effects such as inserting a tracking item, playing a sound, sending a notification, and generating a summary.
|
46
52
|
#
|
47
53
|
# @example Start a tracking session with a tag and notes
|
48
|
-
# start('work', 'Starting work on project X')
|
54
|
+
# start('work', 'Starting work on project X', 25)
|
49
55
|
#
|
50
56
|
# @example Start a tracking session with only a tag
|
51
57
|
# start('break')
|
52
58
|
#
|
53
59
|
# @note The method uses `TimeHelper.current_timestamp` to get the current timestamp for the start time.
|
60
|
+
# @note The method calls `play_sound_and_notify` if a Pomodoro time is provided.
|
54
61
|
# @note The method calls `summary` to generate a summary after inserting the tracking item.
|
55
|
-
def start(tag, notes = nil)
|
62
|
+
def start(tag, notes = nil, pomodoro = nil)
|
56
63
|
start_time = TimeHelper.current_timestamp
|
57
64
|
notes = options[:notes] || notes
|
65
|
+
pomodoro = (options[:pomodoro] || pomodoro).to_i
|
58
66
|
|
59
|
-
|
67
|
+
if VALID_STATUSES_FOR_INSERTION.include?(@db.last_item_status)
|
68
|
+
@db.insert_item(start_time, tag, notes)
|
69
|
+
play_sound_and_notify(pomodoro * 60, tag) if pomodoro > 0
|
70
|
+
end
|
60
71
|
summary
|
61
72
|
end
|
62
73
|
|
@@ -71,16 +82,13 @@ module Timet
|
|
71
82
|
# @note The method checks if the last tracking item is in progress by calling `@db.last_item_status`.
|
72
83
|
# @note If the last item is in progress, it fetches the last item's ID using `@db.fetch_last_id` and updates it with the current timestamp.
|
73
84
|
# @note The method then fetches the last item using `@db.last_item` and generates a summary if the result is not nil.
|
74
|
-
def stop
|
75
|
-
|
76
|
-
last_id = @db.fetch_last_id
|
77
|
-
@db.update_item(last_id, 'end', TimeHelper.current_timestamp)
|
78
|
-
end
|
79
|
-
result = @db.last_item
|
85
|
+
def stop(display = nil)
|
86
|
+
return unless @db.last_item_status == :in_progress
|
80
87
|
|
81
|
-
|
88
|
+
last_id = @db.fetch_last_id
|
89
|
+
@db.update_item(last_id, 'end', TimeHelper.current_timestamp)
|
82
90
|
|
83
|
-
summary
|
91
|
+
summary unless display
|
84
92
|
end
|
85
93
|
|
86
94
|
desc 'resume (r)', 'resume last task'
|
@@ -237,6 +245,18 @@ module Timet
|
|
237
245
|
true
|
238
246
|
end
|
239
247
|
|
248
|
+
# Displays the current version of the Timet gem.
|
249
|
+
#
|
250
|
+
# @example
|
251
|
+
# $ timet version
|
252
|
+
# 1.0.0
|
253
|
+
#
|
254
|
+
# @return [void] This method does not return a value; it prints the version to the standard output.
|
255
|
+
desc 'version', 'version'
|
256
|
+
def version
|
257
|
+
puts Timet::VERSION
|
258
|
+
end
|
259
|
+
|
240
260
|
private
|
241
261
|
|
242
262
|
# Deletes a tracking item from the database by its ID and prints a confirmation message.
|
@@ -68,5 +68,36 @@ module Timet
|
|
68
68
|
|
69
69
|
value
|
70
70
|
end
|
71
|
+
|
72
|
+
# Plays a sound and sends a notification after a specified time.
|
73
|
+
#
|
74
|
+
# This method is designed to work on Linux and macOS. It triggers a sound and a notification
|
75
|
+
# after the specified time has elapsed. On Linux, it also stops a Pomodoro session and sends
|
76
|
+
# a desktop notification. On macOS, it plays a system sound and displays a notification.
|
77
|
+
#
|
78
|
+
# @param time [Integer] The duration in seconds to wait before playing the sound and sending the notification.
|
79
|
+
# @param tag [String] The tag associated with the Pomodoro session.
|
80
|
+
#
|
81
|
+
# @example
|
82
|
+
# play_sound_and_notify(1500, 'work')
|
83
|
+
#
|
84
|
+
# @note This method uses platform-specific commands and assumes the presence of certain utilities
|
85
|
+
# (e.g., `notify-send` on Linux, `afplay` on macOS). Ensure these utilities are available
|
86
|
+
# on the respective operating systems.
|
87
|
+
#
|
88
|
+
# @raise [RuntimeError] If the operating system is not supported.
|
89
|
+
#
|
90
|
+
# @return [void]
|
91
|
+
def play_sound_and_notify(time, tag)
|
92
|
+
if RUBY_PLATFORM.downcase.include?('linux')
|
93
|
+
pid = spawn("sleep #{time} && tput bel && /home/frank/Software/frankvielma/gems/timet/bin/timet stop 0 && notify-send --icon=clock 'Pomodoro session complete! (tag: #{tag}) Time for a break.' &")
|
94
|
+
Process.wait(pid)
|
95
|
+
elsif RUBY_PLATFORM.downcase.include?('darwin')
|
96
|
+
pid = spawn("(sleep #{time} && afplay /System/Library/Sounds/Basso.aiff && osascript -e 'display notification \"Pomodoro session complete! Time for a break.\"') &")
|
97
|
+
Process.wait(pid)
|
98
|
+
else
|
99
|
+
puts 'Unsupported operating system'
|
100
|
+
end
|
101
|
+
end
|
71
102
|
end
|
72
103
|
end
|
data/lib/timet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Vielma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -63,6 +63,7 @@ email:
|
|
63
63
|
- frankvielma@gmail.com
|
64
64
|
executables:
|
65
65
|
- timet
|
66
|
+
- tt
|
66
67
|
extensions: []
|
67
68
|
extra_rdoc_files: []
|
68
69
|
files:
|
@@ -75,6 +76,8 @@ files:
|
|
75
76
|
- README.md
|
76
77
|
- Rakefile
|
77
78
|
- bin/timet
|
79
|
+
- bin/tt
|
80
|
+
- btc.png
|
78
81
|
- lib/timet.rb
|
79
82
|
- lib/timet/application.rb
|
80
83
|
- lib/timet/application_helper.rb
|