fastlane 2.28.9 → 2.29.0.beta.20170421010107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/deliver/lib/assets/summary.html.erb +0 -3
  4. data/deliver/lib/deliver/options.rb +2 -2
  5. data/deliver/lib/deliver/upload_metadata.rb +1 -2
  6. data/fastlane/README.md +2 -6
  7. data/fastlane/lib/fastlane/actions/artifactory.rb +1 -17
  8. data/fastlane/lib/fastlane/actions/crashlytics.rb +1 -1
  9. data/fastlane/lib/fastlane/actions/download_dsyms.rb +1 -1
  10. data/fastlane/lib/fastlane/actions/ensure_git_status_clean.rb +3 -17
  11. data/fastlane/lib/fastlane/actions/hockey.rb +1 -1
  12. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +3 -3
  13. data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +10 -16
  14. data/fastlane/lib/fastlane/version.rb +1 -1
  15. data/fastlane_core/lib/fastlane_core/build_watcher.rb +21 -39
  16. data/fastlane_core/lib/fastlane_core/helper.rb +5 -7
  17. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +1 -4
  18. data/fastlane_core/lib/fastlane_core/print_table.rb +9 -4
  19. data/fastlane_core/lib/fastlane_core/project.rb +4 -16
  20. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +7 -11
  21. data/fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb +2 -2
  22. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +0 -2
  23. data/fastlane_core/lib/fastlane_core/ui/ui.rb +2 -0
  24. data/gym/lib/gym/generators/build_command_generator.rb +0 -2
  25. data/gym/lib/gym/options.rb +0 -10
  26. data/gym/lib/gym/runner.rb +0 -2
  27. data/gym/lib/gym/xcode.rb +3 -1
  28. data/pilot/lib/pilot/build_manager.rb +17 -44
  29. data/pilot/lib/pilot/commands_generator.rb +1 -2
  30. data/pilot/lib/pilot/options.rb +2 -3
  31. data/pilot/lib/pilot/tester_manager.rb +44 -58
  32. data/snapshot/lib/assets/SnapshotHelper.swift +1 -1
  33. data/spaceship/lib/spaceship/spaceauth_runner.rb +1 -1
  34. data/spaceship/lib/spaceship/test_flight.rb +0 -2
  35. data/spaceship/lib/spaceship/test_flight/base.rb +0 -12
  36. data/spaceship/lib/spaceship/test_flight/build.rb +8 -22
  37. data/spaceship/lib/spaceship/test_flight/client.rb +40 -121
  38. data/spaceship/lib/spaceship/test_flight/group.rb +7 -49
  39. data/spaceship/lib/spaceship/test_flight/test_info.rb +0 -4
  40. data/spaceship/lib/spaceship/tunes/app_ratings.rb +2 -74
  41. data/spaceship/lib/spaceship/tunes/app_status.rb +2 -4
  42. data/spaceship/lib/spaceship/tunes/application.rb +1 -1
  43. data/spaceship/lib/spaceship/tunes/iap_detail.rb +11 -48
  44. data/spaceship/lib/spaceship/tunes/iap_family_details.rb +5 -24
  45. data/spaceship/lib/spaceship/tunes/tunes_client.rb +3 -14
  46. data/supply/lib/supply/setup.rb +2 -2
  47. metadata +16 -33
  48. data/spaceship/lib/spaceship/test_flight/app_test_info.rb +0 -27
  49. data/spaceship/lib/spaceship/test_flight/tester.rb +0 -34
@@ -103,22 +103,18 @@ module Commander
103
103
  FastlaneCore::UI.important("pilot crashed")
104
104
  FastlaneCore::UI.important("-------------")
105
105
  FastlaneCore::UI.error("Unfortunately the TestFlight update from 11th April 2017 changed")
