Class: DeployGate::Commands::Deploy::Build
- Inherits:
-
Object
- Object
- DeployGate::Commands::Deploy::Build
- Defined in:
- lib/deploygate/commands/deploy/build.rb
Class Method Summary collapse
- .check_local_certificates ⇒ Object
- .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
.check_local_certificates ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/deploygate/commands/deploy/build.rb', line 161 def check_local_certificates if DeployGate::Builds::Ios::Export.installed_distribution_certificate_ids.count == 0 # not local install certificate DeployGate::Message::Error.print("Error: Not local install distribution certificate") puts <<EOF Not local install iPhone Distribution certificates. Please install certificate. Docs: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html EOF exit end conflicting_certificates = DeployGate::Builds::Ios::Export.installed_distribution_conflicting_certificates if conflicting_certificates.count > 0 DeployGate::Message::Error.print("Error: Conflicting local install certificates") puts <<EOF Conflicting local install certificates. Please uninstall certificates. EOF conflicting_certificates.each do |certificate| puts certificate end puts "" exit end end |
.create_provisioning(identifier, uuid) ⇒ String
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 149 |
# File 'lib/deploygate/commands/deploy/build.rb', line 110 def create_provisioning(identifier, uuid) puts <<EOF No suitable provisioning profile found to export the app. Please enter your email and password for Apple Developer Center to set up/download provisioning profile automatically so you can export the app without any extra steps. Note: Your password will be stored to Keychain and never be sent to DeployGate. EOF 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
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/deploygate/commands/deploy/build.rb', line 70 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
This method returns an undefined value.
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 68 |
# File 'lib/deploygate/commands/deploy/build.rb', line 30 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
151 152 153 154 155 156 157 158 159 |
# File 'lib/deploygate/commands/deploy/build.rb', line 151 def print_no_target = <<EOF No deploy target found. Please run on the root directory of iOS project or specify .apk/.ipa file to deploy. EOF DeployGate::Message::Warning.print() end |
.run(args, options) ⇒ void
This method returns an undefined value.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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) check_local_certificates() 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
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/deploygate/commands/deploy/build.rb', line 85 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 |