Module: Timet

Defined in:
lib/timet/s3_supabase.rb,
lib/timet/table.rb,
lib/timet/utils.rb,
lib/timet/version.rb,
lib/timet/database.rb,
lib/timet/week_info.rb,
lib/timet/application.rb,
lib/timet/color_codes.rb,
lib/timet/time_helper.rb,
lib/timet/time_report.rb,
lib/timet/database_syncer.rb,
lib/timet/time_statistics.rb,
lib/timet/discord_notifier.rb,
lib/timet/tag_distribution.rb,
lib/timet/time_block_chart.rb,
lib/timet/block_char_helper.rb,
lib/timet/validation_editor.rb,
lib/timet/application_helper.rb,
lib/timet/database_sync_helper.rb

Overview

Top-level module for the Timet time tracking gem.

Defined Under Namespace

Modules: ApplicationHelper, BlockCharHelper, DatabaseSyncHelper, DatabaseSyncer, S3Config, TagDistribution, TagDistributionFormatting, TimeHelper, TimeValidationHelpers, Utils Classes: Application, ColorCodes, Database, DiscordNotifier, S3ObjectRef, S3Supabase, Table, TimeBlockChart, TimeReport, TimeStatistics, ValidationEditor, WeekInfo

Constant Summary collapse

VERSION =

The version of the Timet application.

Examples:

Get the version of the Timet application

Timet::VERSION # => '1.6.3'

Returns:

  • (String)

    The version number in the format ‘major.minor.patch’.

'1.6.3'
REQUIRED_ENV_VARS =

Required environment variables for S3 configuration.

%w[S3_ENDPOINT S3_ACCESS_KEY S3_SECRET_KEY].freeze

Class Method Summary collapse

Class Method Details

.append_missing_env_vars(env_file_path) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/timet/s3_supabase.rb', line 28

def self.append_missing_env_vars(env_file_path)
  Dotenv.load(env_file_path)
  missing_vars = REQUIRED_ENV_VARS.reject { |var| ENV.fetch(var, nil) }
  return if missing_vars.empty?

  File.write(env_file_path, "#{missing_vars.map { |var| "#{var}=''" }.join("\n")}\n", mode: 'a')
end

.ensure_directory_exists(env_file_path) ⇒ Object



19
20
21
22
# File 'lib/timet/s3_supabase.rb', line 19

def self.ensure_directory_exists(env_file_path)
  dir_path = File.dirname(env_file_path)
  FileUtils.mkdir_p(dir_path)
end

.ensure_env_file_exists(env_file_path) ⇒ Object



13
14
15
16
17
# File 'lib/timet/s3_supabase.rb', line 13

def self.ensure_env_file_exists(env_file_path)
  ensure_directory_exists(env_file_path)
  ensure_file_exists(env_file_path)
  append_missing_env_vars(env_file_path)
end

.ensure_file_exists(env_file_path) ⇒ Object



24
25
26
# File 'lib/timet/s3_supabase.rb', line 24

def self.ensure_file_exists(env_file_path)
  File.write(env_file_path, '', mode: 'a')
end