106
- FastlaneCore::UI.error("the way Testers, Groups, and Builds are managed on iTunesConnect.")
107
- FastlaneCore::UI.error("We have already fixed a number of features including submitting")
108
- FastlaneCore::UI.error("builds for testing, adding and removing testers from groups, and")
109
- FastlaneCore::UI.error("waiting for builds to process.")
106
+ FastlaneCore::UI.error("the way Testers, Groups and Builds are managed on iTunes connect.")
107
+ FastlaneCore::UI.error("We're busy working on migrating _pilot_ to work with the new system")
108
+ FastlaneCore::UI.error("however it requires lots of changes and refactors from our side")
109
+ FastlaneCore::UI.error("to ensure that everything keeps working for you as it did before")
110
110
  FastlaneCore::UI.error("")
111
- FastlaneCore::UI.error("Please open an issue on https://github.com/fastlane/fastlane/issues")
112
- FastlaneCore::UI.error("if you believe this failure is the result of a bug in _pilot_ and we")
113
- FastlaneCore::UI.error("will be happy to look into this further.")
114
- FastlaneCore::UI.error("")
115
- FastlaneCore::UI.error("Please stay tuned for more updates from _fastlane_ as we fix more issues!")
111
+ FastlaneCore::UI.error("Please follow the WIP pull request on GitHub to stay up to date: https://github.com/fastlane/fastlane/pull/8871")
116
112
  FastlaneCore::UI.error("")
113
+ FastlaneCore::UI.error("Original error message: #{e}")
117
114
  if FastlaneCore::Globals.verbose?
118
115
  raise e # on verbose mode, we want to show the original stack trace
119
116
  else
120
- FastlaneCore::UI.error("Original error message:")
121
- FastlaneCore::UI.user_error!(e.message)
117
+ FastlaneCore::UI.user_error!("pilot doesn't work with the latest TestFlight yet, we're busy working on upgrading it!")
122
118
  end
123
119
  end
124
120
 
@@ -45,8 +45,8 @@ module Fastlane
45
45
  status = (resolved ? issue.state.green : issue.state.red)
46
46
 
47
47
  puts "➡️ #{issue.title.yellow}"
48
- puts " #{issue.html_url} [#{status}] #{issue.comments} 💬"
49
- puts " #{Time.parse(issue.updated_at).to_pretty}"
48
+ puts " #{issue.html_url} [#{status}] #{issue.comments} 💬"
49
+ puts " #{Time.parse(issue.updated_at).to_pretty}"
50
50
  puts ""
51
51
  end
52
52
 
@@ -20,8 +20,6 @@ module FastlaneCore
20
20
  "#{format_string(datetime, severity)}#{msg}\n"
21
21
  end
22
22
 
23
- require 'fastlane_core/ui/disable_colors' if FastlaneCore::Helper.colors_disabled?
24
-
25
23
  @log
26
24
  end
27
25
 
@@ -22,3 +22,5 @@ require 'fastlane_core/ui/interface'
22
22
  Dir[File.expand_path('implementations/*.rb', File.dirname(__FILE__))].each do |file|
23
23
  require file
24
24
  end
25
+
26
+ require 'fastlane_core/ui/disable_colors' if FastlaneCore::Helper.colors_disabled?
@@ -41,7 +41,6 @@ module Gym
41
41
  options << "-derivedDataPath '#{config[:derived_data_path]}'" if config[:derived_data_path]
42
42
  options << "-resultBundlePath '#{result_bundle_path}'" if config[:result_bundle]
43
43
  options << config[:xcargs] if config[:xcargs]
44
- options << "OTHER_SWIFT_FLAGS=\"\$(inherited) -Xfrontend -debug-time-function-bodies\"" if config[:analyze_build_time]
45
44
 
46
45
  options
47
46
  end
@@ -65,7 +64,6 @@ module Gym
65
64
  def pipe
66
65
  pipe = []
67
66
  pipe << "| tee #{xcodebuild_log_path.shellescape}"
68
- pipe << "| grep .[0-9]ms | grep -v ^0.[0-9]ms | sort -nr > culprits.txt" if Gym.config[:analyze_build_time]
69
67
  unless Gym.config[:disable_xcpretty]
70
68
  formatter = Gym.config[:xcpretty_formatter]
71
69
  pipe << "| xcpretty"
@@ -100,11 +100,6 @@ module Gym
100
100
  env_name: "GYM_CODE_SIGNING_IDENTITY",
