Class: DeployGate::Commands::Deploy::Build
- Inherits:
-
Object
- Object
- DeployGate::Commands::Deploy::Build
- Defined in:
- lib/deploygate/commands/deploy/build.rb
Class Method Summary collapse
- .create_provisioning(identifier, uuid) ⇒ String
- .input_bundle_identifier ⇒ Object
- .ios(workspaces, options) ⇒ void
- .print_no_target ⇒ Object
- .run(args, options) ⇒ void
- .select_teams(teams, profiles) ⇒ String
Class Method Details
.create_provisioning(identifier, uuid) ⇒ String
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/deploygate/commands/deploy/build.rb', line 109 def create_provisioning(identifier, uuid) puts "\nNo suitable provisioning profile found to export the app.\n\nPlease enter your email and password for Apple Developer Center\nto set up/download provisioning profile automatically so you can\nexport the app without any extra steps.\n\nNote: Your password will be stored to Keychain and never be sent to DeployGate.\n\n" print 'Email: ' username = STDIN.gets.chop begin set_profile = DeployGate::Builds::Ios::SetProfile.new(username, identifier) rescue => e DeployGate::Message::Error.print("Error: Please try login again") raise e end begin if set_profile.app_id_create puts "App ID #{identifier} was created" end rescue => e DeployGate::Message::Error.print("Error: Failed to create App ID") raise e end begin provisioning_profiles = set_profile.create_provisioning(uuid) rescue => e DeployGate::Message::Error.print("Error: Failed to create provisioning profile") raise e end DeployGate::Builds::Ios::Export.select_profile(provisioning_profiles) end |
.input_bundle_identifier ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/deploygate/commands/deploy/build.rb', line 69 def input_bundle_identifier print 'bundle identifier: ' identifier = STDIN.gets.chop if identifier == '' || identifier.nil? puts 'You must input bundle identifier' return input_bundle_identifier end identifier end |
.ios(workspaces, options) ⇒ void
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/deploygate/commands/deploy/build.rb', line 29 def ios(workspaces, ) analyze = DeployGate::Builds::Ios::Analyze.new(workspaces) target_scheme = analyze.scheme begin identifier = analyze.target_bundle_identifier rescue # not found bundle identifier puts 'Please input bundle identifier' puts 'Example: com.example.ios' identifier = input_bundle_identifier end uuid = analyze.target_xcode_setting_provisioning_profile_uuid data = DeployGate::Builds::Ios::Export.find_local_data(identifier, uuid) profiles = data[:profiles] teams = data[:teams] target_provisioning_profile = nil if teams.empty? target_provisioning_profile = create_provisioning(identifier, uuid) elsif teams.count == 1 target_provisioning_profile = DeployGate::Builds::Ios::Export.select_profile(profiles[teams.keys.first]) elsif teams.count >= 2 target_provisioning_profile = select_teams(teams, profiles) end method = DeployGate::Builds::Ios::Export.method(target_provisioning_profile) codesigning_identity = DeployGate::Builds::Ios::Export.codesigning_identity(target_provisioning_profile) begin ipa_path = DeployGate::Builds::Ios.build(analyze, target_scheme, codesigning_identity, method) rescue => e # TODO: build error handling use_xcode_path = `xcode-select -p` DeployGate::Message::Error.print("Current Xcode used to build: #{use_xcode_path} (via xcode-select)") raise e end Push.upload([ipa_path], ) end |
.print_no_target ⇒ Object
150 151 152 153 154 155 156 157 158 |
# File 'lib/deploygate/commands/deploy/build.rb', line 150 def print_no_target = "\nNo deploy target found.\nPlease run on the root directory of iOS project or specify .apk/.ipa file to deploy.\n\n" DeployGate::Message::Warning.print() end |
.run(args, options) ⇒ void
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/deploygate/commands/deploy/build.rb', line 10 def run(args, ) # android/ios build work_dir = args.first if DeployGate::Build.ios?(work_dir) root_path = DeployGate::Builds::Ios.project_root_path(work_dir) workspaces = DeployGate::Builds::Ios.find_workspaces(root_path) ios(workspaces, ) elsif DeployGate::Build.android?(work_dir) # TODO: support android build print_no_target else print_no_target end end |
.select_teams(teams, profiles) ⇒ String
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/deploygate/commands/deploy/build.rb', line 84 def select_teams(teams, profiles) result = nil puts 'Select team:' teams.each_with_index do |team, index| puts "#{index + 1}. #{team[1]} (#{team[0]})" end print '? ' select = STDIN.gets.chop begin team = teams.keys[Integer(select) - 1] team_profiles = profiles[team].first raise 'not select' if team_profiles.nil? result = DeployGate::Builds::Ios::Export.select_profile(profiles[team]) rescue => e puts 'Please select team number' return select_teams(teams, profiles) end result end |