lib/tasks/gdk.rake (39 lines of code) (raw):

# frozen_string_literal: true namespace :gdk do migrations = %w[ migrate:update_telemetry_settings migrate:mise ] desc 'Run migration related to GDK setup' task migrate: migrations namespace :migrate do desc 'Update settings to turn on telemetry for GitLab team members (determined by @gitlab.com email in git config) and anonymize usernames for all users' task :update_telemetry_settings do telemetry_enabled = GDK.config.telemetry.enabled is_team_member = GDK::Telemetry.team_member? should_update = telemetry_enabled || is_team_member if should_update GDK::Output.info('Telemetry has been automatically enabled for you as a GitLab team member.') if !telemetry_enabled && is_team_member GDK::Telemetry.update_settings('y') end end desc 'Prompts GitLab team members to migrate from asdf to mise if asdf is still in use' task :mise do next unless !GDK.config.asdf.opt_out? && !GDK.config.mise.enabled && GDK::Telemetry.team_member? next unless GDK::ReminderHelper.should_run_reminder?('mise_migration') diagnostic = GDK::Diagnostic::ToolVersionManager.new GDK::Output.warn(diagnostic.detail(:update)) GDK::Output.puts unless GDK::Output.interactive? GDK::Output.info('Skipping mise migration prompt in non-interactive environment.') next end if GDK::Output.prompt('Would you like it to switch to mise now? [y/N]').match?(/\Ay(?:es)*\z/i) GDK::Output.info('Great! Running the mise migration now..') diagnostic.correct! else GDK::Output.info("No worries. We'll remind you again in 5 days.") GDK::ReminderHelper.update_reminder_timestamp!('mise_migration') end end end end