101
101
  description: "The name of the code signing identity to use. It has to match the name exactly. e.g. 'iPhone Distribution: SunApps GmbH'",
102
102
  optional: true),
103
- FastlaneCore::ConfigItem.new(key: :skip_package_ipa,
104
- env_name: "GYM_SKIP_PACKAGE_IPA",
105
- description: "Should we skip packaging the ipa?",
106
- is_string: false,
107
- default_value: false),
108
103
  FastlaneCore::ConfigItem.new(key: :include_symbols,
109
104
  short_option: "-m",
110
105
  env_name: "GYM_INCLUDE_SYMBOLS",
@@ -277,11 +272,6 @@ module Gym
277
272
  verify_block: proc do |value|
278
273
  UI.user_error!("Report output location not found at path '#{File.expand_path(value)}'") unless File.exist?(value)
279
274
  end),
280
- FastlaneCore::ConfigItem.new(key: :analyze_build_time,
281
- env_name: "GYM_ANALYZE_BUILD_TIME",
282
- description: "Analyze the project build time and store the output in culprits.txt file",
283
- optional: true,
284
- is_string: false),
285
275
  FastlaneCore::ConfigItem.new(key: :xcpretty_utf,
286
276
  env_name: "XCPRETTY_UTF",
287
277
  description: "Have xcpretty use unicode encoding when reporting builds",
@@ -16,8 +16,6 @@ module Gym
16
16
 
17
17
  if Gym.project.ios? || Gym.project.tvos?
18
18
  fix_generic_archive # See https://github.com/fastlane/fastlane/pull/4325
19
- return BuildCommandGenerator.archive_path if Gym.config[:skip_package_ipa]
20
-
21
19
  package_app
22
20
  fix_package
23
21
  compress_and_move_dsym
data/gym/lib/gym/xcode.rb CHANGED
@@ -18,7 +18,9 @@ module Gym
18
18
  end
19
19
 
20
20
  def legacy_api_deprecated?
21
- FastlaneCore::Helper.xcode_at_least?('8.3')
21
+ UI.user_error!("Unable to locate Xcode. Please make sure to have Xcode installed on your machine") if xcode_version.nil?
22
+ v = xcode_version
23
+ Gem::Version.new(v) >= Gem::Version.new('8.3.0')
22
24
  end
23
25
  end
24
26
  end
@@ -37,38 +37,19 @@ module Pilot
37
37
  UI.message("If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option")
38
38
  latest_build = FastlaneCore::BuildWatcher.wait_for_build_processing_to_be_complete(app_id: app.apple_id, platform: platform)
39
39
 
40
- distribute(options, build: latest_build)
40
+ distribute(options, latest_build)
41
41
  end
42
42
 
43
- def distribute(options, build: nil)
43
+ def distribute(options, build)
44
44
  start(options)
45
45
  if config[:apple_id].to_s.length == 0 and config[:app_identifier].to_s.length == 0
46
46
  config[:app_identifier] = UI.input("App Identifier: ")
47
47
  end
48
48
 
49
- build ||= Spaceship::TestFlight::Build.latest(app_id: app.apple_id, platform: fetch_app_platform)
50
- if build.nil?
51
- UI.user_error!("No build to distribute!")
52
- end
53
-
54
- if should_update_app_test_information?(options)
55
- app_test_info = Spaceship::TestFlight::AppTestInfo.find(app_id: build.app_id)
56
- app_test_info.test_info.feedback_email = options[:beta_app_feedback_email] if options[:beta_app_feedback_email]
57
- app_test_info.test_info.description = options[:beta_app_description] if options[:beta_app_description]
58
- begin
59
- app_test_info.save_for_app!(app_id: build.app_id)
60
- UI.success "Successfully set the beta_app_feedback_email and/or beta_app_description"
61
- rescue => ex
62
- UI.user_error!("Could not set beta_app_feedback_email and/or beta_app_description: #{ex}")
63
- end
64
- end
65
-
66
- if should_update_build_information?(options)
67
- begin
68
- build.update_build_information!(whats_new: options[:changelog])
69
- UI.success "Successfully set the changelog for build"
70
- rescue => ex
71
- UI.user_error!("Could not set changelog: #{ex}")
49
+ unless config[:update_build_info_on_upload]
50
+ if should_update_build_information(options)
51
+ build.update_build_information!(whats_new: options[:changelog], description: options[:beta_app_description], feedback_email: options[:beta_app_feedback_email])
52
+ UI.success "Successfully set the changelog and/or description for build"
72
53
  end
73
54
  end
74
55
 
@@ -120,12 +101,8 @@ module Pilot
120
101
  return row
121
102
  end
122
103
 
123
- def should_update_build_information?(options)
124
- options[:changelog].to_s.length > 0
125
- end
126
-
127
- def should_update_app_test_information?(options)
128
- options[:beta_app_description].to_s.length > 0 || options[:beta_app_feedback_email].to_s.length > 0
104
+ def should_update_build_information(options)
105
+ options[:changelog].to_s.length > 0 or options[:beta_app_description].to_s.length > 0 or options[:beta_app_feedback_email].to_s.length > 0
129
106
  end
130
107
 
131
108
  def distribute_build(uploaded_build, options)
@@ -133,10 +110,10 @@ module Pilot
133
110
 
134
111
  # This is where we could add a check to see if encryption is required and has been updated
135
112
  uploaded_build.export_compliance.encryption_updated = false
113
+ uploaded_build.beta_review_info.demo_account_required = false
114
+ uploaded_build.submit_for_testflight_review!
136
115
 
137
116
  if options[:distribute_external]
138
- uploaded_build.beta_review_info.demo_account_required = false
139
- uploaded_build.submit_for_testflight_review!
140
117
  external_group = Spaceship::TestFlight::Group.default_external_group(app_id: uploaded_build.app_id)
141
118
  uploaded_build.add_group!(external_group) unless external_group.nil?
142
119
 
@@ -144,18 +121,14 @@ module Pilot
144
121
  UI.user_error!("You must specify at least one group using the `:groups` option to distribute externally")
145
122
  end
146
123
 
147
- if options[:groups]
148
- groups = Spaceship::TestFlight::Group.filter_groups(app_id: uploaded_build.app_id) do |group|
149
- options[:groups].include?(group.name)
150
- end
151
- groups.each do |group|
152
- uploaded_build.add_group!(group)
153
- end
124
+ end
125
+
126
+ if options[:groups]
127
+ groups = Group.filter_groups(app_id: uploaded_build.app_id) do |group|
128
+ options[:groups].include?(group.name)
154
129
  end
155
- else # distribute internally
156
- # in case any changes to export_compliance are required
157
- if uploaded_build.export_compliance_missing?
158
- uploaded_build.save!
130
+ groups.each do |group|
131
+ uploaded_build.add_group!(group)
159
132
  end
160
133
  end
161
134
 
@@ -29,8 +29,7 @@ module Pilot
29
29
  begin
30
30
  mgr.public_send(action, config)
31
31
  rescue => ex
32
- # no need to show the email address in the message if only one specified
33
- message = (args.count > 1) ? "[#{address}]: #{ex}" : ex
32
+ message = "[#{address}]: #{ex}"
34
33
  failures << message
35
34
  UI.error(message)
36
35
  end
@@ -32,7 +32,7 @@ module Pilot
32
32
  optional: true,
33
33
  env_name: "PILOT_IPA",
34
34
  description: "Path to the ipa file to upload",
35
- default_value: Dir["*.ipa"].sort_by { |x| File.mtime(x) }.last,
35
+ default_value: Dir["*.ipa"].first,
36
36
  verify_block: proc do |value|
37
37
  UI.user_error!("Could not find ipa file at path '#{value}'") unless File.exist? value
38
38
  UI.user_error!("'#{value}' doesn't seem to be an ipa file") unless value.end_with? ".ipa"
@@ -65,10 +65,9 @@ module Pilot
65
65
  is_string: false,
66
66
  default_value: false),
