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
@@ -0,0 +1,348 @@
|
|
1
|
+
# lib/dsu/subcommands
|
2
|
+
en:
|
3
|
+
subcommands:
|
4
|
+
config:
|
5
|
+
delete:
|
6
|
+
desc: delete
|
7
|
+
usage: Deletes the configuration file
|
8
|
+
long_desc: |
|
9
|
+
Deletes the configuration file.
|
10
|
+
|
11
|
+
EXAMPLES:
|
12
|
+
|
13
|
+
dsu config delete
|
14
|
+
|
15
|
+
NOTES
|
16
|
+
|
17
|
+
Deleting the dsu configuration file will simply cause dsu to use the default configuration options (`Dsu::Models::Configuration::DEFAULT_CONFIGURATION`).
|
18
|
+
info:
|
19
|
+
desc: info
|
20
|
+
usage: Displays information about this gem configuration
|
21
|
+
long_desc: |
|
22
|
+
Displays information about this gem configuration.
|
23
|
+
|
24
|
+
EXAMPLES:
|
25
|
+
|
26
|
+
$ dsu config info
|
27
|
+
init:
|
28
|
+
desc: init
|
29
|
+
usage: Creates and initializes a .dsu file in your home folder
|
30
|
+
long_desc: |
|
31
|
+
Creates and initializes a .dsu file in your home folder (%{home_folder}) that may be edited.
|
32
|
+
|
33
|
+
EXAMPLES:
|
34
|
+
|
35
|
+
$ dsu config init
|
36
|
+
|
37
|
+
CONFIGURATION FILE ENTRIES
|
38
|
+
|
39
|
+
The following configuration file options are available:
|
40
|
+
|
41
|
+
version:
|
42
|
+
|
43
|
+
The configuration version - DO NOT ALTER THIS VALUE!
|
44
|
+
|
45
|
+
editor:
|
46
|
+
|
47
|
+
The default editor to use when editing entry groups if the EDITOR environment variable on your system is not set. The default is 'nano'. You'll need to change the default editor on Windows systems.
|
48
|
+
|
49
|
+
Default: "nano" on nix sytems.
|
50
|
+
|
51
|
+
entries_display_order:
|
52
|
+
|
53
|
+
The order by which entries will be displayed, "asc" or "desc" (ascending or descending, respectively).
|
54
|
+
|
55
|
+
Default: "desc"
|
56
|
+
|
57
|
+
carry_over_entries_to_today:
|
58
|
+
|
59
|
+
Applicable to the `dsu edit` command. Valid values are true|false. If true, when editing DSU entries for the first time on any given day (e.g. `dsu edit today`), DSU entries from the previous day will be copied into the current editing session. If there are no DSU entries from the previous day, dsu will search backwards up to 7 days to find a DSU date that has entries to copy. If after searching back 7 days, no DSU entries are found, the editor session will simply provide no previous DSU entries.
|
60
|
+
|
61
|
+
Default: false
|
62
|
+
|
63
|
+
include_all:
|
64
|
+
|
65
|
+
Applicable to dsu commands that display DSU date lists (e.g. `dsu list` commands). Valid values are true|false. If true, all DSU dates within the specified range will be displayed, regardless of whether or not a particular date has entries. If false, only DSU dates between the first and last DSU dates that have entries will be displayed.
|
66
|
+
|
67
|
+
Default: false
|
68
|
+
|
69
|
+
theme_name:
|
70
|
+
|
71
|
+
Default: "default"
|
72
|
+
delete:
|
73
|
+
date:
|
74
|
+
desc: date|d DATE|MNEUMONIC
|
75
|
+
usage: Deletes the DSU entries for the given DATE or MNEUMONIC
|
76
|
+
long_desc: |
|
77
|
+
Deletes the DSU entries for the given DATE or MNEUMONIC.
|
78
|
+
|
79
|
+
%{date_option_description}
|
80
|
+
|
81
|
+
%{mneumonic_option_description}
|
82
|
+
dates:
|
83
|
+
desc: dates|dd OPTIONS
|
84
|
+
usage: Deletes the DSU entries for the OPTIONS provided
|
85
|
+
long_desc: |
|
86
|
+
Deletes the DSU entries for the given OPTIONS.
|
87
|
+
|
88
|
+
$ dsu dates OPTIONS
|
89
|
+
|
90
|
+
$ dsu dd OPTIONS
|
91
|
+
|
92
|
+
OPTIONS:
|
93
|
+
|
94
|
+
-f|--from DATE|MNEMONIC: The DATE or MNEUMONIC that represents the start of the range of DSU dates to delete. If a relative mneumonic is used (+/-n, e.g +1, -1, etc.), the date calculated will be relative to the current date (e.g. `<MNEUMONIC>.to_i.days.from_now(Time.now)`).
|
95
|
+
|
96
|
+
-t|--to DATE|MNEMONIC: The DATE or MNEUMONIC that represents the end of the range of DSU dates to delete. If a relative mneumonic is used (+/-n, e.g +1, -1, etc.), the date calculated will be relative to the date that resulting from the `--from` option date calculation.
|
97
|
+
|
98
|
+
%{date_option_description}
|
99
|
+
|
100
|
+
%{mneumonic_option_description}
|
101
|
+
|
102
|
+
EXAMPLES:
|
103
|
+
|
104
|
+
NOTE: All examples can substitute their respective short form options (e.g. `-f`, `-t`, etc. for `--from`, `--to`, etc.).
|
105
|
+
|
106
|
+
The below will delete the DSU entries for the range of dates from 1/1 to 1/4 for the current year:
|
107
|
+
|
108
|
+
$ dsu delete dates --from 1/1 --to +3
|
109
|
+
|
110
|
+
This will delete the DSU entries for the range of dates from 1/2 to 1/5 for the year 2022:
|
111
|
+
|
112
|
+
$ dsu delete dates --from 1/5/2022 --to -3
|
113
|
+
|
114
|
+
This (assuming "today" is 1/10) will delete the DSU entries for the last week 1/10 to 1/3 of the current year:
|
115
|
+
|
116
|
+
$ dsu delete dates --from today --to -7
|
117
|
+
|
118
|
+
This (assuming "today" is 5/23) will delete the DSU entries for the last week 5/16 to 5/22.
|
119
|
+
This example simply illustrates the fact that you can use relative mneumonics for
|
120
|
+
both `--from` and `--to` options; this doesn't mean you should do so...
|
121
|
+
|
122
|
+
While you can use relative mneumonics for both `--from` and `--to` options,
|
123
|
+
there is always a more intuitive way. The below example basically deletes one week of DSU entries back 1 week from yesterday's date:
|
124
|
+
|
125
|
+
$ dsu delete dates --from -7 --to +6
|
126
|
+
|
127
|
+
The above can be accomplished MUCH easier by simply using the `yesterday` mneumonic...
|
128
|
+
|
129
|
+
This (assuming "today" is 5/23) will delete the DSU entries back 1 week from yesterday's date 5/16 to 5/22:
|
130
|
+
|
131
|
+
$ dsu delete dates --from yesterday --to -6
|
132
|
+
today:
|
133
|
+
desc: today|n
|
134
|
+
usage: Deletes the DSU entries for today
|
135
|
+
long_desc: |
|
136
|
+
Deletes the DSU entries for today.
|
137
|
+
|
138
|
+
$ dsu delete today
|
139
|
+
|
140
|
+
$ dsu delete n
|
141
|
+
tomorrow:
|
142
|
+
desc: tomorrow|t
|
143
|
+
usage: Deletes the DSU entries for tomorrow
|
144
|
+
long_desc: |
|
145
|
+
Deletes the DSU entries for tomorrow.
|
146
|
+
|
147
|
+
$ dsu delete tomorrow
|
148
|
+
|
149
|
+
$ dsu delete t
|
150
|
+
yesterday:
|
151
|
+
desc: yesterday|y
|
152
|
+
usage: Deletes the DSU entries for yesterday
|
153
|
+
long_desc: |
|
154
|
+
Deletes the DSU entries for yesterday.
|
155
|
+
|
156
|
+
$ dsu delete yesterday
|
157
|
+
|
158
|
+
$ dsu delete y
|
159
|
+
messages:
|
160
|
+
deleted: Deleted %{count} entry group(s).
|
161
|
+
canceled: Canceled.
|
162
|
+
prompts:
|
163
|
+
are_you_sure: Are you sure you want to delete all the entries for %{dates} (%{count} entry groups)?
|
164
|
+
edit:
|
165
|
+
date:
|
166
|
+
desc: date|d DATE
|
167
|
+
usage: Edits the DSU entries for DATE
|
168
|
+
long_desc: |
|
169
|
+
Edits the DSU entries for DATE.
|
170
|
+
|
171
|
+
%{date_option_description}
|
172
|
+
today:
|
173
|
+
desc: today|n
|
174
|
+
usage: Edits the DSU entries for today
|
175
|
+
long_desc: |
|
176
|
+
Edits the DSU entries for today.
|
177
|
+
tomorrow:
|
178
|
+
desc: tomorrow|t
|
179
|
+
usage: Edits the DSU entries for tomorrow
|
180
|
+
long_desc: |
|
181
|
+
Edits the DSU entries for tomorrow.
|
182
|
+
yesterday:
|
183
|
+
desc: yesterday|y
|
184
|
+
usage: Edits the DSU entries for yesterday
|
185
|
+
long_desc: |
|
186
|
+
Edits the DSU entries for yesterday.
|
187
|
+
list:
|
188
|
+
date:
|
189
|
+
desc: date|d DATE|MNEUMONIC
|
190
|
+
usage: Displays the DSU entries for the given DATE or MNEUMONIC
|
191
|
+
long_desc: |
|
192
|
+
Displays the DSU entries for the given DATE or MNEUMONIC.
|
193
|
+
|
194
|
+
%{date_option_description}
|
195
|
+
|
196
|
+
%{mneumonic_option_description}
|
197
|
+
dates:
|
198
|
+
desc: dates|dd OPTIONS
|
199
|
+
usage: Displays the DSU entries for the OPTIONS provided
|
200
|
+
long_desc: |
|
201
|
+
Displays the DSU entries for the given OPTIONS.
|
202
|
+
|
203
|
+
$ dsu dates OPTIONS
|
204
|
+
|
205
|
+
$ dsu dd OPTIONS
|
206
|
+
|
207
|
+
OPTIONS:
|
208
|
+
|
209
|
+
-a|--include-all true|false: If true, all DSU dates within the specified range will be displayed. If false, DSU dates between the first and last DSU dates that have NO entries will NOT be displayed.. The default is taken from the dsu configuration setting :include_all, see `dsu config info`.
|
210
|
+
|
211
|
+
-f|--from DATE|MNEMONIC: The DATE or MNEUMONIC that represents the start of the range of DSU dates to display. If a relative mneumonic is used (+/-n, e.g +1, -1, etc.), the date calculated will be relative to the current date (e.g. `<MNEUMONIC>.to_i.days.from_now(Time.now)`).
|
212
|
+
|
213
|
+
-t|--to DATE|MNEMONIC: The DATE or MNEUMONIC that represents the end of the range of DSU dates to display. If a relative mneumonic is used (+/-n, e.g +1, -1, etc.), the date calculated will be relative to the date that resulting from the `--from` option date calculation.
|
214
|
+
|
215
|
+
%{date_option_description}
|
216
|
+
|
217
|
+
%{mneumonic_option_description}
|
218
|
+
|
219
|
+
EXAMPLES:
|
220
|
+
|
221
|
+
NOTE: All example results are subject to the `--include-all|-a` option.
|
222
|
+
|
223
|
+
NOTE: All examples can substitute their respective short form options (e.g. `-f`, `-t`, etc. for `--from`, `--to`, etc.).
|
224
|
+
|
225
|
+
The below will display the DSU entries for the range of dates from 1/1 to 1/4 for the current year:
|
226
|
+
|
227
|
+
$ dsu list dates --from 1/1 --to +3
|
228
|
+
|
229
|
+
This will display the DSU entries for the range of dates from 1/2 to 1/5 for the year 2022:
|
230
|
+
|
231
|
+
$ dsu list dates --from 1/5/2022 --to -3
|
232
|
+
|
233
|
+
This (assuming "today" is 1/10) will display the DSU entries for the last week 1/10 to 1/3 of the current year:
|
234
|
+
|
235
|
+
$ dsu list dates --from today --to -7
|
236
|
+
|
237
|
+
This (assuming "today" is 5/23) will display the DSU entries for the last week 5/16 to 5/22.
|
238
|
+
This example simply illustrates the fact that you can use relative mneumonics for
|
239
|
+
both `--from` and `--to` options; this doesn't mean you should do so...
|
240
|
+
|
241
|
+
While you can use relative mneumonics for both `--from` and `--to` options,
|
242
|
+
there is always a more intuitive way. The below example basically lists one week
|
243
|
+
of DSU entries back 1 week from yesterday's date:
|
244
|
+
|
245
|
+
$ dsu list dates --from -7 --to +6
|
246
|
+
|
247
|
+
The above can be accomplished MUCH easier by simply using the `yesterday` mneumonic...
|
248
|
+
|
249
|
+
This (assuming "today" is 5/23) will display the DSU entries back 1 week from yesterday's date 5/16 to 5/22:
|
250
|
+
|
251
|
+
$ dsu list dates --from yesterday --to -6
|
252
|
+
today:
|
253
|
+
desc: today|n
|
254
|
+
usage: Displays the DSU entries for today
|
255
|
+
long_desc: |
|
256
|
+
Displays the DSU entries for today.
|
257
|
+
|
258
|
+
$ dsu list today
|
259
|
+
|
260
|
+
$ dsu list n
|
261
|
+
tomorrow:
|
262
|
+
desc: tomorrow|t
|
263
|
+
usage: Displays the DSU entries for tomorrow
|
264
|
+
long_desc: |
|
265
|
+
Displays the DSU entries for tomorrow.
|
266
|
+
|
267
|
+
$ dsu list tomorrow
|
268
|
+
|
269
|
+
$ dsu list t
|
270
|
+
yesterday:
|
271
|
+
desc: yesterday|y
|
272
|
+
usage: Displays the DSU entries for yesterday
|
273
|
+
long_desc: |
|
274
|
+
Displays the DSU entries for yesterday.
|
275
|
+
|
276
|
+
$ dsu list yesterday
|
277
|
+
|
278
|
+
$ dsu list y
|
279
|
+
theme:
|
280
|
+
create:
|
281
|
+
desc: create THEME_NAME [OPTIONS]
|
282
|
+
usage: Creates a dsu color theme named THEME_NAME
|
283
|
+
long_desc: |
|
284
|
+
Creates a dsu color theme named THEME_NAME in the %{themes_folder} folder.
|
285
|
+
|
286
|
+
$ dsu create THEME_NAME [-d|--description DESCRIPTION]
|
287
|
+
|
288
|
+
OPTIONS:
|
289
|
+
|
290
|
+
-d|--description DESCRIPTION: Creates the dsu color theme with having DESCRIPTION as the color theme description.
|
291
|
+
|
292
|
+
DESCRIPTION
|
293
|
+
|
294
|
+
Must be be between 2 and 256 characters (inclusive) in length.
|
295
|
+
prompts:
|
296
|
+
create_theme: Create color theme "%{theme_name}"?
|
297
|
+
errors:
|
298
|
+
already_exists: Color theme "%{theme_name}" already exists.
|
299
|
+
messages:
|
300
|
+
created: Created color theme "%{theme_name}".
|
301
|
+
canceled: Canceled.
|
302
|
+
delete:
|
303
|
+
desc: delete THEME_NAME
|
304
|
+
usage: Deletes the existing dsu color theme THEME_NAME
|
305
|
+
long_desc: |
|
306
|
+
Deletes the existing dsu color theme THEME_NAME in the %{themes_folder} folder.
|
307
|
+
|
308
|
+
$ dsu theme delete THEME_NAME
|
309
|
+
prompts:
|
310
|
+
delete_theme: Delete color theme "%{theme_name}"?
|
311
|
+
errors:
|
312
|
+
cannot_delete: Color theme "%{theme_name}" cannot be deleted.
|
313
|
+
messages:
|
314
|
+
canceled: Canceled.
|
315
|
+
deleted: Deleted color theme "%{theme_name}".
|
316
|
+
list:
|
317
|
+
desc: list
|
318
|
+
usage: Lists the available dsu color themes.
|
319
|
+
long_desc: |
|
320
|
+
Lists the available dsu color themes in the %{themes_folder} folder.
|
321
|
+
|
322
|
+
$ dsu theme list
|
323
|
+
use:
|
324
|
+
desc: use [THEME_NAME]
|
325
|
+
usage: Sets the dsu color theme to THEME_NAME
|
326
|
+
long_desc: |
|
327
|
+
Sets the dsu color theme to THEME_NAME.
|
328
|
+
|
329
|
+
$ dsu theme use [THEME_NAME]
|
330
|
+
|
331
|
+
NOTES
|
332
|
+
|
333
|
+
If THEME_NAME is not provided, the default theme will be used.
|
334
|
+
|
335
|
+
If THEME_NAME does not exist, you will be given the option to create a new theme.
|
336
|
+
messages:
|
337
|
+
using_color_theme: Using color theme "%{theme_name}".
|
338
|
+
show:
|
339
|
+
desc: show THEME_NAME
|
340
|
+
usage: Displays the dsu color theme THEME_NAME
|
341
|
+
long_desc: |
|
342
|
+
Displays the dsu color theme THEME_NAME.
|
343
|
+
|
344
|
+
$ dsu theme show THEME_NAME
|
345
|
+
generic:
|
346
|
+
color_theme: "%{theme_name} color theme"
|
347
|
+
errors:
|
348
|
+
does_not_exist: Color theme "%{theme_name}" does not exist.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dsu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gene M. Angelo, Jr.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -153,7 +153,6 @@ email:
|
|
153
153
|
- public.gma@gmail.com
|
154
154
|
executables:
|
155
155
|
- dsu
|
156
|
-
- dsu_migrate.rb
|
157
156
|
extensions: []
|
158
157
|
extra_rdoc_files: []
|
159
158
|
files:
|
@@ -172,7 +171,6 @@ files:
|
|
172
171
|
- bin/dsu
|
173
172
|
- bin/setup
|
174
173
|
- exe/dsu
|
175
|
-
- exe/dsu_migrate.rb
|
176
174
|
- lib/core/ruby/color_theme_colors.rb
|
177
175
|
- lib/core/ruby/color_theme_mode.rb
|
178
176
|
- lib/core/ruby/wrap_and_join.rb
|
@@ -199,6 +197,8 @@ files:
|
|
199
197
|
- lib/dsu/services/color_theme/hydrator_service.rb
|
200
198
|
- lib/dsu/services/configuration/hydrator_service.rb
|
201
199
|
- lib/dsu/services/entry/hydrator_service.rb
|
200
|
+
- lib/dsu/services/entry_group/counter_service.rb
|
201
|
+
- lib/dsu/services/entry_group/deleter_service.rb
|
202
202
|
- lib/dsu/services/entry_group/editor_service.rb
|
203
203
|
- lib/dsu/services/entry_group/hydrator_service.rb
|
204
204
|
- lib/dsu/services/migration_version/hydrator_service.rb
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- lib/dsu/services/temp_file/writer_service.rb
|
209
209
|
- lib/dsu/subcommands/base_subcommand.rb
|
210
210
|
- lib/dsu/subcommands/config.rb
|
211
|
+
- lib/dsu/subcommands/delete.rb
|
211
212
|
- lib/dsu/subcommands/edit.rb
|
212
213
|
- lib/dsu/subcommands/list.rb
|
213
214
|
- lib/dsu/subcommands/theme.rb
|
@@ -247,6 +248,12 @@ files:
|
|
247
248
|
- lib/dsu/views/shared/model_errors.rb
|
248
249
|
- lib/dsu/views/shared/success.rb
|
249
250
|
- lib/dsu/views/shared/warning.rb
|
251
|
+
- lib/locales/en/active_record.yml
|
252
|
+
- lib/locales/en/commands.yml
|
253
|
+
- lib/locales/en/miscellaneous.yml
|
254
|
+
- lib/locales/en/presenters.yml
|
255
|
+
- lib/locales/en/services.yml
|
256
|
+
- lib/locales/en/subcommands.yml
|
250
257
|
- lib/seed_data/themes/cherry.json
|
251
258
|
- lib/seed_data/themes/default.json
|
252
259
|
- lib/seed_data/themes/lemon.json
|
@@ -269,6 +276,8 @@ post_install_message: |
|
|
269
276
|
View the dsu README.md here: https://github.com/gangelo/dsu
|
270
277
|
View the dsu CHANGELOG.md: https://github.com/gangelo/dsu/blob/main/CHANGELOG.md
|
271
278
|
|
279
|
+
Dsu now has a delete command! Try it out by running `dsu delete help`.
|
280
|
+
|
272
281
|
Try a dsu theme by running `dsu theme list` and then `dsu theme use THEME_NAME` where THEME_NAME is the name of the theme you want to try :)
|
273
282
|
rdoc_options: []
|
274
283
|
require_paths:
|
data/exe/dsu_migrate.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
require 'bundler/setup'
|
6
|
-
# require 'highline'
|
7
|
-
require 'dsu'
|
8
|
-
|
9
|
-
# def run_migrations?
|
10
|
-
# puts '***********************************************'
|
11
|
-
# puts '*** Migrations are pending! ***'
|
12
|
-
# puts '*** This is a pre-release version of dsu. ***'
|
13
|
-
# puts '*** It is highly recommended you exit ***'
|
14
|
-
# puts '*** this installation! ***'
|
15
|
-
# puts '***********************************************'
|
16
|
-
# prompt = 'What do you want to do?' \
|
17
|
-
# "\n c = Continue (install and run migrations)." \
|
18
|
-
# "\n x = Exit (recommended)." \
|
19
|
-
# "\n> "
|
20
|
-
# input = HighLine.new.ask(prompt, String) do |question|
|
21
|
-
# question.default = 'x'
|
22
|
-
# question.readline = true
|
23
|
-
# question.in = %w[x c]
|
24
|
-
# end
|
25
|
-
# input == 'c'
|
26
|
-
# end
|
27
|
-
|
28
|
-
def run_migrations!
|
29
|
-
# return 1 unless run_migrations?
|
30
|
-
|
31
|
-
puts 'Running migrations...'
|
32
|
-
Dsu::Migration::Service.run_migrations!
|
33
|
-
0
|
34
|
-
rescue StandardError => e
|
35
|
-
puts "Error running migrations: #{e.message}"
|
36
|
-
1
|
37
|
-
end
|
38
|
-
|
39
|
-
if Dsu::Migration::Service.run_migrations?
|
40
|
-
exit run_migrations!
|
41
|
-
else
|
42
|
-
exit 0
|
43
|
-
end
|