Sha256: e4f8b3d6552572c1ca061a343c756d0abc9709cc4214e6c8d228e549ebbcf73f

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

Dir.glob("#{__dir__}/core/scripts/*.rb").each { |file| require file }
Dir.glob("#{__dir__}/core/scripts/*.rb").each { |file| require file }
Dir.glob("#{__dir__}/core/*.rb").each { |file| require file }
Dir.glob("#{__dir__}/core/doctor/*.rb").each { |file| require file }
Dir.glob("#{__dir__}/core/aliases/*.rb").each { |file| require file }
Dir.glob("#{__dir__}/core/dashboard/*.rb").each { |file| require file }
Dir.glob("#{__dir__}/core/brands/*.rb").each { |file| require file }

require 'json'
require 'xcodeproj'

class SolaraInitializer

    def initialize(brand_key, brand_name)
        @brand_key = brand_key
        @brand_name = brand_name
        @project_root = SolaraSettingsManager.instance.project_root
    end

    def init
        Solara.logger.header("Initializing Solara")
        confirm_init_if_necessary
        message = "Initialized #{SolaraSettingsManager.instance.platform} successfully."
        SolaraManager.new.onboard(@brand_key, @brand_name, init: true, success_message: message)
    end

    def confirm_init_if_necessary
        brand_path = File.join(FilePath.solara, 'brands')
        # Check if Solara path exists
        if Dir.exist?(brand_path)
            Solara.logger.warn("Solara already initialized! Be aware that reinitializing will delete all current brands!")
            Solara.logger.warn("Don't say I didn't warn you!")
            Solara.logger.warn("Do you want to proceed? (y/n)")
            confirmation = STDIN.gets.chomp.downcase

            unless confirmation == 'y'
                Solara.logger.info("Solara initialization cancelled.")
                exit 1
            end
            FileUtils.rm_rf(brand_path)
        end
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solara-0.2.0 solara/lib/solara_initializer.rb
solara-0.1.0 solara/lib/solara_initializer.rb