lib/ios/iosOption.rb in shellboxCLI-0.1.16 vs lib/ios/iosOption.rb in shellboxCLI-0.2.0

- old
+ new

@@ -1,53 +1,78 @@ require 'ios/module/setup/Template_Configurator' +require 'ios/module/setup/TuistCommands' require 'thor' module App class IOS_CLI < Thor desc "module", "Create a new module to iOS platform" def module - IOS::TemplateConfigurator.new.run - end - - desc "install", "Install scripts and templates in project" - def install - puts "Verificando se existe Homebrew instalado" - brewExists = system('which -s brew') - if brewExists - puts "Atualizando Homebrew" - system('brew update') - else - puts "Instalando Homebrew" - system("/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"") - end - puts "Instalando swiftgen" - system("brew install swiftgen") - - puts "✅ Instalado com sucesso" + IOS::TemplateConfigurator.new.run + end - install_hooks - end - - private - def install_hooks - project_directory = Dir.pwd - install_hooks_path = File.join(project_directory, 'install-hooks.rb') - - unless File.exist?(install_hooks_path) - puts "O arquivo install-hooks.rb não foi encontrado em #{File.join(project_directory)}." - return - end - - puts "Executando install_hooks..." - - Dir.chdir(File.join(project_directory)) do - success = system('ruby install-hooks.rb') - if success - puts "✅ Hooks instalados com sucesso!" - else - puts "❌ Erro ao executar pre-hook" - end - end - end + desc "generate_no_open", "Generate project using Tuist without open the project" + def generate_no_open + IOS::TuistCommands.new.generateExample(false) + end + + desc "generate", "Generate project using Tuist opening the project" + def generate + IOS::TuistCommands.new.generateExample + end + + desc "install", "Install scripts and templates in project" + def install + puts "Verificando se existe Homebrew instalado" + brewExists = system('which -s brew') + if brewExists + puts "Atualizando Homebrew" + system('brew update') + else + puts "Instalando Homebrew" + system("/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"") + end + puts "Instalando swiftgen" + system("brew install swiftgen") + + puts "✅ Swiftgen instalado com sucesso" + + install_tuist + + install_hooks + end + + private + + def install_hooks + hooks_directory = File.expand_path(File.join(File.dirname(__FILE__))) + install_hooks_path = File.join(hooks_directory, 'install-hooks.rb') + + unless File.exist?(install_hooks_path) + puts "O arquivo install-hooks.rb não foi encontrado em #{hooks_directory}." + return + end + + puts "Executando install_hooks..." + + Dir.chdir(hooks_directory) do + success = system('ruby install-hooks.rb') + + if success + puts "✅ Hooks instalados com sucesso!" + else + puts "❌ Erro ao executar pre-hook" + end + end + end + + def install_tuist + tuistExists = system("tuist version") + unless tuistExists + puts "Instalando o Tuist".green + system("brew tap tuist/tuist") + system("brew install tuist") + puts "✅ Tuist instalado com sucesso" + end + end end end