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/item_data_helper.rb,
lib/timet/tag_distribution.rb,
lib/timet/time_block_chart.rb,
lib/timet/block_char_helper.rb,
lib/timet/application_helper.rb,
lib/timet/time_report_helper.rb,
lib/timet/time_update_helper.rb,
lib/timet/database_sync_helper.rb,
lib/timet/time_validation_helper.rb,
lib/timet/validation_edit_helper.rb
Overview
The module includes several components:
-
S3 integration for data backup and sync
Defined Under Namespace
Modules: ApplicationHelper, BlockCharHelper, DatabaseSyncHelper, DatabaseSyncer, ItemDataHelper, TagDistribution, TimeHelper, TimeReportHelper, TimeUpdateHelper, TimeValidationHelper, Utils, ValidationEditHelper Classes: Application, ColorCodes, Database, S3Supabase, Table, TimeBlockChart, TimeReport, TimeStatistics, WeekInfo
Constant Summary collapse
- VERSION =
The version of the Timet application.
'1.5.7'
- REQUIRED_ENV_VARS =
Required environment variables for S3 configuration
%w[S3_ENDPOINT S3_ACCESS_KEY S3_SECRET_KEY].freeze
Class Method Summary collapse
-
.ensure_env_file_exists(env_file_path) ⇒ void
Ensures that the environment file exists and contains the required variables.
Class Method Details
.ensure_env_file_exists(env_file_path) ⇒ void
This method returns an undefined value.
Ensures that the environment file exists and contains the required variables. If the file doesn’t exist, it creates it. If required variables are missing, it adds them with empty values.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/timet/s3_supabase.rb', line 23 def self.ensure_env_file_exists(env_file_path) dir_path = File.dirname(env_file_path) FileUtils.mkdir_p(dir_path) # Create file if it doesn't exist or is empty File.write(env_file_path, '', mode: 'a') # Load and check environment variables Dotenv.load(env_file_path) missing_vars = REQUIRED_ENV_VARS.reject { |var| ENV.fetch(var, nil) } # Append missing variables with empty values return if missing_vars.empty? File.write(env_file_path, "#{missing_vars.map { |var| "#{var}=''" }.join("\n")}\n", mode: 'a') end |