Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #8 from arielo/feature/upload_testflight_dsym

Testlight publish task compresses and uploads dSYM file
  • Loading branch information...
commit 77b30d5d09c39416d037cd4c5351d53a4369b24b 2 parents 6216c6f + b42d5d0
Dave Newman authored July 30, 2012
2  lib/wox/build_environment.rb
@@ -28,6 +28,8 @@ def initialize options
28 28
       if options[:ipa_name]
29 29
         options[:ipa_file] ||= File.join self[:build_dir], 
30 30
                                 [self[:project_name], self[:version], self[:configuration], self[:ipa_name]].join("-") + ".ipa"
  31
+        options[:dsym_file] ||= File.join self[:build_dir], 
  32
+                                [self[:project_name], self[:version], self[:configuration], self[:ipa_name]].join("-") + ".dSYM.zip"
31 33
       end
32 34
     end
33 35
     
2  lib/wox/builder.rb
@@ -9,7 +9,7 @@ def build
9 9
       
10 10
       log_file = File.join environment[:build_dir], "build-#{configuration}.log"
11 11
 
12  
-      run_command "xcodebuild -#{environment[:target_or_scheme]} '#{environment[:target]}' -configuration #{configuration}", :results => log_file
  12
+      run_command "xcodebuild -#{environment[:target_or_scheme]} '#{environment[:target]}' -configuration #{configuration} BUILD_DIR=#{environment[:build_dir]} clean build", :results => log_file
13 13
     end
14 14
   end
15 15
 end
18  lib/wox/test_flight.rb
... ...
@@ -1,4 +1,6 @@
1 1
 require 'wox/helpers/number_helper'
  2
+require 'zip/zip'
  3
+require 'zip/zipfilesystem'
2 4
 
3 5
 module Wox
4 6
   class TestFlight < Task
@@ -12,6 +14,7 @@ def arg_to_string arg
12 14
     def api_args
13 15
       args = { 
14 16
         :file => "@#{environment[:ipa_file]}",
  17
+        :dsym => "@#{environment[:dsym_file]}",
15 18
         :api_token => environment[:api_token],
16 19
         :team_token => environment[:team_token],
17 20
         :notes => environment[:notes]
@@ -28,7 +31,7 @@ def curl_arg_string
28 31
     
29 32
     def publish
30 33
       ipa_file = environment[:ipa_file]
31  
-      
  34
+      compress_dsym
32 35
       puts "Publishing to TestFlight"
33 36
       puts "File: #{ipa_file} (#{bytes_to_human_size File.size?(ipa_file)})"
34 37
       puts "Accessible To: #{environment[:distribution_lists].join(", ")}" if environment.has_entry? :distribution_lists
@@ -38,5 +41,18 @@ def publish
38 41
       run_command "curl --progress-bar #{curl_arg_string} http://testflightapp.com/api/builds.json", :results => log_file
39 42
     end
40 43
 
  44
+    def compress_dsym
  45
+      configuration, sdk, ipa_file, build_dir = environment[:configuration], environment[:sdk], environment[:ipa_file], environment[:build_dir]
  46
+      dsym_file = File.join build_dir, "#{configuration}-#{sdk}", environment[:app_file]
  47
+      dsym_file += ".app.dSYM"
  48
+      archive =  environment[:dsym_file]
  49
+      puts "Compressing dSYM: #{archive}"
  50
+      FileUtils.rm archive, :force=>true
  51
+      Zip::ZipFile.open(archive, 'w') do |zipfile|
  52
+        Dir["#{dsym_file}/**/**"].each do |file|
  53
+          zipfile.add(file.sub(File.dirname(dsym_file)+'/',''),file)
  54
+        end
  55
+      end
  56
+    end
41 57
   end
42 58
 end
1  wox.gemspec
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16 16
 
17 17
   s.add_dependency "thor"
18 18
   s.add_dependency "plist"
  19
+  s.add_dependency "rubyzip"
19 20
   
20 21
   s.add_development_dependency "rspec"
21 22
 

0 notes on commit 77b30d5

Please sign in to comment.
Something went wrong with that request. Please try again.