Skip to content

Commit

Permalink
Use the csm ruby gem
Browse files Browse the repository at this point in the history
- Removes ColorSettings and ANSIColors.
- Fixed rubocop Style/RedundantReturn warning.
  • Loading branch information
endormi authored Apr 11, 2024
2 parents 9b78087 + 43369bf commit 20647ac
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 190 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ Gemspec/RequiredRubyVersion:
Style/IdenticalConditionalBranches:
# I will look into this later
Enabled: false

Style/ColonMethodCall:
# ColorSchemeManager::load_colors looks better in my opinion
Enabled: false
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source 'https://rubygems.org'

gem 'config'
gem 'csm'
gem 'libreconv'
gem 'mini_magick'
gem 'rake', require: false
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ GEM
config (3.1.0)
deep_merge (~> 1.2, >= 1.2.1)
dry-validation (~> 1.0, >= 1.0.0)
csm (0.1.1)
yaml
deep_merge (1.2.1)
diff-lcs (1.5.0)
dry-configurable (0.12.1)
Expand Down Expand Up @@ -77,12 +79,14 @@ GEM
parser (>= 2.7.1.5)
ruby-progressbar (1.11.0)
unicode-display_width (2.0.0)
yaml (0.3.0)

PLATFORMS
ruby

DEPENDENCIES
config
csm
libreconv
mini_magick
rake
Expand Down
82 changes: 0 additions & 82 deletions spec/ansi_colors_spec.rb

This file was deleted.

36 changes: 0 additions & 36 deletions spec/color_settings_spec.rb

This file was deleted.

2 changes: 1 addition & 1 deletion sys/file_folder/fd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_directory_path
end

def check_directory_existence(dir)
return puts("#{dir} doesn't exist."), exit unless File.directory?(dir)
[puts("#{dir} doesn't exist."), exit] unless File.directory?(dir)
end

def retrieve_user_input
Expand Down
3 changes: 2 additions & 1 deletion sys/img/convert_img.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def get_new_image_name

def validate_new_image_name(name)
return puts('You need to add the file extension.'), exit unless name.include?('.')
return puts('File already exists.'), exit if File.file?(name)

[puts('File already exists.'), exit] if File.file?(name)
end

if ARGV[0] == 'tilux'
Expand Down
2 changes: 1 addition & 1 deletion sys/img/image_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def self.get_user_input(text)
#
# @param img [String] The path to the image file.
def self.check_image_existence(img)
return puts("File doesn't exist."), exit unless File.file?(img)
[puts("File doesn't exist."), exit] unless File.file?(img)
end
end
31 changes: 0 additions & 31 deletions tools/tilux/ansi_colors.rb

This file was deleted.

35 changes: 0 additions & 35 deletions tools/tilux/color_settings.rb

This file was deleted.

17 changes: 14 additions & 3 deletions tools/tilux/command_processor.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/ruby

require 'csm'
require_relative '../catch_exception'
require_relative 'ansi_colors'
require_relative 'color_settings'
require_relative 'command_options'
require_relative 'helpers'
require_relative 'print_options'
Expand All @@ -17,10 +16,22 @@
o888o o888o o888ooooood8 YbodP o888o o88888o
".freeze

DEFAULT_COLORS = {
'header_color' => 'red',
'version_text_color' => 'light_white',
'version_number_color' => 'light_blue',
'author_color' => 'light_white',
'link_color' => 'light_white',
'prompt_text_color' => 'light_white',
'prompt_color' => 'light_yellow'
}.freeze

# TiluxCommandProcessor is responsible for processing user commands and executing corresponding actions.
class TiluxCommandProcessor
def initialize(version)
@all_colors = ColorSettings.load_colors
custom_settings_file = File.join(PATH, '.custom_settings.yaml')
custom_colors = ColorSchemeManager::load_custom_yaml_file(custom_settings_file)
@all_colors = ColorSchemeManager::load_colors(DEFAULT_COLORS, custom_colors)
@version = version
end

Expand Down

0 comments on commit 20647ac

Please sign in to comment.