67
67
  FastlaneCore::ConfigItem.new(key: :update_build_info_on_upload,
68
- deprecated: true,
69
68
  short_option: "-x",
70
69
  env_name: "PILOT_UPDATE_BUILD_INFO_ON_UPLOAD",
71
- description: "Update build info immediately after validation. This is deprecated and will be removed in a future release. iTunesConnect no longer supports setting build info until after build processing has completed, which is when build info is updated by default",
70
+ description: "Update build info immediately after validation. This will set the changelog even if PILOT_SKIP_SUBMISSION is set, but will have no effect if PILOT_SKIP_WAITING_FOR_BUILD_PROCESSING is set",
72
71
  is_string: false,
73
72
  default_value: false),
74
73
  FastlaneCore::ConfigItem.new(key: :apple_id,
@@ -7,21 +7,38 @@ module Pilot
7
7
  def add_tester(options)
8
8
  start(options)
9
9
 
10
- app = find_app(app_filter: config[:apple_id] || config[:app_identifier])
11
- UI.user_error!("You must provide either a Apple ID for the app (with the `:apple_id` option) or app identifier (with the `:app_identifier` option)") unless app
12
-
13
- tester = find_or_create_tester(email: config[:email], first_name: config[:first_name], last_name: config[:last_name])
10
+ if config[:groups]
11
+ UI.important("Currently pilot doesn't support groups yet, we're working on restoring that functionality")
12
+ config[:groups] = nil
13
+ end
14
14
 
15
15
  begin
16
- groups = Spaceship::TestFlight::Group.add_tester_to_groups!(tester: tester, app: app, groups: config[:groups])
17
- if tester.kind_of?(Spaceship::Tunes::Tester::Internal)
18
- UI.success("Successfully added tester to app #{app.name}")
16
+ tester = Spaceship::Tunes::Tester::Internal.find(config[:email])
17
+ tester ||= Spaceship::Tunes::Tester::External.find(config[:email])
18
+
19
+ if tester
20
+ UI.success("Existing tester #{tester.email}")
19
21
  else
20
- group_names = groups.map(&:name).join(", ")
21
- UI.success("Successfully added tester to app #{app.name} in group(s) #{group_names}")
22
+ tester = Spaceship::Tunes::Tester::External.create!(email: config[:email],
23
+ first_name: config[:first_name],
24
+ last_name: config[:last_name])
25
+ UI.success("Successfully invited tester: #{tester.email}")
26
+ end
27
+
28
+ app_filter = (config[:apple_id] || config[:app_identifier])
29
+ if app_filter
30
+ begin
31
+ app = Spaceship::Application.find(app_filter)
32
+ UI.user_error!("Couldn't find app with '#{app_filter}'") unless app
33
+ app.default_external_group.add_tester!(tester)
34
+ UI.success("Successfully added tester to app #{app_filter}")
35
+ rescue => ex
36
+ UI.error("Could not add #{tester.email} to app: #{ex}")
37
+ raise ex
38
+ end
22
39
  end
23
40
  rescue => ex
24
- UI.error("Could not add #{tester.email} to app: #{app.name}")
41
+ UI.error("Could not create tester #{config[:email]}")
25
42
  raise ex
26
43
  end
27
44
  end
@@ -43,29 +60,25 @@ module Pilot
43
60
 
44
61
  tester = Spaceship::Tunes::Tester::External.find(config[:email])
45
62
  tester ||= Spaceship::Tunes::Tester::Internal.find(config[:email])
46
- UI.user_error!("Tester not found: #{config[:email]}") if tester.nil?
47
-
48
- app = find_app(app_filter: config[:apple_id] || config[:app_identifier])
49
- unless app
50
- tester.delete!
51
- UI.success("Successfully removed tester #{tester.email}")
52
- end
53
63
 
54
- begin
55
- # If no groups are passed to options, remove the tester from the app-level,
56
- # otherwise remove the tester from the groups specified.
57
- if config[:groups].nil? && tester.kind_of?(Spaceship::Tunes::Tester::External)
58
- test_flight_tester = Spaceship::TestFlight::Tester.find(app_id: app.apple_id, email: tester.email)
59
- test_flight_tester.remove_from_app!(app_id: app.apple_id)
60
- UI.success("Successfully removed tester, #{test_flight_tester.email}, from app: #{app.name}")
64
+ if tester
65
+ app_filter = (config[:apple_id] || config[:app_identifier])
66
+ if app_filter
67
+ begin
68
+ app = Spaceship::Application.find(app_filter)
69
+ UI.user_error!("Couldn't find app with '#{app_filter}'") unless app
70
+ app.default_external_group.remove_tester!(tester)
71
+ UI.success("Successfully removed tester #{tester.email} from app #{app_filter}")
72
+ rescue => ex
73
+ UI.error("Could not remove #{tester.email} from app: #{ex}")
74
+ raise ex
75
+ end
61
76
  else
62
- groups = Spaceship::TestFlight::Group.remove_tester_from_groups!(tester: tester, app: app, groups: config[:groups])
63
- group_names = groups.map(&:name).join(", ")
64
- UI.success("Successfully removed tester #{tester.email} from app #{app.name} in group(s) #{group_names}")
77
+ tester.delete!
78
+ UI.success("Successfully removed tester #{tester.email}")
65
79
  end
66
- rescue => ex
67
- UI.error("Could not remove #{tester.email} from app: #{ex}")
68
- raise ex
80
+ else
81
+ UI.error("Tester not found: #{config[:email]}")
69
82
  end
70
83
  end
71
84
 
@@ -80,34 +93,7 @@ module Pilot
80
93
  end
81
94
  end
82
95
 
83
- private
84
-
85
- def find_app(app_filter: nil)
86
- if app_filter
87
- app = Spaceship::Application.find(app_filter)
88
- UI.user_error!("Could not find an app by #{app_filter}") unless app
89
- return app
90
- end
91
- nil
92
- end
93
-
94
- def find_or_create_tester(email: nil, first_name: nil, last_name: nil)
95
- tester = Spaceship::Tunes::Tester::Internal.find(config[:email])
96
- tester ||= Spaceship::Tunes::Tester::External.find(config[:email])
97
-
98
- if tester
99
- UI.success("Existing tester #{tester.email}")
100
- else
101
- tester = Spaceship::Tunes::Tester::External.create!(email: config[:email],
102
- first_name: config[:first_name],
103
- last_name: config[:last_name])
104
- UI.success("Successfully added tester: #{tester.email} to your account")
105
- end
106
- return tester
107
- rescue => ex
108
- UI.error("Could not create tester #{config[:email]}")
109
- raise ex
110
- end
96
+ # private
111
97
 
112
98
  def list_testers_by_app(app_filter)
113
99
  app = Spaceship::Application.find(app_filter)
@@ -145,7 +145,7 @@ open class Snapshot: NSObject {
145
145
  print("Can't prepare environment. Simulator home location is inaccessible. Does \(simulatorHostHome) exist?")
146
146
  return nil
147
147
  }
148
- homeDir = URL(fileURLWithPath: homeDirUrl.path)
148
+ homeDir = homeDirUrl
149
149
  #endif
150
150
  return homeDir.appendingPathComponent("Library/Caches/tools.fastlane")
151
151
  }
