#!/usr/bin/env ruby $:.push File.expand_path("../../lib", __FILE__) require 'sigh' require 'commander' require 'credentials_manager/password_manager' require 'credentials_manager/appfile_config' require 'sigh/options' require 'sigh/manager' require 'sigh/local_manage' HighLine.track_eof = false class SighApplication include Commander::Methods def run program :version, Sigh::VERSION program :description, 'CLI for \'sigh\' - Because you would rather spend your time building stuff than fighting provisioning' program :help, 'Author', 'Felix Krause ' program :help, 'Website', 'https://fastlane.tools' program :help, 'GitHub', 'https://github.com/krausefx/sigh' program :help_formatter, :compact FastlaneCore::CommanderGenerator.new.generate(Sigh::Options.available_options) command :renew do |c| c.syntax = 'sigh renew' c.description = 'Renews the certificate (in case it expired) and outputs the path to the generated file' c.action do |args, options| Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__) Sigh::Manager.start end end command :download_all do |c| c.syntax = 'sigh download_all' c.description = 'Downloads all valid provisioning profiles' c.action do |args, options| Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__) Sigh::Manager.download_all end end command :repair do |c| c.syntax = 'sigh repair' c.description = 'Repairs all expired or invalid provisioning profiles' c.action do |args, options| Sigh.config = FastlaneCore::Configuration.create(Sigh::Options.available_options, options.__hash__) require 'sigh/repair' Sigh::Repair.new.repair_all end end command :resign do |c| c.syntax = 'sigh resign' c.description = 'Resigns an existing ipa file with the given provisioning profile' c.option '-i', '--signing_identity STRING', String, 'The signing identity to use. Must match the one defined in the provisioning profile.' c.option '-p', '--provisioning_profile STRING', String, 'The path to the provisioning profile which should be used' c.action do |args, options| Sigh::Resign.new.run(options, args) end end command :manage do |c| c.syntax = 'sigh manage' c.description = 'Manage installed provisioning profiles on your system.' c.option '-e', '--clean_expired', 'Remove all expired provisioning profiles.' c.option '-p', '--clean_pattern STRING', String, 'Remove any provisioning profiles that matches the regular expression.' c.example 'Remove all "iOS Team Provisioning" provisioning profiles', 'sigh manage -p "iOS\ ?Team Provisioning Profile"' c.action do |args, options| Sigh::LocalManage.start(options, args) end end default_command :renew run! end end begin FastlaneCore::UpdateChecker.start_looking_for_update('sigh') SighApplication.new.run ensure FastlaneCore::UpdateChecker.show_update_status('sigh', Sigh::VERSION) end