Class: Pod::Command::Submit
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Submit
- Defined in:
- lib/pod/command/submit.rb
Instance Method Summary collapse
- #execute(command) ⇒ Object
- #find_best_configuration(target) ⇒ Object
-
#initialize(argv) ⇒ Submit
constructor
A new instance of Submit.
- #run ⇒ Object
- #tag_release ⇒ Object
Constructor Details
#initialize(argv) ⇒ Submit
Returns a new instance of Submit.
20 21 22 23 |
# File 'lib/pod/command/submit.rb', line 20 def initialize(argv) @target_name = argv.shift_argument unless argv.arguments.empty? super end |
Instance Method Details
#execute(command) ⇒ Object
11 12 13 14 |
# File 'lib/pod/command/submit.rb', line 11 def execute(command) puts "#{"==>".magenta} #{command}" abort unless system(command) end |
#find_best_configuration(target) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/pod/command/submit.rb', line 25 def find_best_configuration(target) identifiers = target.build_configurations.map { |c| c.build_settings["PROVISIONING_PROFILE"] } profiles = identifiers.map { |uuid| CocoapodsSubmit::ProvisioningProfile.new uuid } abort "No build configuration for iTunes Connect releases found." if profiles.count == 0 ranks = profiles.map &:rank return target.build_configurations[ranks.each_with_index.max[1]] end |
#run ⇒ Object
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 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/pod/command/submit.rb', line 42 def run workspaces = Dir.entries(".").select { |s| s.end_with? ".xcworkspace" } abort "pod submit only supports one .xcworkspace in the current directory" unless workspaces.count == 1 workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspaces[0]) project = Xcodeproj::Project.open workspace.file_references.first.path schemes = Xcodeproj::Project.schemes project.path targets = project.targets.select { |t| t.product_type == "com.apple.product-type.application" } if @target_name targets = targets.select { |t| t.name == @target_name } abort "Target #{@target_name} not found" if targets.count == 0 end if targets.count > 1 puts "Could not auto determine the target to submit. Please specify your target like:" puts "" for target in targets puts " * pod submit #{target.name}" end puts "" abort end @target = targets.first @target_name = @target.name configuration = find_best_configuration @target abort "No build configuration found for target #{@target}." unless configuration ipa_builder = CocoapodsSubmit::IPABuilder.new workspaces[0], targets.first, configuration path = ipa_builder.build_ipa uploader = CocoapodsSubmit::IPAUploader.new path, ipa_builder.bundle_identifier uploader.upload tag_release end |
#tag_release ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/pod/command/submit.rb', line 34 def tag_release time = Time.now.strftime "%Y%m%d%H%m%S" execute "git add ." execute "git commit -am 'Submitted to iTunes Connect submit-#{time}-#{@target.name}-#{info_plist["CFBundleShortVersionString"]}-#{info_plist["CFBundleVersion"]}'" execute "git tag submit-#{time}-#{@target.name}-#{info_plist["CFBundleShortVersionString"]}-#{info_plist["CFBundleVersion"]}" execute "git push && git push --tags" end |