@@ -22,7 +22,7 @@ module Spaceship
22
22
  puts "This could be an issue with iTunes Connect,".yellow
23
23
  puts "Please try unsetting the FASTLANE_SESSION environment variable".yellow
24
24
  puts "and re-run `fastlane spaceauth`".yellow
25
- raise "Problem connecting to iTunes Connect"
25
+ UI.crash!("Problem connecting to iTunes Connect")
26
26
  end
27
27
 
28
28
  itc_cookie_content = Spaceship::Tunes.client.store_cookie
@@ -1,11 +1,9 @@
1
1
 
2
2
  require 'spaceship/test_flight/client'
3
3
  require 'spaceship/test_flight/base'
4
- require 'spaceship/test_flight/app_test_info'
5
4
  require 'spaceship/test_flight/build'
6
5
  require 'spaceship/test_flight/build_trains'
7
6
  require 'spaceship/test_flight/beta_review_info'
8
7
  require 'spaceship/test_flight/export_compliance'
9
8
  require 'spaceship/test_flight/test_info'
10
9
  require 'spaceship/test_flight/group'
11
- require 'spaceship/test_flight/tester'
@@ -4,18 +4,6 @@ module Spaceship::TestFlight
4
4
  @client ||= Client.client_with_authorization_from(Spaceship::Tunes.client)
