dsu 2.0.8 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/Gemfile.lock +9 -9
- data/README.md +78 -17
- data/lib/core/ruby/color_theme_mode.rb +1 -1
- data/lib/dsu/base_cli.rb +2 -16
- data/lib/dsu/cli.rb +29 -56
- data/lib/dsu/command_services/add_entry_service.rb +1 -1
- data/lib/dsu/env.rb +4 -0
- data/lib/dsu/models/color_theme.rb +2 -2
- data/lib/dsu/models/configuration.rb +3 -1
- data/lib/dsu/models/entry_group.rb +1 -1
- data/lib/dsu/presenters/color_theme_presenter.rb +4 -2
- data/lib/dsu/presenters/color_theme_show_presenter.rb +9 -3
- data/lib/dsu/presenters/configuration_presenter.rb +2 -2
- data/lib/dsu/presenters/entry_group_presenter.rb +2 -2
- data/lib/dsu/services/entry_group/counter_service.rb +32 -0
- data/lib/dsu/services/entry_group/deleter_service.rb +35 -0
- data/lib/dsu/services/entry_group/editor_service.rb +7 -11
- data/lib/dsu/subcommands/config.rb +17 -74
- data/lib/dsu/subcommands/delete.rb +107 -0
- data/lib/dsu/subcommands/edit.rb +16 -30
- data/lib/dsu/subcommands/list.rb +20 -90
- data/lib/dsu/subcommands/theme.rb +50 -79
- data/lib/dsu/support/ask.rb +1 -1
- data/lib/dsu/support/command_hookable.rb +2 -0
- data/lib/dsu/support/command_options/dsu_times.rb +2 -2
- data/lib/dsu/support/command_options/time.rb +1 -0
- data/lib/dsu/support/command_options/time_mneumonics.rb +1 -0
- data/lib/dsu/support/time_formatable.rb +13 -0
- data/lib/dsu/validators/description_validator.rb +2 -0
- data/lib/dsu/validators/entries_validator.rb +1 -0
- data/lib/dsu/version.rb +1 -1
- data/lib/dsu/views/color_theme/show.rb +1 -0
- data/lib/dsu/views/entry_group/edit.rb +2 -1
- data/lib/dsu/views/entry_group/shared/no_entries_to_display.rb +4 -1
- data/lib/dsu/views/shared/model_errors.rb +1 -0
- data/lib/dsu.rb +5 -1
- data/lib/locales/en/active_record.yml +8 -0
- data/lib/locales/en/commands.yml +90 -0
- data/lib/locales/en/miscellaneous.yml +23 -0
- data/lib/locales/en/presenters.yml +19 -0
- data/lib/locales/en/services.yml +10 -0
- data/lib/locales/en/subcommands.yml +348 -0
- metadata +13 -4
- data/exe/dsu_migrate.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53ef02b21bb75d6e3e4bed1f8e9db48e7dd62e431eae71421f33ba6dbd5d780c
|
4
|
+
data.tar.gz: 87430adbb8f5043623ae38050e13be1167418beabe5cd1b18e03e234f4a29fa9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d28ad896fb311662825c295431607b3633de799a206949683518c5230232533d44f3151c411c25dc7d18396adfe200e2580239d26fdd32015e40e6e601c3608
|
7
|
+
data.tar.gz: e3e411cda8d2eeba5a5cb8d7dc86efb3f552b83d25c4518ea4db2024cee5ffead9aacdb870193a14153794a35ed76216d00fdb00d2094e0f008542da4e6756c0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
## [2.1.1] 2023-12-17
|
2
|
+
|
3
|
+
Bug fixes
|
4
|
+
|
5
|
+
- Fix bug that did not included I18n locale files in yanked version 2.1.0.
|
6
|
+
|
7
|
+
|
8
|
+
## [2.1.0] 2023-12-16
|
9
|
+
|
10
|
+
Enhancements
|
11
|
+
|
12
|
+
- Added `dsu delete` command to incorporate color themes. See `dsu help delete` for more information.
|
13
|
+
|
14
|
+
Bug fixes
|
15
|
+
|
16
|
+
- Fix bug that failed to show "(nothing to display for <day>, <date> <local time designator> through <day>, <date> <local time designator>)" for `dsu list dates` command when no entries existed for the entry groups associated with the given dates.
|
17
|
+
|
18
|
+
Miscellaneous
|
19
|
+
|
20
|
+
- Update ruby gems.
|
21
|
+
- Updated README.md to reflect new `dsu delete` command.
|
22
|
+
- Fix rubocop violations.
|
23
|
+
|
1
24
|
## [2.0.8] 2023-12-02
|
2
25
|
|
3
26
|
- Update ruby gems.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dsu (2.
|
4
|
+
dsu (2.1.1)
|
5
5
|
activemodel (>= 7.0.8, < 8.0)
|
6
6
|
activesupport (>= 7.0.8, < 8.0)
|
7
7
|
colorize (>= 0.8.1, < 1.0)
|
@@ -26,7 +26,7 @@ GEM
|
|
26
26
|
tzinfo (~> 2.0)
|
27
27
|
ast (2.4.2)
|
28
28
|
base64 (0.2.0)
|
29
|
-
bigdecimal (3.1.
|
29
|
+
bigdecimal (3.1.5)
|
30
30
|
byebug (11.1.3)
|
31
31
|
coderay (1.1.3)
|
32
32
|
colorize (0.8.1)
|
@@ -42,14 +42,14 @@ GEM
|
|
42
42
|
ffaker (2.23.0)
|
43
43
|
i18n (1.14.1)
|
44
44
|
concurrent-ruby (~> 1.0)
|
45
|
-
json (2.7.
|
45
|
+
json (2.7.1)
|
46
46
|
kwalify (0.7.2)
|
47
47
|
language_server-protocol (3.17.0.3)
|
48
48
|
method_source (1.0.0)
|
49
49
|
minitest (5.20.0)
|
50
50
|
mutex_m (0.2.0)
|
51
51
|
os (1.1.4)
|
52
|
-
parallel (1.
|
52
|
+
parallel (1.24.0)
|
53
53
|
parser (3.2.2.4)
|
54
54
|
ast (~> 2.4.1)
|
55
55
|
racc
|
@@ -66,7 +66,7 @@ GEM
|
|
66
66
|
kwalify (~> 0.7.0)
|
67
67
|
parser (~> 3.2.0)
|
68
68
|
rainbow (>= 2.0, < 4.0)
|
69
|
-
regexp_parser (2.8.
|
69
|
+
regexp_parser (2.8.3)
|
70
70
|
rexml (3.2.6)
|
71
71
|
rspec (3.12.0)
|
72
72
|
rspec-core (~> 3.12.0)
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
82
82
|
rspec-support (~> 3.12.0)
|
83
83
|
rspec-support (3.12.1)
|
84
|
-
rubocop (1.
|
84
|
+
rubocop (1.59.0)
|
85
85
|
json (~> 2.3)
|
86
86
|
language_server-protocol (>= 3.17.0)
|
87
87
|
parallel (~> 1.10)
|
@@ -98,9 +98,9 @@ GEM
|
|
98
98
|
rubocop (~> 1.41)
|
99
99
|
rubocop-factory_bot (2.24.0)
|
100
100
|
rubocop (~> 1.33)
|
101
|
-
rubocop-performance (1.
|
102
|
-
rubocop (>= 1.
|
103
|
-
rubocop-ast (>=
|
101
|
+
rubocop-performance (1.20.0)
|
102
|
+
rubocop (>= 1.48.1, < 2.0)
|
103
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
104
104
|
rubocop-rspec (2.25.0)
|
105
105
|
rubocop (~> 1.40)
|
106
106
|
rubocop-capybara (~> 2.17)
|
data/README.md
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
[![Report Issues](https://img.shields.io/badge/report-issues-red.svg)](https://github.com/gangelo/dsu/issues)
|
7
7
|
[![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
|
8
8
|
|
9
|
+
<img align="center" src="https://i.imgur.com/ff79twF.gif" alt="dsu" />
|
10
|
+
|
9
11
|
## About
|
10
12
|
`dsu` is a simple, but powerful little gem I wrote for myself to help me manage my Agile DSU (Daily Stand Up) participation. How? by providing a simple command line interface (CLI) which allows me to create, read, update, and delete (CRUD) DSU entries on a daily basis. During my DSU, I'm then able to list, recall and share my DSU activities with my team. DSU entries are grouped by day and are viewed in simple text format from the command line, in a myriad of ways, to meet my personal needs. When viewing DSU entries for a particular day, `dsu` will automatically display the previous day's activities as well, using the typical "what I did yesterday", "What I'm doing today" DSU paradigm. If the DSU date I am trying to view falls on a weekend or Monday, `dsu` will automatically display back to and including the weekend and previous Friday (inclusive), so that I can share what I did over the weekend (if anything) and "last" Friday.
|
11
13
|
|
@@ -19,14 +21,15 @@ After installation (`gem install dsu`), the first thing you may want to do is ru
|
|
19
21
|
```shell
|
20
22
|
#=>
|
21
23
|
Commands:
|
22
|
-
dsu add
|
23
|
-
dsu config
|
24
|
-
dsu
|
25
|
-
dsu
|
26
|
-
dsu
|
27
|
-
dsu
|
28
|
-
dsu
|
29
|
-
dsu
|
24
|
+
dsu add|-a [OPTIONS] DESCRIPTION # Adds a DSU entry...
|
25
|
+
dsu config|-c SUBCOMMAND # Manage configuration...
|
26
|
+
dsu delete|-d SUBCOMMAND # Delete DSU entries...
|
27
|
+
dsu edit|-e SUBCOMMAND # Edit DSU entries...
|
28
|
+
dsu help [COMMAND] # Describe available...
|
29
|
+
dsu info|-i # Displays information...
|
30
|
+
dsu list|-l SUBCOMMAND # Displays DSU entries...
|
31
|
+
dsu theme|-t SUBCOMMAND # Manage DSU themes...
|
32
|
+
dsu version|-v # Displays this gem version
|
30
33
|
|
31
34
|
Options:
|
32
35
|
[--debug], [--no-debug]
|
@@ -69,11 +72,11 @@ You can display DSU entries for a particular day or date (`date`) using any of t
|
|
69
72
|
- `$ dsu list today|n`
|
70
73
|
- `$ dsu list tomorrow|t`
|
71
74
|
- `$ dsu list yesterday|y`
|
72
|
-
- `$ dsu list date|d DATE|
|
75
|
+
- `$ dsu list date|d DATE|MNEMONIC`
|
73
76
|
- `$ dsu list dates|dd OPTIONS`
|
74
77
|
|
75
78
|
See the [Dates](#dates) section for more information on acceptable DATE formats used by `dsu`.
|
76
|
-
See the [
|
79
|
+
See the [Mnemonics](#mnemonics) section for more information on acceptable MNEMONIC rules and formats used by `dsu`.
|
77
80
|
|
78
81
|
IMPORTANT: In some cases the behavior RDNs have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu list help date` and `dsu list help dates`.
|
79
82
|
|
@@ -105,7 +108,7 @@ Friday, (Yesterday) 2023-05-05
|
|
105
108
|
```
|
106
109
|
|
107
110
|
#### Listing Date Ranges
|
108
|
-
For more information, see the [
|
111
|
+
For more information, see the [Mnemonics](#mnemonics) section for more information on acceptable MNEMONIC rules and formats used by `dsu`.
|
109
112
|
|
110
113
|
Output omitted for brevity...
|
111
114
|
|
@@ -125,11 +128,11 @@ Display the DSU entries for the last week.
|
|
125
128
|
|
126
129
|
`dsu list dates --from today --to -7`
|
127
130
|
|
128
|
-
Display the DSU entries back 1 week from yesterday's date. *This example is silly,* but it illustrates the fact that you can use relative
|
131
|
+
Display the DSU entries back 1 week from yesterday's date. *This example is silly,* but it illustrates the fact that you can use relative mnemonics for both `--from` and `--to` options. While you *can* use relative mnemonics for both `--from` and `--to` options, there is always a more intuitive way.
|
129
132
|
|
130
133
|
`dsu list dates --from -7 --to +6`
|
131
134
|
|
132
|
-
The above can be accomplished MUCH easier by using the `yesterday`
|
135
|
+
The above can be accomplished MUCH easier by using the `yesterday` mnemonic. This will display the DSU entries back 1 week from yesterday's date.
|
133
136
|
|
134
137
|
`dsu list dates --from yesterday --to -6`
|
135
138
|
|
@@ -229,7 +232,63 @@ from: Interative planning meeting 11:00AM.
|
|
229
232
|
Pair with Chad on ticket 31211.
|
230
233
|
Interative planning meeting 11:00AM.
|
231
234
|
```
|
235
|
+
## Deleting DSU Entry Groups
|
236
|
+
You can delete DSU groups, which will delete all the entries associated with a particular day or date range. When deleting DSU entries for a particular day (`date`, `today`, `tomorrow`, `yesterday`), or date range (`dates`), `dsu` will delete the the entries associated with that day or date range:
|
237
|
+
|
238
|
+
- `$ dsu delete today|n`
|
239
|
+
- `$ dsu delete tomorrow|t`
|
240
|
+
- `$ dsu delete yesterday|y`
|
241
|
+
- `$ dsu delete date|d DATE|MNEMONIC`
|
242
|
+
- `$ dsu delete dates|dd OPTIONS`
|
243
|
+
|
244
|
+
NOTE: Before any `dsu` command is executed to delete an entry group, `dsu` will prompt you to confirm your action; you can continue ('y') or cancel ('N').
|
245
|
+
|
246
|
+
See the [Dates](#dates) section for more information on acceptable DATE formats used by `dsu`.
|
247
|
+
See the [Mnemonics](#mnemonics) section for more information on acceptable MNEMONIC rules and formats used by `dsu`.
|
248
|
+
|
249
|
+
IMPORTANT: In some cases the behavior RDNs have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu delete help date` and `dsu delete help dates`.
|
250
|
+
|
251
|
+
### Examples
|
252
|
+
The following deletes the entry group and all entries for today's date, yesterday's date, and tomorrow's date respectfully.
|
253
|
+
|
254
|
+
`$ dsu delete today`
|
255
|
+
```shell
|
256
|
+
#=>
|
257
|
+
Are you sure you want to delete all the entries for 2023-12-17 (1 entry groups)? [y/N]> y
|
258
|
+
Deleted 1 entry group(s).
|
259
|
+
```
|
260
|
+
|
261
|
+
`$ dsu delete yesterday`
|
262
|
+
```shell
|
263
|
+
#=>
|
264
|
+
Are you sure you want to delete all the entries for 2023-12-16 (1 entry groups)? [y/N]> y
|
265
|
+
Deleted 1 entry group(s).
|
266
|
+
```
|
267
|
+
|
268
|
+
`$ dsu delete tomorrow`
|
269
|
+
```shell
|
270
|
+
#=>
|
271
|
+
Are you sure you want to delete all the entries for 2023-12-18 (1 entry groups)? [y/N]> y
|
272
|
+
Deleted 1 entry group(s).
|
273
|
+
```
|
274
|
+
|
275
|
+
The following deletes the entry group and all entries for 12/17 of the current year.
|
232
276
|
|
277
|
+
`$ dsu delete date 12/17`
|
278
|
+
```shell
|
279
|
+
#=>
|
280
|
+
Are you sure you want to delete all the entries for 2023-12-17 (0 entry groups)? [y/N]> y
|
281
|
+
Deleted 1 entry group(s)
|
282
|
+
```
|
283
|
+
|
284
|
+
The following deletes the entry group and all entries for the past week, starting from today (12/17/2023).
|
285
|
+
|
286
|
+
`$ dsu delete dates --from today --to -6`
|
287
|
+
```shell
|
288
|
+
#=>
|
289
|
+
Are you sure you want to delete all the entries for 2023-12-11 thru 2023-12-17 (7 entry groups)? [y/N]> y
|
290
|
+
Deleted 7 entry group(s).
|
291
|
+
```
|
233
292
|
## Customizing the `dsu` Configuration File
|
234
293
|
|
235
294
|
It is **not** recommended that you get too attached to the `dsu` configuration options when this gem is in pre-release (e.g. `n.n.n.alpha.n`, `n.n.n.beta.n`, etc.). This is because changes to the configuration file options could change; however, if you're curious, ambitious, or just like living on the edge, have at it. However, just keep in mind that things could change. With an official release (`n.n.n.n`), edit all you want. Regardless, if you *do* want to customize the `dsu` configuration file, you may do the following:
|
@@ -267,6 +326,8 @@ This is the default editor to use when editing entry groups if the EDITOR enviro
|
|
267
326
|
|
268
327
|
Default: `nano` (you'll need to change the default editor on Windows systems)
|
269
328
|
|
329
|
+
NOTE: [Visual Studio Code](https://code.visualstudio.com/docs/editor/command-line), users, use `"code --wait"` (or `"code -w"`, short form) to make sure the vscode editor waits for the edited file to be saved and closed before returning control to the dsu process.
|
330
|
+
|
270
331
|
##### entries_display_order
|
271
332
|
Valid values are 'asc' and 'desc', and will sort listed DSU entries in ascending or descending order respectfully, by day.
|
272
333
|
|
@@ -291,15 +352,15 @@ These notes apply to anywhere DATE is used...
|
|
291
352
|
|
292
353
|
DATE may be any date string that can be parsed using `Time.parse`. Consequently, you may omit the year if the date you want to display is the current year (e.g. <month>/<day>, or 1/31). For example: `require 'time'; Time.parse('2023/01/02'); Time.parse('1/2/2023'); Time.parse('1/2') # etc.`
|
293
354
|
|
294
|
-
##
|
355
|
+
## Mnemonics
|
295
356
|
|
296
|
-
These notes apply to anywhere
|
357
|
+
These notes apply to anywhere MNEMONIC is used...
|
297
358
|
|
298
|
-
A *
|
359
|
+
A *mnemonic* may be any of the following: `n|today|t|tomorrow|y|yesterday|+n|-n`.
|
299
360
|
|
300
361
|
Where `n`, `t`, `y` are aliases for `today`, `tomorrow`, and `yesterday`, respectively.
|
301
362
|
|
302
|
-
Where `+n`, `-n` are relative date
|
363
|
+
Where `+n`, `-n` are relative date mnemonics (RDNs). Generally speaking, RDNs are relative to the current date. For example, a RDN of `+1` would be equal to `Time.now + 1.day` (or tomorrow), and a RDN of `-1` would be equal to `Time.now - 1.day` (or yesterday).
|
303
364
|
|
304
365
|
NOTE: In some cases the behavior RDNs have on some commands are context dependent; in such cases the behavior will be noted in the help appropriate to the command, for example see the following `dsu` command help: `dsu list help date` and `dsu list help dates`.
|
305
366
|
|
data/lib/dsu/base_cli.rb
CHANGED
@@ -39,25 +39,11 @@ module Dsu
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def date_option_description
|
42
|
-
|
43
|
-
DATE
|
44
|
-
|
45
|
-
This may be any date string that can be parsed using `Time.parse`. Consequently, you may use also use '/' as date separators, as well as omit thee year if the date you want to display is the current year (e.g. <month>/<day>, or 1/31). For example: `require 'time'; Time.parse('01/02/2023'); Time.parse('1/2') # etc.`
|
46
|
-
OPTION_DESC
|
42
|
+
I18n.t('options.date_option_description')
|
47
43
|
end
|
48
44
|
|
49
45
|
def mneumonic_option_description
|
50
|
-
|
51
|
-
MNEUMONIC
|
52
|
-
|
53
|
-
This may be any of the following: n|today|t|tomorrow|y|yesterday|+n|-n.
|
54
|
-
|
55
|
-
Where n, t, y are aliases for today, tomorrow, and yesterday, respectively.
|
56
|
-
|
57
|
-
Where +n, -n are relative date mneumonics (RDNs). Generally speaking, RDNs are relative to the current date. For example, a RDN of +1 would be equal to `Time.now + 1.day` (tomorrow), and a RDN of -1 would be equal to `Time.now - 1.day` (yesterday).
|
58
|
-
|
59
|
-
In some cases the behavior RDNs have on some commands are context dependent; in such cases the behavior will be noted.
|
60
|
-
OPTION_DESC
|
46
|
+
I18n.t('options.mneumonic_option_description')
|
61
47
|
end
|
62
48
|
end
|
63
49
|
|
data/lib/dsu/cli.rb
CHANGED
@@ -4,6 +4,7 @@ require 'fileutils'
|
|
4
4
|
require 'time'
|
5
5
|
require_relative 'base_cli'
|
6
6
|
require_relative 'subcommands/config'
|
7
|
+
require_relative 'subcommands/delete'
|
7
8
|
require_relative 'subcommands/edit'
|
8
9
|
require_relative 'subcommands/list'
|
9
10
|
require_relative 'subcommands/theme'
|
@@ -11,41 +12,19 @@ require_relative 'subcommands/theme'
|
|
11
12
|
module Dsu
|
12
13
|
# The `dsu` command.
|
13
14
|
class CLI < BaseCLI
|
15
|
+
# TODO: I18n these mappings.
|
14
16
|
map %w[a -a] => :add
|
15
17
|
map %w[c -c] => :config
|
18
|
+
map %w[d -d] => :delete
|
16
19
|
map %w[e -e] => :edit
|
17
20
|
map %w[l -l] => :list
|
18
21
|
map %w[t -t] => :theme
|
19
|
-
map %w[
|
22
|
+
map %w[i -i] => :info
|
20
23
|
map %w[v -v] => :version
|
21
24
|
|
22
|
-
desc 'add,
|
23
|
-
|
24
|
-
|
25
|
-
NAME
|
26
|
-
|
27
|
-
$ dsu add, -a [OPTIONS] DESCRIPTION -- will add a DSU entry having DESCRIPTION to the date associated with the given OPTION.
|
28
|
-
|
29
|
-
SYNOPSIS
|
30
|
-
|
31
|
-
$ dsu add, -a [-d DATE|-n|-t|-y] DESCRIPTION
|
32
|
-
|
33
|
-
OPTIONS:
|
34
|
-
|
35
|
-
-d DATE: Adds a DSU entry having DESCRIPTION to the DATE.
|
36
|
-
|
37
|
-
#{date_option_description}
|
38
|
-
|
39
|
-
-n: Adds a DSU entry having DESCRIPTION to today's date (`Time.now`).
|
40
|
-
|
41
|
-
-t: Adds a DSU entry having DESCRIPTION to tomorrow's date (`Time.new.tomorrow`).
|
42
|
-
|
43
|
-
-y: Adds a DSU entry having DESCRIPTION to yesterday's date (`Time.new.yesterday`).
|
44
|
-
|
45
|
-
DESCRIPTION:
|
46
|
-
|
47
|
-
Must be be between 2 and 256 characters (inclusive) in length.
|
48
|
-
LONG_DESC
|
25
|
+
desc I18n.t('commands.add.desc'), I18n.t('commands.add.usage')
|
26
|
+
long_desc I18n.t('commands.add.long_desc', date_option_description: date_option_description)
|
27
|
+
# TODO: I18n these option aliases.
|
49
28
|
option :date, type: :string, aliases: '-d'
|
50
29
|
option :tomorrow, type: :boolean, aliases: '-t'
|
51
30
|
option :yesterday, type: :boolean, aliases: '-y'
|
@@ -65,49 +44,43 @@ module Dsu
|
|
65
44
|
view_entry_group(time: time)
|
66
45
|
end
|
67
46
|
|
68
|
-
desc 'list,
|
69
|
-
'Displays DSU entries for the given SUBCOMMAND'
|
47
|
+
desc I18n.t('commands.list.desc'), I18n.t('commands.list.usage')
|
70
48
|
subcommand :list, Subcommands::List
|
71
49
|
|
72
|
-
desc 'config,
|
73
|
-
'Manage configuration file for this gem'
|
50
|
+
desc I18n.t('commands.config.desc'), I18n.t('commands.config.usage')
|
74
51
|
subcommand :config, Subcommands::Config
|
75
52
|
|
76
|
-
desc '
|
77
|
-
|
53
|
+
desc I18n.t('commands.delete.desc'), I18n.t('commands.delete.usage')
|
54
|
+
subcommand :delete, Subcommands::Delete
|
55
|
+
|
56
|
+
desc I18n.t('commands.edit.desc'), I18n.t('commands.edit.usage')
|
78
57
|
subcommand :edit, Subcommands::Edit
|
79
58
|
|
80
|
-
desc 'theme,
|
81
|
-
'Manage DSU themes'
|
59
|
+
desc I18n.t('commands.theme.desc'), I18n.t('commands.theme.usage')
|
82
60
|
subcommand :theme, Subcommands::Theme
|
83
61
|
|
84
|
-
desc 'info,
|
85
|
-
'Displays information about this dsu release'
|
62
|
+
desc I18n.t('commands.info.desc'), I18n.t('commands.info.usage')
|
86
63
|
def info
|
87
64
|
configuration_version = Models::Configuration::VERSION
|
88
65
|
entry_group_version = Models::EntryGroup::VERSION
|
89
66
|
color_theme_version = Models::ColorTheme::VERSION
|
90
|
-
info =
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
Migration version folder: #{Support::Fileable.migration_version_folder}
|
104
|
-
Migration file path: #{Support::Fileable.migration_version_path}
|
105
|
-
INFO
|
67
|
+
info = I18n.t('commands.info.info',
|
68
|
+
dsu_version: dsu_version,
|
69
|
+
configuration_version: configuration_version,
|
70
|
+
entry_group_version: entry_group_version,
|
71
|
+
color_theme_version: color_theme_version,
|
72
|
+
config_folder: Support::Fileable.config_path,
|
73
|
+
root_folder: Support::Fileable.root_folder,
|
74
|
+
entries_folder: Support::Fileable.entries_folder,
|
75
|
+
themes_folder: Support::Fileable.themes_folder,
|
76
|
+
gem_folder: Support::Fileable.gem_dir,
|
77
|
+
temp_folder: Support::Fileable.temp_folder,
|
78
|
+
migration_version_folder: Support::Fileable.migration_version_folder,
|
79
|
+
migration_file_folder: Support::Fileable.migration_version_path)
|
106
80
|
puts apply_theme(info, theme_color: color_theme.body)
|
107
81
|
end
|
108
82
|
|
109
|
-
desc 'version,
|
110
|
-
'Displays the version for this gem'
|
83
|
+
desc I18n.t('commands.version.desc'), I18n.t('commands.version.usage')
|
111
84
|
def version
|
112
85
|
puts apply_theme(dsu_version, theme_color: color_theme.body)
|
113
86
|
end
|
@@ -38,7 +38,7 @@ module Dsu
|
|
38
38
|
entry_group.save!
|
39
39
|
entry
|
40
40
|
rescue ActiveModel::ValidationError => e
|
41
|
-
header = '
|
41
|
+
header = I18n.t('headers.entry.could_not_be_added')
|
42
42
|
Views::Shared::Error.new(messages: e.message, header: header).render
|
43
43
|
end
|
44
44
|
|
data/lib/dsu/env.rb
CHANGED
@@ -88,11 +88,11 @@ module Dsu
|
|
88
88
|
self.class.class_eval do
|
89
89
|
attr_reader attr
|
90
90
|
attr_writer attr
|
91
|
-
private "#{attr}="
|
91
|
+
private :"#{attr}="
|
92
92
|
end
|
93
93
|
attr_value = theme_hash[attr]
|
94
94
|
attr_value = attr_value.merge_default_colors if default_theme_color_keys.include?(attr)
|
95
|
-
send("#{attr}=", attr_value)
|
95
|
+
send(:"#{attr}=", attr_value)
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -133,6 +133,7 @@ module Dsu
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def merge(hash)
|
136
|
+
hash.transform_keys!(&:to_sym)
|
136
137
|
replace!(config_hash: to_h.merge(hash))
|
137
138
|
end
|
138
139
|
|
@@ -153,7 +154,8 @@ module Dsu
|
|
153
154
|
theme_path = themes_path(theme_name: theme_name)
|
154
155
|
return if File.exist?(theme_path)
|
155
156
|
|
156
|
-
errors.
|
157
|
+
i18n_key = 'configuration.errors.theme_file_missing'
|
158
|
+
errors.add(:base, I18n.t(i18n_key, theme_path: theme_path))
|
157
159
|
end
|
158
160
|
end
|
159
161
|
end
|
@@ -14,11 +14,13 @@ module Dsu
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def header
|
17
|
-
|
17
|
+
header = I18n.t('presenters.color_theme_presenter.headers.color_themes')
|
18
|
+
apply_theme(header, theme_color: color_theme.subheader)
|
18
19
|
end
|
19
20
|
|
20
21
|
def footer
|
21
|
-
|
22
|
+
header = I18n.t('presenters.color_theme_presenter.headers.current_theme')
|
23
|
+
apply_theme(header, theme_color: color_theme.footer)
|
22
24
|
end
|
23
25
|
|
24
26
|
def detail
|
@@ -10,7 +10,10 @@ module Dsu
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def detail
|
13
|
-
|
13
|
+
headers = [I18n.t('presenters.color_theme_show_presenter.headers.number'),
|
14
|
+
I18n.t('presenters.color_theme_show_presenter.headers.color'),
|
15
|
+
I18n.t('presenters.color_theme_show_presenter.headers.values')]
|
16
|
+
puts_detail(*headers, header: true)
|
14
17
|
|
15
18
|
Models::ColorTheme::DEFAULT_THEME_COLORS.keys.each_with_index do |color_key, index|
|
16
19
|
index = formatted_index(index: index)
|
@@ -24,11 +27,14 @@ module Dsu
|
|
24
27
|
end
|
25
28
|
|
26
29
|
def footer
|
27
|
-
|
30
|
+
header = I18n.t('presenters.color_theme_show_presenter.headers.footer_example')
|
31
|
+
apply_theme(header, theme_color: color_theme.footer)
|
28
32
|
end
|
29
33
|
|
30
34
|
def header
|
31
|
-
|
35
|
+
header = I18n.t('presenters.color_theme_show_presenter.headers.viewing_color_theme',
|
36
|
+
theme_name: color_theme.theme_name)
|
37
|
+
apply_theme(header, theme_color: color_theme.subheader)
|
32
38
|
end
|
33
39
|
|
34
40
|
private
|
@@ -15,8 +15,8 @@ module Dsu
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def configuration_header
|
18
|
-
|
19
|
-
|
18
|
+
header = I18n.t('presenters.configuration_presenter.headers.file_contents', config_path: config_path)
|
19
|
+
apply_theme(header, theme_color: color_theme.header)
|
20
20
|
end
|
21
21
|
|
22
22
|
def configuration_details
|
@@ -27,8 +27,8 @@ module Dsu
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def no_entries_available
|
30
|
-
|
31
|
-
apply_theme(
|
30
|
+
header = I18n.t('presenters.entry_group_presenter.headers.no_entries_available')
|
31
|
+
apply_theme(header, theme_color: color_theme.info)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../models/entry_group'
|
4
|
+
|
5
|
+
module Dsu
|
6
|
+
module Services
|
7
|
+
module EntryGroup
|
8
|
+
class CounterService
|
9
|
+
def initialize(times:, options: {})
|
10
|
+
raise ArgumentError, 'Argument times is nil' if times.nil?
|
11
|
+
|
12
|
+
@times = times
|
13
|
+
@options = options
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
total_entry_groups = 0
|
18
|
+
|
19
|
+
times.each do |time|
|
20
|
+
total_entry_groups += 1 if Models::EntryGroup.exist?(time: time)
|
21
|
+
end
|
22
|
+
|
23
|
+
total_entry_groups
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :times, :options
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../models/entry_group'
|
4
|
+
|
5
|
+
module Dsu
|
6
|
+
module Services
|
7
|
+
module EntryGroup
|
8
|
+
class DeleterService
|
9
|
+
def initialize(times:, options: {})
|
10
|
+
raise ArgumentError, 'Argument times is nil' if times.nil?
|
11
|
+
|
12
|
+
@times = times
|
13
|
+
@options = options
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
deleted_entry_groups = 0
|
18
|
+
|
19
|
+
times.each do |time|
|
20
|
+
next unless Models::EntryGroup.exist?(time: time)
|
21
|
+
|
22
|
+
Models::EntryGroup.delete(time: time)
|
23
|
+
deleted_entry_groups += 1
|
24
|
+
end
|
25
|
+
|
26
|
+
deleted_entry_groups
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :times, :options
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|