./lib/shenzhen/plugins/testflight.rb in shenzhen-0.0.3 vs ./lib/shenzhen/plugins/testflight.rb in shenzhen-0.1.0

- old
+ new

@@ -23,10 +23,14 @@ :api_token => @api_token, :team_token => @team_token, :file => Faraday::UploadIO.new(ipa, 'application/octet-stream') }) + if dsym_filename = options.delete(:dsym_filename) + options[:dsym] = Faraday::UploadIO.new(dsym_filename, 'application/octet-stream') + end + @connection.post("/api/builds.json", options).on_complete do |env| yield env[:status], env[:body] if block_given? end end end @@ -36,10 +40,11 @@ command :'distribute:testflight' do |c| c.syntax = "ipa distribute:testflight [options]" c.summary = "Distribute an .ipa file over testflight" c.description = "" c.option '-f', '--file FILE', ".ipa file for the build" + c.option '-d', '--dsym FILE', "zipped .dsym package for the build" c.option '-a', '--api_token TOKEN', "API Token. Available at https://testflightapp.com/account/#api-token" c.option '-T', '--team_token TOKEN', "Team Token. Available at https://testflightapp.com/dashboard/team/edit/" c.option '-m', '--notes NOTES', "Release notes for the build" c.option '-l', '--lists LISTS', "Comma separated distribution list names which will receive access to the build" c.option '--notify', "Notify permitted teammates to install the build" @@ -48,10 +53,13 @@ c.action do |args, options| determine_file! unless @file = options.file say_error "Missing or unspecified .ipa file" and abort unless @file and File.exist?(@file) + determine_dsym! unless @dsym = options.dsym + say_error "Specified dSYM.zip file doesn't exist" if @dsym and !File.exist?(@dsym) + determine_api_token! unless @api_token = options.api_token say_error "Missing API Token" and abort unless @api_token determine_team_token! unless @team_token = options.team_token @@ -59,10 +67,11 @@ say_error "Missing release notes" and abort unless @notes parameters = {} parameters[:file] = @file parameters[:notes] = @notes + parameters[:dsym_filename] = @dsym if @dsym parameters[:notify] = "true" if options.notify parameters[:replace] = "true" if options.replace parameters[:distribution_lists] = options.lists if options.lists client = Shenzhen::Plugins::TestFlight::Client.new(@api_token, @team_token) @@ -90,9 +99,19 @@ @file ||= case files.length when 0 then nil when 1 then files.first else @file = choose "Select an .ipa File:", *files + end + end + + def determine_dsym! + dsym_files = Dir['*.dSYM.zip'] + @dsym ||= case dsym_files.length + when 0 then nil + when 1 then dsym_files.first + else + @dsym = choose "Select a .dSYM.zip file:", *dsym_files end end def determine_notes! placeholder = %{What's new in this release: }