5
5
  end
6
6
 
7
- ##
8
- # Have subclasses inherit the client from their superclass
9
- #
10
- # Essentially, we are making a class-inheritable-accessor as described here:
11
- # https://apidock.com/rails/v4.2.7/Class/class_attribute
12
- def self.inherited(subclass)
13
- this_class = self
14
- subclass.define_singleton_method(:client) do
15
- this_class.client
16
- end
17
- end
18
-
19
7
  def to_json
20
8
  raw_data.to_json
21
9
  end
@@ -67,17 +67,16 @@ module Spaceship::TestFlight
67
67
  BUILD_STATES = {
68
68
  processing: 'testflight.build.state.processing',
69
69
  active: 'testflight.build.state.testing.active',
70
- ready_to_submit: 'testflight.build.state.submit.ready',
71
- ready_to_test: 'testflight.build.state.testing.ready',
70
+ ready: 'testflight.build.state.submit.ready',
72
71
  export_compliance_missing: 'testflight.build.state.export.compliance.missing'
73
72
  }
74
73
 
75
- # Find a Build by `build_id`.
74
+ # Find a Build by `build_id`. Returns `nil` if can't find it.
76
75
  #
77
76
  # @return (Spaceship::TestFlight::Build)
78
77
  def self.find(app_id: nil, build_id: nil)
