dsu 2.4.4 → 3.0.0.alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -0
- data/CHANGELOG.md +42 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/Rakefile +6 -0
- data/current_project.bak +4 -0
- data/lib/dsu/cli.rb +24 -6
- data/lib/dsu/crud/json_file.rb +3 -0
- data/lib/dsu/migration/version.rb +1 -1
- data/lib/dsu/models/color_theme.rb +7 -58
- data/lib/dsu/models/configuration.rb +18 -3
- data/lib/dsu/models/entry_group.rb +0 -7
- data/lib/dsu/models/migration_version.rb +0 -1
- data/lib/dsu/models/project.rb +295 -0
- data/lib/dsu/presenters/base_presenter_ex.rb +1 -12
- data/lib/dsu/presenters/export/all_presenter.rb +14 -19
- data/lib/dsu/presenters/export/dates_presenter.rb +17 -20
- data/lib/dsu/presenters/import/all_presenter.rb +20 -25
- data/lib/dsu/presenters/import/dates_presenter.rb +25 -27
- data/lib/dsu/presenters/import/import_entry.rb +22 -0
- data/lib/dsu/presenters/import/import_file.rb +9 -1
- data/lib/dsu/presenters/project/create_presenter.rb +44 -0
- data/lib/dsu/presenters/project/delete_by_number_presenter.rb +54 -0
- data/lib/dsu/presenters/project/delete_presenter.rb +53 -0
- data/lib/dsu/presenters/project/list_presenter.rb +24 -0
- data/lib/dsu/presenters/project/rename_by_number_presenter.rb +63 -0
- data/lib/dsu/presenters/project/rename_presenter.rb +57 -0
- data/lib/dsu/presenters/project/use_by_number_presenter.rb +53 -0
- data/lib/dsu/presenters/project/use_presenter.rb +52 -0
- data/lib/dsu/services/entry_group/exporter_service.rb +22 -5
- data/lib/dsu/services/entry_group/importer_service.rb +41 -8
- data/lib/dsu/services/project/hydrator_service.rb +40 -0
- data/lib/dsu/services/project/rename_service.rb +70 -0
- data/lib/dsu/subcommands/export.rb +4 -2
- data/lib/dsu/subcommands/import.rb +7 -3
- data/lib/dsu/subcommands/project.rb +149 -0
- data/lib/dsu/support/ask.rb +10 -3
- data/lib/dsu/support/color_themable.rb +1 -1
- data/lib/dsu/support/command_hookable.rb +7 -2
- data/lib/dsu/support/descriptable.rb +5 -21
- data/lib/dsu/support/fileable.rb +39 -1
- data/lib/dsu/support/project_file_system.rb +121 -0
- data/lib/dsu/support/short_string.rb +24 -0
- data/lib/dsu/support/time_comparable.rb +2 -0
- data/lib/dsu/support/transform_project_name.rb +24 -0
- data/lib/dsu/validators/project_name_validator.rb +58 -0
- data/lib/dsu/version.rb +1 -1
- data/lib/dsu/views/base_list_view.rb +41 -0
- data/lib/dsu/views/export.rb +60 -6
- data/lib/dsu/views/import.rb +83 -7
- data/lib/dsu/views/import_dates.rb +17 -0
- data/lib/dsu/views/project/create.rb +87 -0
- data/lib/dsu/views/project/delete.rb +96 -0
- data/lib/dsu/views/project/delete_by_number.rb +19 -0
- data/lib/dsu/views/project/list.rb +115 -0
- data/lib/dsu/views/project/rename.rb +98 -0
- data/lib/dsu/views/project/rename_by_number.rb +21 -0
- data/lib/dsu/views/project/use.rb +97 -0
- data/lib/dsu/views/project/use_by_number.rb +19 -0
- data/lib/dsu.rb +2 -10
- data/lib/locales/en/active_record.yml +9 -0
- data/lib/locales/en/commands.yml +9 -3
- data/lib/locales/en/miscellaneous.yml +4 -0
- data/lib/locales/en/services.yml +4 -0
- data/lib/locales/en/subcommands.yml +247 -15
- data/project.bak +0 -0
- metadata +34 -9
- data/lib/dsu/presenters/export/messages.rb +0 -32
- data/lib/dsu/presenters/export/nothing_to_export.rb +0 -13
- data/lib/dsu/presenters/export/service_callable.rb +0 -20
- data/lib/dsu/presenters/import/messages.rb +0 -42
- data/lib/dsu/presenters/import/service_callable.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2588c231eb86067d69a619e6d0abb2d4bf2bcaef6c5b98fe7d6a33f34ff49241
|
4
|
+
data.tar.gz: 5cf24d7762067a3d57aa9219ac0e176e5520c5a18a71e0af0b9dad31f670d040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edf0a827764efa759ec4194badd79fcf9b2734ec9fa4d6d96f90ddcce12b29d9c33e436c1ea7914249f609eae354640c8693ce0d0c5e14a9d8d1d5329126575f
|
7
|
+
data.tar.gz: 19f9864924cfa053385e72da1ff7dda211a6dac1c8f14798bbbc10e39e420581a35e760fae11124fd45913d317cc5a2f3f74334a4c23856fb5e35d289d5e6aaa
|
data/.rubocop.yml
CHANGED
@@ -190,3 +190,15 @@ Style/StringMethods:
|
|
190
190
|
# Checks for use of parentheses around ternary conditions.
|
191
191
|
Style/TernaryParentheses:
|
192
192
|
EnforcedStyle: require_parentheses_when_complex
|
193
|
+
|
194
|
+
RSpec/NotToNot:
|
195
|
+
EnforcedStyle: to_not
|
196
|
+
SupportedStyles:
|
197
|
+
- to_not
|
198
|
+
- not_to
|
199
|
+
|
200
|
+
RSpec/MultipleExpectations:
|
201
|
+
Enabled: false
|
202
|
+
|
203
|
+
RSpec/MultipleMemoizedHelpers:
|
204
|
+
Max: 6
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,48 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [3.0.0] - 2024-??-??
|
6
|
+
|
7
|
+
### Enhancements
|
8
|
+
[x] Added `dsu project` command to manage DSU projects. See `dsu help project` or the [dsu wiki](https://github.com/gangelo/dsu/wiki) for more information.
|
9
|
+
[x] The `dsu add` command how allows you to add entries using mnemonics and relative date mnemonics (RDMs) in addition to absolute dates. For example, `dsu add -d -7 "My entry"` will add an entry one week in the past from the current day. See `dsu help add` for more information.
|
10
|
+
|
11
|
+
### Changes
|
12
|
+
[x] Update ruby gems.
|
13
|
+
[x] Change `dsu export` file name for exports. When exporting all DSU entry groups for a project, the file name will be:
|
14
|
+
|
15
|
+
"dsu-export-<transformed project name>-<timestamp>-all-entry-groups-<from date>-thru-<to date>.csv"
|
16
|
+
|
17
|
+
When exporting DSU entry groups for a project between two given dates, the file name will be:
|
18
|
+
|
19
|
+
"dsu-export-<transformed project name>-<timestamp>-entry-groups-<from date>-thru-<to date>.csv"
|
20
|
+
|
21
|
+
- Where <transformed project name> = is the project name transformed to a format appropriate to be part of a file name.
|
22
|
+
- Where <timestamp> = is the current timestamp in the format: YYYYMMDDHHMMSS
|
23
|
+
- Where <from date> = is the from date in the format: YYYY-MM-DD
|
24
|
+
- Where <to date> = is the to date in the format: YYYY-MM-DD
|
25
|
+
|
26
|
+
When exporting all DSU entry groups for a project, the <from date> and <to date> will represent the earliest and most recent entry group dates for the project, respectfully. For example:
|
27
|
+
|
28
|
+
```
|
29
|
+
# Where current date is 2024-01-29, and the earliest entry group date is 2023-08-11 and the most recent entry group date is 2024-01-27.
|
30
|
+
$ dsu x a
|
31
|
+
```
|
32
|
+
|
33
|
+
dsu-export-default-20240129130013-all-entry-groups-2023-08-11-thru-2024-01-27.csv
|
34
|
+
|
35
|
+
When exporting DSU entry groups between a to and from date for a project, the <from date> and <to date> will represent the from and to dates entered by the user on the command line, respectfully. For example:
|
36
|
+
|
37
|
+
```
|
38
|
+
# Where current date is 2024-01-29, and the from date entered on the command line is2023-08-11 and the from date entered on the command line is 2024-01-27.
|
39
|
+
dsu x dd -f n -t -257
|
40
|
+
```
|
41
|
+
|
42
|
+
dsu-export-default-20240129125946-entry-groups-2023-05-17-thru-2024-01-29.csv
|
43
|
+
|
44
|
+
### Bug Fixes
|
45
|
+
|
46
|
+
|
5
47
|
## [2.4.4] - 2024-01-28
|
6
48
|
### Changes
|
7
49
|
[x] Update ruby gems.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# `dsu`
|
2
2
|
|
3
3
|
[![Ruby](https://github.com/gangelo/dsu/actions/workflows/ruby.yml/badge.svg)](https://github.com/gangelo/dsu/actions/workflows/ruby.yml)
|
4
|
-
[![GitHub version](http://badge.fury.io/gh/gangelo%2Fdsu.svg?refresh=
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/dsu.svg?refresh=
|
4
|
+
[![GitHub version](http://badge.fury.io/gh/gangelo%2Fdsu.svg?refresh=12)](https://badge.fury.io/gh/gangelo%2Fdsu)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/dsu.svg?refresh=12)](https://badge.fury.io/rb/dsu)
|
6
6
|
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/dsu/)
|
7
7
|
[![Report Issues](https://img.shields.io/badge/report-issues-red.svg)](https://github.com/gangelo/dsu/issues)
|
8
8
|
[![License](http://img.shields.io/badge/license-MIT-yellowgreen.svg)](#license)
|
data/Rakefile
CHANGED
@@ -10,3 +10,9 @@ require "rubocop/rake_task"
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
12
12
|
task default: %i[spec rubocop]
|
13
|
+
|
14
|
+
desc 'Generate a migration timestamp'
|
15
|
+
task :timestamp do
|
16
|
+
puts 'The below migration timestamp should be placed in the "lib/dsu/migration/version.rb" file.'
|
17
|
+
puts Time.now.strftime('%Y%m%d%H%M%S')
|
18
|
+
end
|
data/current_project.bak
ADDED
data/lib/dsu/cli.rb
CHANGED
@@ -11,12 +11,18 @@ require_relative 'subcommands/edit'
|
|
11
11
|
require_relative 'subcommands/export'
|
12
12
|
require_relative 'subcommands/import'
|
13
13
|
require_relative 'subcommands/list'
|
14
|
+
require_relative 'subcommands/project'
|
14
15
|
require_relative 'subcommands/theme'
|
16
|
+
require_relative 'support/command_options/time_mnemonic'
|
17
|
+
require_relative 'support/time_formatable'
|
15
18
|
require_relative 'views/entry_group/list'
|
16
19
|
|
17
20
|
module Dsu
|
18
21
|
# The `dsu` command.
|
19
22
|
class CLI < BaseCLI
|
23
|
+
include Support::CommandOptions::TimeMnemonic
|
24
|
+
include Support::TimeFormatable
|
25
|
+
|
20
26
|
map I18n.t('commands.add.key_mappings') => :add
|
21
27
|
map I18n.t('commands.browse.key_mappings') => :browse
|
22
28
|
map I18n.t('commands.config.key_mappings') => :config
|
@@ -27,30 +33,39 @@ module Dsu
|
|
27
33
|
map I18n.t('commands.import.key_mappings') => :import
|
28
34
|
map I18n.t('commands.info.key_mappings') => :info
|
29
35
|
map I18n.t('commands.list.key_mappings') => :list
|
36
|
+
map I18n.t('commands.project.key_mappings') => :project
|
30
37
|
map I18n.t('commands.theme.key_mappings') => :theme
|
31
38
|
map I18n.t('commands.version.key_mappings') => :version
|
32
39
|
|
33
40
|
desc I18n.t('commands.add.desc'), I18n.t('commands.add.usage')
|
34
|
-
long_desc I18n.t('commands.add.long_desc',
|
41
|
+
long_desc I18n.t('commands.add.long_desc',
|
42
|
+
date_option_description: date_option_description, mnemonic_option_description: mnemonic_option_description)
|
35
43
|
option I18n.t('options.date.name'), aliases: I18n.t('options.date.aliases'), type: :string
|
36
44
|
option I18n.t('options.tomorrow.name'), aliases: I18n.t('options.tomorrow.aliases'), type: :boolean
|
37
45
|
option I18n.t('options.yesterday.name'), aliases: I18n.t('options.yesterday.aliases'), type: :boolean
|
38
46
|
option I18n.t('options.today.name'), aliases: I18n.t('options.today.aliases'), type: :boolean, default: true
|
39
47
|
def add(description)
|
40
|
-
|
41
|
-
|
48
|
+
date_or_mnemonic = if options[I18n.t('options.date.name')].present?
|
49
|
+
options[I18n.t('options.date.name')]
|
42
50
|
elsif options[I18n.t('options.tomorrow.name')].present?
|
43
|
-
|
51
|
+
I18n.t('options.tomorrow.name')
|
44
52
|
elsif options[I18n.t('options.yesterday.name')].present?
|
45
|
-
|
53
|
+
I18n.t('options.yesterday.name')
|
46
54
|
elsif options[I18n.t('options.today.name')].present?
|
47
|
-
|
55
|
+
I18n.t('options.today.name')
|
56
|
+
end
|
57
|
+
time = if time_mnemonic?(date_or_mnemonic)
|
58
|
+
time_from_mnemonic(command_option: date_or_mnemonic)
|
59
|
+
else
|
60
|
+
Time.parse(date_or_mnemonic)
|
48
61
|
end
|
49
62
|
entry = Models::Entry.new(description: description)
|
50
63
|
CommandServices::AddEntryService.new(entry: entry, time: time).call
|
51
64
|
presenter = Presenters::EntryGroup::List::DatePresenter.new(times: [time], options: options)
|
52
65
|
# TODO: Refactor View::EntryGroup::Show to accept a presenter and use it here
|
53
66
|
Views::EntryGroup::List.new(presenter: presenter).render
|
67
|
+
rescue ArgumentError => e
|
68
|
+
Views::Shared::Error.new(messages: e.message).render
|
54
69
|
end
|
55
70
|
|
56
71
|
desc I18n.t('commands.browse.desc'), I18n.t('commands.browse.usage')
|
@@ -59,6 +74,9 @@ module Dsu
|
|
59
74
|
desc I18n.t('commands.list.desc'), I18n.t('commands.list.usage')
|
60
75
|
subcommand :list, Subcommands::List
|
61
76
|
|
77
|
+
desc I18n.t('commands.project.desc'), I18n.t('commands.project.usage')
|
78
|
+
subcommand :project, Subcommands::Project
|
79
|
+
|
62
80
|
desc I18n.t('commands.config.desc'), I18n.t('commands.config.usage')
|
63
81
|
subcommand :config, Subcommands::Config
|
64
82
|
|
data/lib/dsu/crud/json_file.rb
CHANGED
@@ -114,6 +114,9 @@ module Dsu
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def write!(file_data:, file_path:)
|
117
|
+
# TODO: Should we be raising an error if the file does not exist?
|
118
|
+
# raise file_does_not_exist_message(file_path: file_path) unless file_exist?(file_path: file_path)
|
119
|
+
|
117
120
|
write(file_data: file_data, file_path: file_path)
|
118
121
|
end
|
119
122
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'json'
|
4
3
|
require_relative '../crud/json_file'
|
5
4
|
require_relative '../migration/version'
|
6
5
|
require_relative '../support/color_themable'
|
@@ -76,7 +75,7 @@ module Dsu
|
|
76
75
|
@theme_name = theme_name
|
77
76
|
@options = options || {}
|
78
77
|
|
79
|
-
super(self.class.send(:
|
78
|
+
super(self.class.send(:themes_path, theme_name: @theme_name))
|
80
79
|
|
81
80
|
theme_hash ||= DEFAULT_THEME.merge(description: "#{@theme_name.capitalize} theme")
|
82
81
|
|
@@ -112,6 +111,8 @@ module Dsu
|
|
112
111
|
end
|
113
112
|
|
114
113
|
class << self
|
114
|
+
delegate :themes_folder, :themes_path, to: Support::Fileable
|
115
|
+
|
115
116
|
def all
|
116
117
|
Dir.glob("#{themes_folder}/*").map do |file_path|
|
117
118
|
theme_name = File.basename(file_path, '.*')
|
@@ -141,11 +142,11 @@ module Dsu
|
|
141
142
|
end
|
142
143
|
|
143
144
|
def delete(theme_name:)
|
144
|
-
superclass.delete(file_path:
|
145
|
+
superclass.delete(file_path: themes_path(theme_name: theme_name))
|
145
146
|
end
|
146
147
|
|
147
148
|
def delete!(theme_name:)
|
148
|
-
superclass.delete!(file_path:
|
149
|
+
superclass.delete!(file_path: themes_path(theme_name: theme_name))
|
149
150
|
end
|
150
151
|
|
151
152
|
def ensure_color_theme_color_defaults_for(theme_hash: DEFAULT_THEME)
|
@@ -160,11 +161,11 @@ module Dsu
|
|
160
161
|
end
|
161
162
|
|
162
163
|
def exist?(theme_name:)
|
163
|
-
superclass.file_exist?(file_path:
|
164
|
+
superclass.file_exist?(file_path: themes_path(theme_name: theme_name))
|
164
165
|
end
|
165
166
|
|
166
167
|
def find(theme_name:)
|
167
|
-
theme_hash = read!(file_path:
|
168
|
+
theme_hash = read!(file_path: themes_path(theme_name: theme_name))
|
168
169
|
Services::ColorTheme::HydratorService.new(theme_name: theme_name, theme_hash: theme_hash).call
|
169
170
|
end
|
170
171
|
|
@@ -180,55 +181,11 @@ module Dsu
|
|
180
181
|
new(theme_name: theme_name)
|
181
182
|
end
|
182
183
|
|
183
|
-
# TODO: Unused?
|
184
|
-
# def build_color_theme(theme_name:, base_color:, description:)
|
185
|
-
# theme_hash = Models::ColorTheme.send(:replace, color_theme: default,
|
186
|
-
# replace_color: :cyan, with_color: base_color).tap do |hash|
|
187
|
-
# hash[:description] = description
|
188
|
-
# end
|
189
|
-
# new(theme_name: theme_name, theme_hash: theme_hash)
|
190
|
-
# end
|
191
|
-
|
192
184
|
private
|
193
185
|
|
194
186
|
def default_theme_color_keys
|
195
187
|
DEFAULT_THEME_COLORS.keys
|
196
188
|
end
|
197
|
-
|
198
|
-
def replace(color_theme:, replace_color:, with_color:)
|
199
|
-
colors_theme_hash = color_theme.to_theme_colors_h.tap do |hash|
|
200
|
-
hash.each_key do |key|
|
201
|
-
hash[key] = replace_color(theme_color: hash[key],
|
202
|
-
replace_color: replace_color, with_color: with_color)
|
203
|
-
end
|
204
|
-
end
|
205
|
-
DEFAULT_THEME.merge(colors_theme_hash)
|
206
|
-
end
|
207
|
-
|
208
|
-
def replace_color(theme_color:, replace_color:, with_color:)
|
209
|
-
%i[color background].each do |color_type|
|
210
|
-
color = theme_color[color_type].to_s.sub(replace_color.to_s, with_color.to_s)
|
211
|
-
theme_color[color_type] = color.sub('light_light_', 'light_').to_sym
|
212
|
-
end
|
213
|
-
theme_color
|
214
|
-
end
|
215
|
-
|
216
|
-
# If the color theme is deleted (deleted_theme_name) and the current
|
217
|
-
# theme_name in the configuration is the same as the deleted theme,
|
218
|
-
# we need to reset the configuration theme to the default theme.
|
219
|
-
def reset_default_configuration_color_theme_if!(deleted_theme_name:)
|
220
|
-
config = configuration
|
221
|
-
return if config.theme_name == self::DEFAULT_THEME_NAME
|
222
|
-
return unless config.theme_name == deleted_theme_name
|
223
|
-
return unless config.exist?
|
224
|
-
|
225
|
-
config.theme_name = self::DEFAULT_THEME_NAME
|
226
|
-
config.write!
|
227
|
-
end
|
228
|
-
|
229
|
-
def themes_path_for(theme_name:)
|
230
|
-
Support::Fileable.themes_path(theme_name: theme_name)
|
231
|
-
end
|
232
189
|
end
|
233
190
|
|
234
191
|
def to_h
|
@@ -239,14 +196,6 @@ module Dsu
|
|
239
196
|
end
|
240
197
|
end
|
241
198
|
|
242
|
-
def to_theme_colors_h
|
243
|
-
{}.tap do |hash|
|
244
|
-
DEFAULT_THEME_COLORS.each_key do |key|
|
245
|
-
hash[key] = public_send(key)
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
199
|
def ==(other)
|
251
200
|
return false unless other.is_a?(self.class)
|
252
201
|
return false unless other.theme_name == theme_name
|
@@ -42,7 +42,9 @@ module Dsu
|
|
42
42
|
# The currently selected color theme. Should be equal to
|
43
43
|
# Models::ColorTheme::DEFAULT_THEME_NAME or the name of a custom
|
44
44
|
# theme (with the same file name) that resides in the themes_folder.
|
45
|
-
theme_name: 'default'
|
45
|
+
theme_name: 'default',
|
46
|
+
# The default project to use.
|
47
|
+
default_project: 'default'
|
46
48
|
}.freeze
|
47
49
|
|
48
50
|
validates_with Validators::VersionValidator
|
@@ -53,13 +55,16 @@ module Dsu
|
|
53
55
|
validates :include_all, inclusion: { in: [true, false], message: 'must be true or false' }
|
54
56
|
validates :theme_name, presence: true
|
55
57
|
validate :validate_theme_file
|
58
|
+
validates :default_project, presence: true
|
59
|
+
validate :validate_default_project
|
56
60
|
|
57
61
|
attr_accessor :version,
|
58
62
|
:editor,
|
59
63
|
:entries_display_order,
|
60
64
|
:carry_over_entries_to_today,
|
61
65
|
:include_all,
|
62
|
-
:theme_name
|
66
|
+
:theme_name,
|
67
|
+
:default_project
|
63
68
|
|
64
69
|
attr_reader :options
|
65
70
|
|
@@ -114,7 +119,8 @@ module Dsu
|
|
114
119
|
entries_display_order: entries_display_order,
|
115
120
|
carry_over_entries_to_today: carry_over_entries_to_today,
|
116
121
|
include_all: include_all,
|
117
|
-
theme_name: theme_name
|
122
|
+
theme_name: theme_name,
|
123
|
+
default_project: default_project
|
118
124
|
}
|
119
125
|
end
|
120
126
|
|
@@ -150,6 +156,7 @@ module Dsu
|
|
150
156
|
DEFAULT_CONFIGURATION[:carry_over_entries_to_today])
|
151
157
|
@include_all = config_hash.fetch(:include_all, DEFAULT_CONFIGURATION[:include_all])
|
152
158
|
@theme_name = config_hash.fetch(:theme_name, DEFAULT_CONFIGURATION[:theme_name])
|
159
|
+
@default_project = config_hash.fetch(:default_project, DEFAULT_CONFIGURATION[:default_project])
|
153
160
|
end
|
154
161
|
|
155
162
|
def validate_theme_file
|
@@ -159,6 +166,14 @@ module Dsu
|
|
159
166
|
i18n_key = 'configuration.errors.theme_file_missing'
|
160
167
|
errors.add(:base, I18n.t(i18n_key, theme_path: theme_path))
|
161
168
|
end
|
169
|
+
|
170
|
+
def validate_default_project
|
171
|
+
default_project_folder = File.join(projects_folder, default_project.presence || '{{blank}}')
|
172
|
+
return if Dir.exist?(default_project_folder)
|
173
|
+
|
174
|
+
i18n_key = 'configuration.errors.project_path_missing'
|
175
|
+
errors.add(:base, I18n.t(i18n_key, project_folder: default_project_folder))
|
176
|
+
end
|
162
177
|
end
|
163
178
|
end
|
164
179
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'active_model'
|
4
3
|
require_relative '../crud/json_file'
|
5
4
|
require_relative '../migration/version'
|
6
5
|
require_relative '../services/entry_group/editor_service'
|
@@ -177,12 +176,6 @@ module Dsu
|
|
177
176
|
Services::EntryGroup::HydratorService.new(entry_group_hash: entry_group_hash).call
|
178
177
|
end
|
179
178
|
|
180
|
-
def find_or_create(time:)
|
181
|
-
find_or_initialize(time: time).tap do |entry_group|
|
182
|
-
entry_group.write! unless entry_group.exist?
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
179
|
def find_or_initialize(time:)
|
187
180
|
file_path = entries_path_for(time: time)
|
188
181
|
read(file_path: file_path) do |entry_group_hash|
|