Skip to content

Commit

Permalink
Add light theme, bump version to release candidate 2.2.0.rc.1, update…
Browse files Browse the repository at this point in the history
… README.md and CHANGELOG.md
  • Loading branch information
gangelo committed Dec 23, 2023
1 parent 9e6e56d commit 1e6de03
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 13 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
## [2.2.0] 2023-??-??

TODO: Change above date to release date.
## [2.2.0.rc.1] 2023-12-23

Enhancements

- Added `dsu browse` command to interactively page through DSU entries.
- Added "light" theme for terminals with light backgrounds, see `dsu theme list` or `dsu theme show light` for more information.

Changes

- Refactors to use activesupport Time#in_time_zone, including tests.
- Various code refactors to support the aforementioned change.

## [2.1.4] 2023-12-19

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
dsu (2.2.0)
dsu (2.2.0.rc.1)
activemodel (>= 7.0.8, < 8.0)
activesupport (>= 7.0.8, < 8.0)
colorize (>= 0.8.1, < 1.0)
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ After installation (`gem install dsu`), the first thing you may want to do is ru
#=>
Commands:
dsu add|a [OPTIONS] DESCRIPTION # Adds a DSU entry...
dsu browse|b SUBCOMMAND # Browse DSU entries...
dsu config|c SUBCOMMAND # Manage configuration...
dsu delete|d SUBCOMMAND # Delete DSU entries...
dsu edit|e SUBCOMMAND # Edit DSU entries...
Expand Down Expand Up @@ -176,6 +177,18 @@ This can be accomplished MUCH easier by using the `yesterday` mnemonic. This wil
`$ dsu list dates --from yesterday --to -6`
`$ dsu l dd -f y -t -6`

## Browsing DSU Entries
You can browse DSU entries for the current week, month and year using any of the following commands. `dsu browse` somewhat similar to `dsu list` with added `week`, `month` and `year` convenience SUBCOMMANDs. `dsu browse` also pipes the output to the terminal, so you can conveniently scroll through the listed entries using your keyboard or mouse:

**NOTE:** Keyboard and/or mouse behavior while browsing (scrolling), is operating system dependent; `dsu browse` pipes its output to the terminal using `less` on nix systems, and `more` on Windows systems.

- `$ dsu browse week`
- `$ dsu b w` # Equivalent to the above, only using shortcuts
- `$ dsu browse month`
- `$ dsu b m` # Equivalent to the above, only using shortcuts
- `$ dsu browse year`
- `$ dsu b y` # Equivalent to the above, only using shortcuts

## Editing DSU Entries

You can edit DSU entry groups by date. `dsu` will allow you to edit a DSU entry group using the `dsu edit SUBCOMMAND` date (`n|today|t|tomorrow|y|yesterday|date DATE`) you specify. `dsu edit` will open your DSU entry group entries in your editor, where you'll be able to perform editing functions against one or all of the entries.
Expand Down
15 changes: 15 additions & 0 deletions dsu.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,25 @@ Gem::Specification.new do |spec|
View the dsu README.md here: https://github.com/gangelo/dsu
View the dsu CHANGELOG.md: https://github.com/gangelo/dsu/blob/main/CHANGELOG.md
Dsu now has a browse command! Try it out by running `dsu browse help`.
Dsu now has a "light" theme for light background terminals! Try it out by running `dsu theme use light`.
Dsu now has a delete command! Try it out by running `dsu delete help`.
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.
:)
Merry CHRISTmas, New Years and Happy holidays from dsu!
*
/*\\
*/*|\\*
/*/|\\*\\
*/**|\\*\\*
*//*|*\\*\\*\\
|||
|||
|||
POST_INSTALL
end
23 changes: 17 additions & 6 deletions lib/dsu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,22 @@
require file
end

if !(Dsu.env.test? || Dsu.env.development?) && Dsu::Migration::Service.run_migrations?
begin
Dsu::Migration::Service.new.call
rescue StandardError => e
puts I18n.t('errors.migration.error', message: e.message)
exit 1
unless Dsu.env.test? || Dsu.env.development?
if Dsu::Migration::Service.run_migrations?
begin
Dsu::Migration::Service.new.call
rescue StandardError => e
puts I18n.t('migrations.error.failed', message: e.message)
exit 1
end
end
# TODO: Hack. Integrate this into the migration service
# so that this runs only if the migration version changes.
theme_file = 'light.json'
destination_theme_file_path = File.join(Dsu::Support::Fileable.themes_folder, theme_file)
unless File.exist?(destination_theme_file_path)
source_theme_file_path = File.join(Dsu::Support::Fileable.seed_data_folder, 'themes', theme_file)
FileUtils.cp(source_theme_file_path, destination_theme_file_path)
puts I18n.t('migrations.information.theme_copied', from: source_theme_file_path, to: destination_theme_file_path)
end
end
2 changes: 1 addition & 1 deletion lib/dsu/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

module Dsu
VERSION_REGEX = /\A\d+\.\d+\.\d+(\.alpha\.\d+)?\z/
VERSION = '2.2.0'
VERSION = '2.2.0.rc.1'
end
7 changes: 5 additions & 2 deletions lib/locales/en/miscellaneous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ en:
error: "Error: %{message}"
from_option_invalid: Option -f, [--from=DATE|MNEMONIC] value is invalid ["%{from_option}"]
to_option_invalid: Option -t, [--to=DATE|MNEMONIC] value is invalid ["%{to_option}"]
migration:
error: "Error running migrations: %{message}"
headers:
entry:
could_not_be_added: "An error was encountered; the entry could not be added:"
Expand All @@ -21,3 +19,8 @@ en:
information:
dates:
through: "%{from} thru %{to}"
migrations:
error:
failed: "Error running migrations: %{message}"
information:
theme_copied: Theme copied from %{from} to %{to}.
79 changes: 79 additions & 0 deletions lib/seed_data/themes/light.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"version": 20230613121411,
"description": "Theme for Light backgrounds",
"help": {
"color": "default",
"mode": "default",
"background": "default"
},
"dsu_header": {
"color": "white",
"mode": "bold",
"background": "black"
},
"dsu_footer": {
"color": "default",
"mode": "default",
"background": "default"
},
"header": {
"color": "default",
"mode": "bold",
"background": "default"
},
"subheader": {
"color": "default",
"mode": "underline",
"background": "default"
},
"body": {
"color": "default",
"mode": "default",
"background": "default"
},
"footer": {
"color": "light_default",
"mode": "default",
"background": "default"
},
"date": {
"color": "default",
"mode": "bold",
"background": "default"
},
"index": {
"color": "light_default",
"mode": "italic",
"background": "default"
},
"info": {
"color": "white",
"mode": "bold",
"background": "blue"
},
"success": {
"color": "white",
"mode": "bold",
"background": "green"
},
"warning": {
"color": "default",
"mode": "bold",
"background": "yellow"
},
"error": {
"color": "light_yellow",
"mode": "default",
"background": "red"
},
"prompt": {
"color": "default",
"mode": "bold",
"background": "default"
},
"prompt_options": {
"color": "default",
"mode": "bold",
"background": "default"
}
}

0 comments on commit 1e6de03

Please sign in to comment.