79
78
  attrs = client.get_build(app_id: app_id, build_id: build_id)
80
- self.new(attrs)
79
+ self.new(attrs) if attrs
81
80
  end
82
81
 
83
82
  def self.all(app_id: nil, platform: nil)
@@ -105,17 +104,13 @@ module Spaceship::TestFlight
105
104
  #
106
105
  # Note: this will overwrite any non-saved changes to the object
107
106
  #
108
- # @return (Spaceship::Base::DataHash) the raw_data of the build.
107
+ # @return (Spaceceship::Base::DataHash) the raw_data of the build.
109
108
  def reload
110
109
  self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data
111
110
  end
112
111
 
113
112
  def ready_to_submit?
114
- external_state == BUILD_STATES[:ready_to_submit]
115
- end
116
-
117
- def ready_to_test?
118
- external_state == BUILD_STATES[:ready_to_test]
113
+ external_state == BUILD_STATES[:ready]
119
114
  end
120
115
 
121
116
  def active?
@@ -126,14 +121,6 @@ module Spaceship::TestFlight
126
121
  external_state == BUILD_STATES[:processing]
127
122
  end
128
123
 
129
- def export_compliance_missing?
130
- external_state == BUILD_STATES[:export_compliance_missing]
131
- end
132
-
133
- def processed?
134
- active? || ready_to_submit? || export_compliance_missing?
135
- end
136
-
137
124
  # Getting builds from BuildTrains only gets a partial Build object
138
125
  # We are then requesting the full build from iTC when we need to access
139
126
  # any of the variables below, because they are not inlcuded in the partial Build objects
@@ -168,14 +155,13 @@ module Spaceship::TestFlight
168
155
  end
169
156
 
170
157
  def update_build_information!(description: nil, feedback_email: nil, whats_new: nil)
171
- test_info.description = description if description
172
- test_info.feedback_email = feedback_email if feedback_email
173
- test_info.whats_new = whats_new if whats_new
158
+ test_info.description = description
159
+ test_info.feedback_email = feedback_email
160
+ test_info.whats_new = whats_new
174
161
  save!
175
162
  end
176
163
 
177
164
  def submit_for_testflight_review!
178
- return if ready_to_test?
179
165
  client.post_for_testflight_review(app_id: app_id, build_id: id, build: self)
180
166
  end
181
167