fastlane 2.14.2 → 2.15.0.beta.20170213032052

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/cert/lib/cert/commands_generator.rb +1 -1
  3. data/cert/lib/cert/runner.rb +1 -1
  4. data/credentials_manager/lib/credentials_manager/appfile_config.rb +1 -1
  5. data/deliver/lib/deliver/commands_generator.rb +1 -1
  6. data/deliver/lib/deliver/runner.rb +2 -2
  7. data/deliver/lib/deliver/setup.rb +4 -2
  8. data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
  9. data/fastlane/lib/fastlane/actions/add_extra_platforms.rb +45 -0
  10. data/fastlane/lib/fastlane/actions/changelog_from_git_commits.rb +13 -7
  11. data/fastlane/lib/fastlane/actions/crashlytics.rb +2 -2
  12. data/fastlane/lib/fastlane/actions/ensure_no_debug_code.rb +13 -1
  13. data/fastlane/lib/fastlane/actions/git_tag_exists.rb +1 -1
  14. data/fastlane/lib/fastlane/actions/hockey.rb +117 -14
  15. data/fastlane/lib/fastlane/actions/slack.rb +1 -1
  16. data/fastlane/lib/fastlane/cli_tools_distributor.rb +4 -0
  17. data/fastlane/lib/fastlane/commands_generator.rb +12 -12
  18. data/fastlane/lib/fastlane/documentation/docs_generator.rb +1 -1
  19. data/fastlane/lib/fastlane/environment_printer.rb +2 -2
  20. data/fastlane/lib/fastlane/fastlane_require.rb +1 -1
  21. data/fastlane/lib/fastlane/helper/git_helper.rb +22 -15
  22. data/fastlane/lib/fastlane/lane_manager.rb +2 -2
  23. data/fastlane/lib/fastlane/plugins/plugin_info_collector.rb +2 -2
  24. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +5 -5
  25. data/fastlane/lib/fastlane/runner.rb +12 -9
  26. data/fastlane/lib/fastlane/setup/crashlytics_beta_ui.rb +1 -4
  27. data/fastlane/lib/fastlane/supported_platforms.rb +17 -7
  28. data/fastlane/lib/fastlane/version.rb +1 -1
  29. data/fastlane_core/lib/fastlane_core.rb +1 -0
  30. data/fastlane_core/lib/fastlane_core/cert_checker.rb +3 -3
  31. data/fastlane_core/lib/fastlane_core/command_executor.rb +1 -1
  32. data/fastlane_core/lib/fastlane_core/configuration/commander_generator.rb +7 -3
  33. data/fastlane_core/lib/fastlane_core/device_manager.rb +43 -16
  34. data/fastlane_core/lib/fastlane_core/globals.rb +27 -0
  35. data/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb +1 -1
  36. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +2 -4
  37. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +1 -1
  38. data/fastlane_core/lib/fastlane_core/pkg_upload_package_builder.rb +1 -1
  39. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +4 -4
  40. data/fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb +1 -1
  41. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +22 -14
  42. data/fastlane_core/lib/fastlane_core/ui/interface.rb +5 -4
  43. data/frameit/README.md +4 -1
  44. data/frameit/lib/frameit/commands_generator.rb +1 -1
  45. data/frameit/lib/frameit/editor.rb +60 -13
  46. data/frameit/lib/frameit/runner.rb +1 -1
  47. data/gym/README.md +14 -0
  48. data/gym/lib/gym/commands_generator.rb +1 -1
  49. data/gym/lib/gym/error_handler.rb +2 -2
  50. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +1 -1
  51. data/gym/lib/gym/runner.rb +3 -3
  52. data/gym/lib/gym/xcodebuild_fixes/package_application_fix.rb +2 -2
  53. data/gym/lib/gym/xcodebuild_fixes/swift_fix.rb +1 -1
  54. data/match/lib/match/commands_generator.rb +1 -1
  55. data/match/lib/match/encrypt.rb +3 -3
  56. data/match/lib/match/git_helper.rb +8 -8
  57. data/match/lib/match/options.rb +1 -1
  58. data/match/lib/match/utils.rb +3 -3
  59. data/pem/lib/pem/commands_generator.rb +1 -1
  60. data/pilot/lib/pilot/commands_generator.rb +1 -1
  61. data/produce/README.md +1 -1
  62. data/produce/lib/produce/commands_generator.rb +2 -2
  63. data/scan/lib/scan/commands_generator.rb +1 -1
  64. data/scan/lib/scan/options.rb +6 -0
  65. data/scan/lib/scan/runner.rb +2 -2
  66. data/scan/lib/scan/test_command_generator.rb +1 -0
  67. data/screengrab/lib/screengrab/commands_generator.rb +1 -1
  68. data/sigh/lib/sigh/commands_generator.rb +3 -3
  69. data/sigh/lib/sigh/local_manage.rb +1 -1
  70. data/sigh/lib/sigh/resign.rb +1 -1
  71. data/sigh/lib/sigh/runner.rb +8 -3
  72. data/snapshot/README.md +3 -3
  73. data/snapshot/lib/snapshot/collector.rb +1 -1
  74. data/snapshot/lib/snapshot/commands_generator.rb +1 -1
  75. data/snapshot/lib/snapshot/fixes/hardware_keyboard_fix.rb +1 -1
  76. data/snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb +1 -1
  77. data/snapshot/lib/snapshot/reset_simulators.rb +2 -2
  78. data/snapshot/lib/snapshot/runner.rb +3 -3
  79. data/spaceship/lib/spaceship.rb +2 -0
  80. data/spaceship/lib/spaceship/base.rb +18 -0
  81. data/spaceship/lib/spaceship/client.rb +8 -5
  82. data/spaceship/lib/spaceship/globals.rb +12 -0
  83. data/spaceship/lib/spaceship/portal/app.rb +0 -6
  84. data/spaceship/lib/spaceship/portal/app_group.rb +0 -6
  85. data/spaceship/lib/spaceship/portal/device.rb +0 -6
  86. data/spaceship/lib/spaceship/portal/person.rb +0 -6
  87. data/spaceship/lib/spaceship/portal/portal.rb +1 -0
  88. data/spaceship/lib/spaceship/portal/portal_client.rb +37 -0
  89. data/spaceship/lib/spaceship/portal/spaceship.rb +9 -0
  90. data/spaceship/lib/spaceship/portal/website_push.rb +90 -0
  91. data/spaceship/lib/spaceship/tunes/app_image.rb +0 -6
  92. data/spaceship/lib/spaceship/tunes/app_ratings.rb +0 -9
  93. data/spaceship/lib/spaceship/tunes/app_screenshot.rb +0 -7
  94. data/spaceship/lib/spaceship/tunes/app_trailer.rb +0 -6
  95. data/spaceship/lib/spaceship/tunes/app_version.rb +1 -0
  96. data/spaceship/lib/spaceship/tunes/app_version_generated_promocodes.rb +0 -9
  97. data/spaceship/lib/spaceship/tunes/app_version_history.rb +0 -9
  98. data/spaceship/lib/spaceship/tunes/app_version_promocodes.rb +0 -9
  99. data/spaceship/lib/spaceship/tunes/app_version_ref.rb +0 -6
  100. data/spaceship/lib/spaceship/tunes/app_version_states_history.rb +0 -9
  101. data/spaceship/lib/spaceship/tunes/application.rb +0 -6
  102. data/spaceship/lib/spaceship/tunes/build.rb +0 -8
  103. data/spaceship/lib/spaceship/tunes/build_details.rb +0 -8
  104. data/spaceship/lib/spaceship/tunes/build_train.rb +0 -6
  105. data/spaceship/lib/spaceship/tunes/member.rb +0 -6
  106. data/spaceship/lib/spaceship/tunes/pricing_tier.rb +0 -9
  107. data/spaceship/lib/spaceship/tunes/recovery_device.rb +0 -6
  108. data/spaceship/lib/spaceship/tunes/territory.rb +0 -7
  109. data/spaceship/lib/spaceship/tunes/tester.rb +0 -6
  110. data/spaceship/lib/spaceship/tunes/transit_app_file.rb +0 -6
  111. data/spaceship/lib/spaceship/tunes/tunes_client.rb +2 -2
  112. data/spaceship/lib/spaceship/tunes/user_detail.rb +0 -6
  113. data/spaceship/lib/spaceship/tunes/version_set.rb +0 -11
  114. data/spaceship/lib/spaceship/two_step_client.rb +2 -2
  115. data/supply/lib/supply/commands_generator.rb +1 -1
  116. metadata +34 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8df08ee848469d56fc5c96626b12d4f6c1cd84c0
4
- data.tar.gz: 51ef2d002b8b926b037607fc0c92bd76b6c2de62
3
+ metadata.gz: a80b498fd3f3fbffbd59594a476a1f95248bbed7
4
+ data.tar.gz: b46aa1e1ed70776ffd15339348267ed4cd48a176
5
5
  SHA512:
6
- metadata.gz: c9a9bec7a4ad536e78e17b32063b5d9dac15ed424924b5b68a0e080585ceb1ccee888eee83adcbf084f26209850fd2ba004d8eb8c159d330ee794065ae91e680
7
- data.tar.gz: 28c49fd2ad59c7119de1c03dafe9204ef3f9c1e0661c9efa98901de6c4667a0c3348f9d83c97f957cf9ba7efc95d19765bf8a27048b23dded1e5a5c1451adf90
6
+ metadata.gz: 85ce9e2c95a972e50364c7092b20db57f819e0441184147182747b6116303a17832dac191dc68adfa66b0cd3e172e797261afc82964b300fb9558f463c3b6a44
7
+ data.tar.gz: 9c3c95543e4cdcf18ae12d3fbcec7123d1d5b00fb44a1408090c8244c04f01be93d50132a4bd7c679ef83c8ad4b4e91dacabad6eb3a545439dac290fd9adc491
@@ -20,7 +20,7 @@ module Cert
20
20
  program :help, 'GitHub', 'https://github.com/fastlane/cert'
21
21
  program :help_formatter, :compact
22
22
 
23
- global_option('--verbose') { $verbose = true }
23
+ global_option('--verbose') { FastlaneCore::Globals.verbose = true }
24
24
 
25
25
  FastlaneCore::CommanderGenerator.new.generate(Cert::Options.available_options)
26
26
 
@@ -63,7 +63,7 @@ module Cert
63
63
  revoke_count += 1
64
64
  rescue => e
65
65
  UI.error "An error occurred while revoking #{certificate.id} #{certificate.name}"
66
- UI.error "#{e.message}\n#{e.backtrace.join("\n")}" if $verbose
66
+ UI.error "#{e.message}\n#{e.backtrace.join("\n")}" if FastlaneCore::Globals.verbose?
67
67
  end
68
68
  end
69
69
 
@@ -44,7 +44,7 @@ module CredentialsManager
44
44
  eval(content)
45
45
  # rubocop:enable Security/Eval
46
46
 
47
- print_debug_information(path: full_path) if $verbose
47
+ print_debug_information(path: full_path) if FastlaneCore::Globals.verbose?
48
48
  end
49
49
  end
50
50
 
@@ -39,7 +39,7 @@ module Deliver
39
39
 
40
40
  FastlaneCore::CommanderGenerator.new.generate(deliverfile_options)
41
41
 
42
- global_option('--verbose') { $verbose = true }
42
+ global_option('--verbose') { FastlaneCore::Globals.verbose = true }
43
43
 
44
44
  always_trace!
45
45
 
@@ -72,10 +72,10 @@ module Deliver
72
72
  def prepare_app_icons(options = {})
73
73
  return unless options[:metadata_path]
74
74
 
75
- default_app_icon_path = File.join(options[:metadata_path], "app_icon.png")
75
+ default_app_icon_path = Dir[File.join(options[:metadata_path], "app_icon.{png,jpg}")].first
76
76
  options[:app_icon] ||= default_app_icon_path if File.exist?(default_app_icon_path)
77
77
 
78
- default_watch_icon_path = File.join(options[:metadata_path], "watch_icon.png")
78
+ default_watch_icon_path = Dir[File.join(options[:metadata_path], "watch_icon.{png,jpg}")].first
79
79
  options[:app_icon] ||= default_watch_icon_path if File.exist?(default_watch_icon_path)
80
80
  end
81
81
 
@@ -70,12 +70,14 @@ module Deliver
70
70
 
71
71
  # get App icon + watch icon
72
72
  if v.large_app_icon.asset_token
73
- app_icon_path = File.join(path, "app_icon.png")
73
+ app_icon_extension = File.extname(v.large_app_icon.url)
74
+ app_icon_path = File.join(path, "app_icon#{app_icon_extension}")
74
75
  File.write(app_icon_path, open(v.large_app_icon.url).read)
75
76
  UI.success("Successfully downloaded large app icon")
76
77
  end
77
78
  if v.watch_app_icon.asset_token
78
- watch_icon_path = File.join(path, "watch_icon.png")
79
+ watch_app_icon_extension = File.extname(v.watch_app_icon.url)
80
+ watch_icon_path = File.join(path, "watch_icon#{watch_app_icon_extension}")
79
81
  File.write(watch_icon_path, open(v.watch_app_icon.url).read)
80
82
  UI.success("Successfully downloaded watch icon")
81
83
  end
@@ -115,7 +115,7 @@ module Fastlane
115
115
  class_ref = Fastlane::Actions.const_get(class_name)
116
116
 
117
117
  if class_ref.respond_to?(:run)
118
- UI.success "Successfully loaded custom action '#{file}'." if $verbose
118
+ UI.success "Successfully loaded custom action '#{file}'." if FastlaneCore::Globals.verbose?
119
119
  else
120
120
  UI.error "Could not find method 'run' in class #{class_name}."
121
121
  UI.error 'For more information, check out the docs: https://docs.fastlane.tools/'
@@ -0,0 +1,45 @@
1
+ module Fastlane
2
+ module Actions
3
+ class AddExtraPlatformsAction < Action
4
+ def self.run(params)
5
+ UI.verbose "Before injecting extra platforms: #{Fastlane::SupportedPlatforms.all}"
6
+ Fastlane::SupportedPlatforms.extra = params[:platforms]
7
+ UI.verbose "After injecting extra platforms (#{params[:platforms]})...: #{Fastlane::SupportedPlatforms.all}"
8
+ end
9
+
10
+ def self.description
11
+ "Modify the default list of supported platforms"
12
+ end
13
+
14
+ def self.available_options
15
+ [
16
+ FastlaneCore::ConfigItem.new(key: :platforms,
17
+ optional: false,
18
+ type: Array,
19
+ default_value: "",
20
+ description: "The optional extra platforms to support")
21
+ ]
22
+ end
23
+
24
+ def self.authors
25
+ ["lacostej"]
26
+ end
27
+
28
+ def self.is_supported?(platform)
29
+ true
30
+ end
31
+
32
+ def self.example_code
33
+ [
34
+ 'add_extra_platforms(
35
+ platforms: [:windows,:neogeo]
36
+ )'
37
+ ]
38
+ end
39
+
40
+ def self.category
41
+ :misc
42
+ end
43
+ end
44
+ end
45
+ end
@@ -30,9 +30,9 @@ module Fastlane
30
30
  end
31
31
 
32
32
  if params[:commits_count]
33
- changelog = Actions.git_log_last_commits(params[:pretty], params[:commits_count], merge_commit_filtering)
33
+ changelog = Actions.git_log_last_commits(params[:pretty], params[:commits_count], merge_commit_filtering, params[:date_format])
34
34
  else
35
- changelog = Actions.git_log_between(params[:pretty], from, to, merge_commit_filtering)
35
+ changelog = Actions.git_log_between(params[:pretty], from, to, merge_commit_filtering, params[:date_format])
36
36
  end
37
37
  changelog = changelog.gsub("\n\n", "\n") if changelog # as there are duplicate newlines
38
38
  Actions.lane_context[SharedValues::FL_CHANGELOG] = changelog
@@ -89,6 +89,11 @@ module Fastlane
89
89
  optional: true,
90
90
  default_value: '%B',
91
91
  is_string: true),
92
+ FastlaneCore::ConfigItem.new(key: :date_format,
93
+ env_name: 'FL_CHANGELOG_FROM_GIT_COMMITS_DATE_FORMAT',
94
+ description: 'The date format applied to each commit while generating the collected value',
95
+ optional: true,
96
+ is_string: true),
92
97
  FastlaneCore::ConfigItem.new(key: :tag_match_pattern,
93
98
  env_name: 'FL_CHANGELOG_FROM_GIT_COMMITS_TAG_MATCH_PATTERN',
94
99
  description: 'A glob(7) pattern to match against when finding the last git tag',
@@ -124,7 +129,7 @@ module Fastlane
124
129
  end
125
130
 
126
131
  def self.author
127
- ['mfurtak', 'asfalcone', 'SiarheiFedartsou']
132
+ ['mfurtak', 'asfalcone', 'SiarheiFedartsou', 'allewun']
128
133
  end
129
134
 
130
135
  def self.is_supported?(platform)
@@ -135,10 +140,11 @@ module Fastlane
135
140
  [
136
141
  'changelog_from_git_commits',
137
142
  'changelog_from_git_commits(
138
- between: ["7b092b3", "HEAD"], # Optional, lets you specify a revision/tag range between which to collect commit info
139
- pretty: "- (%ae) %s", # Optional, lets you provide a custom format to apply to each commit when generating the changelog text
140
- match_lightweight_tag: false, # Optional, lets you ignore lightweight (non-annotated) tags when searching for the last tag
141
- include_merges: true # Optional, lets you filter out merge commits
143
+ between: ["7b092b3", "HEAD"], # Optional, lets you specify a revision/tag range between which to collect commit info
144
+ pretty: "- (%ae) %s", # Optional, lets you provide a custom format to apply to each commit when generating the changelog text
145
+ date_format: "short", # Optional, lets you provide an additional date format to dates within the pretty-formatted string
146
+ match_lightweight_tag: false, # Optional, lets you ignore lightweight (non-annotated) tags when searching for the last tag
147
+ merge_commit_filtering: "exclude_merges" # Optional, lets you filter out merge commits
142
148
  )'
143
149
  ]
144
150
  end
@@ -35,7 +35,7 @@ module Fastlane
35
35
  .gsub(params[:build_secret], '[[BUILD_SECRET]]')
36
36
  end
37
37
 
38
- UI.verbose sanitizer.call(command.join(' ')) if $verbose
38
+ UI.verbose sanitizer.call(command.join(' ')) if FastlaneCore::Globals.verbose?
39
39
 
40
40
  error_callback = proc do |error|
41
41
  clean_error = sanitizer.call(error)
@@ -51,7 +51,7 @@ module Fastlane
51
51
 
52
52
  return command if Helper.test?
53
53
 
54
- UI.verbose sanitizer.call(result) if $verbose
54
+ UI.verbose sanitizer.call(result) if FastlaneCore::Globals.verbose?
55
55
 
56
56
  UI.success('Build successfully uploaded to Crashlytics Beta 🌷')
57
57
  UI.success('Visit https://fabric.io/_/beta to add release notes and notify testers.')
@@ -22,6 +22,12 @@ module Fastlane
22
22
 
23
23
  command << " --exclude #{params[:exclude]}" if params[:exclude]
24
24
 
25
+ if params[:exclude_dirs]
26
+ params[:exclude_dirs].each do |dir|
27
+ command << " --exclude-dir #{dir.shellescape}"
28
+ end
29
+ end
30
+
25
31
  return command if Helper.is_test?
26
32
 
27
33
  UI.important(command)
@@ -84,7 +90,13 @@ module Fastlane
84
90
  env_name: "FL_ENSURE_NO_DEBUG_CODE_EXCLUDE",
85
91
  description: "Exclude a certain pattern from the search",
86
92
  optional: true,
87
- is_string: true)
93
+ is_string: true),
94
+ FastlaneCore::ConfigItem.new(key: :exclude_dirs,
95
+ env_name: "FL_ENSURE_NO_DEBUG_CODE_EXCLUDE_DIRS",
96
+ description: "An array of dirs that should not be included in the search",
97
+ optional: true,
98
+ type: Array,
99
+ is_string: false)
88
100
  ]
89
101
  end
90
102
 
@@ -2,7 +2,7 @@ module Fastlane
2
2
  module Actions
3
3
  class GitTagExistsAction < Action
4
4
  def self.run(params)
5
- result = Actions.sh("git rev-parse -q --verify refs/tags/#{params[:tag].shellescape} || true", log: $verbose).chomp
5
+ result = Actions.sh("git rev-parse -q --verify refs/tags/#{params[:tag].shellescape} || true", log: FastlaneCore::Globals.verbose?).chomp
6
6
  !result.empty?
7
7
  end
8
8
 
@@ -1,3 +1,9 @@
1
+ if ENV["SPACESHIP_DEBUG"]
2
+ require 'openssl'
3
+ # this has to be on top of this file, since the value can't be changed later
4
+ OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
5
+ end
6
+
1
7
  module Fastlane
2
8
  module Actions
3
9
  module SharedValues
@@ -6,18 +12,46 @@ module Fastlane
6
12
  end
7
13
 
8
14
  class HockeyAction < Action
9
- def self.upload_build(api_token, ipa, options)
15
+ def self.connection(options)
10
16
  require 'faraday'
11
17
  require 'faraday_middleware'
12
18
 
13
- base_url = options[:bypass_cdn] ? "https://rink.hockeyapp.net" : "https://upload.hockeyapp.net"
14
- connection = Faraday.new(url: base_url) do |builder|
19
+ base_url = options.delete(:bypass_cdn) ? "https://rink.hockeyapp.net" : "https://upload.hockeyapp.net"
20
+ foptions = {
21
+ url: base_url
22
+ }
23
+ Faraday.new(foptions) do |builder|
15
24
  builder.request :multipart
16
25
  builder.request :url_encoded
17
26
  builder.response :json, content_type: /\bjson$/
18
27
  builder.use FaradayMiddleware::FollowRedirects
19
28
  builder.adapter :net_http
29
+ if ENV['SPACESHIP_DEBUG']
30
+ # for debugging only
31
+ # This enables tracking of networking requests using Charles Web Proxy
32
+ builder.proxy "https://127.0.0.1:8888"
33
+ end
34
+
35
+ if ENV["DEBUG"]
36
+ puts "To run _spaceship_ through a local proxy, use SPACESHIP_DEBUG"
37
+ end
38
+ end
39
+ end
40
+
41
+ def self.upload(api_token, ipa, options)
42
+ create_update = options.delete(:create_update)
43
+
44
+ if create_update
45
+ self.create_and_update_build(api_token, ipa, options)
46
+ else
47
+ self.upload_build(api_token, ipa, options)
20
48
  end
49
+ end
50
+
51
+ # Uses https://support.hockeyapp.net/kb/api/api-versions#upload-version if a `public_identifier` was specified
52
+ # otherwise https://support.hockeyapp.net/kb/api/api-apps#upload-app
53
+ def self.upload_build(api_token, ipa, options)
54
+ connection = self.connection(options)
21
55
 
22
56
  options[:ipa] = Faraday::UploadIO.new(ipa, 'application/octet-stream') if ipa and File.exist?(ipa)
23
57
 
@@ -37,9 +71,48 @@ module Fastlane
37
71
  end
38
72
  end
39
73
 
40
- def self.run(options)
41
- # Available options: http://support.hockeyapp.net/kb/api/api-versions#upload-version
74
+ # Uses https://support.hockeyapp.net/kb/api/api-versions#create-version
75
+ # and https://support.hockeyapp.net/kb/api/api-versions#update-version
76
+ # to upload a build
77
+ def self.create_and_update_build(api_token, ipa, options)
78
+ [:public_identifier, :bundle_short_version, :bundle_version].each do |key|
79
+ UI.user_error!("To use the 'create_update' upload mechanism you need to pass the '#{key.to_sym}' option.") unless options[key]
80
+ end
81
+ # https://support.hockeyapp.net/discussions/problems/33355-is-uploadhockeyappnet-available-for-general-use
82
+ # GET requests are cached on CDN, so bypass it
83
+ options[:bypass_cdn] = true
84
+ connection = self.connection(options)
85
+
86
+ options.delete(:ipa)
87
+ options.delete(:apk)
88
+ app_id = options.delete(:public_identifier)
89
+
90
+ ipaio = Faraday::UploadIO.new(ipa, 'application/octet-stream') if ipa and File.exist?(ipa)
91
+
92
+ response = connection.get do |req|
93
+ req.url("/api/2/apps/#{app_id}/app_versions/new")
94
+ req.headers['X-HockeyAppToken'] = api_token
95
+ req.body = options
96
+ end
42
97
 
98
+ case response.status
99
+ when 200...300
100
+ app_version_id = response.body['id']
101
+ UI.message("successfully created version with id #{app_version_id}")
102
+ else
103
+ UI.user_error!("Error trying to create app version: #{response.status} - #{response.body}")
104
+ end
105
+
106
+ options[:ipa] = ipaio
107
+
108
+ connection.put do |req|
109
+ req.url("/api/2/apps/#{app_id}/app_versions/#{app_version_id}")
110
+ req.headers['X-HockeyAppToken'] = api_token
111
+ req.body = options
112
+ end
113
+ end
114
+
115
+ def self.run(options)
43
116
  build_file = [
44
117
  options[:ipa],
45
118
  options[:apk]
@@ -53,8 +126,8 @@ module Fastlane
53
126
  UI.user_error!("You have to provide a build file")
54
127
  end
55
128
 
56
- dsym_path = options[:ipa].to_s.gsub('ipa', 'app.dSYM.zip')
57
- if options[:ipa]
129
+ if options[:ipa].to_s.end_with?(".ipa")
130
+ dsym_path = options[:ipa].to_s.gsub('.ipa', '.app.dSYM.zip')
58
131
  if File.exist?(dsym_path)
59
132
  dsym_filename = dsym_path
60
133
  else
@@ -69,19 +142,23 @@ module Fastlane
69
142
  if options[:upload_dsym_only]
70
143
  UI.success('Starting with dSYM upload to HockeyApp... this could take some time.')
71
144
  else
72
- UI.success('Starting with ipa upload to HockeyApp... this could take some time.')
145
+ UI.success('Starting with file(s) upload to HockeyApp... this could take some time.')
73
146
  end
74
147
 
75
148
  values = options.values
76
149
  values[:dsym_filename] = dsym_filename
77
150
  values[:notes_type] = options[:notes_type]
78
151
 
152
+ api_token = values.delete(:api_token)
153
+
154
+ values.delete_if { |k, v| v.nil? }
155
+
79
156
  return values if Helper.test?
80
157
 
81
158
  ipa_filename = build_file
82
159
  ipa_filename = nil if options[:upload_dsym_only]
83
160
 
84
- response = self.upload_build(options[:api_token], ipa_filename, values)
161
+ response = self.upload(api_token, ipa_filename, values)
85
162
  case response.status
86
163
  when 200...300
87
164
  url = response.body['public_url']
@@ -95,7 +172,7 @@ module Fastlane
95
172
  if response.body.to_s.include?("App could not be created")
96
173
  UI.user_error!("Hockey has an issue processing this app. Please confirm that an app in Hockey matches this IPA's bundle ID or that you are using the correct API upload token. If error persists, please provide the :public_identifier option from the HockeyApp website. More information https://github.com/fastlane/fastlane/issues/400")
97
174
  else
98
- UI.user_error!("Error when trying to upload ipa to HockeyApp: #{response.body}")
175
+ UI.user_error!("Error when trying to upload file(s) to HockeyApp: #{response.status} - #{response.body}")
99
176
  end
100
177
  end
101
178
  end
@@ -127,7 +204,7 @@ module Fastlane
127
204
  end),
128
205
  FastlaneCore::ConfigItem.new(key: :ipa,
129
206
  env_name: "FL_HOCKEY_IPA",
130
- description: "Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action. For Mac zip the .app. For Android provide path to .apk file",
207
+ description: "Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action. For Mac zip the .app. For Android provide path to .apk file. In addition you could use this to upload .msi, .zip, .pkg, etc if you use the 'create_update' mechanism",
131
208
  default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
132
209
  optional: true,
133
210
  verify_block: proc do |value|
@@ -145,6 +222,15 @@ module Fastlane
145
222
  verify_block: proc do |value|
146
223
  # validation is done in the action
147
224
  end),
225
+ FastlaneCore::ConfigItem.new(key: :create_update,
226
+ env_name: "FL_HOCKEY_CREATE_UPDATE",
227
+ description: "Set true if you want to create then update your app as opposed to just upload it."\
228
+ " You will need the 'public_identifier', 'bundle_version' and 'bundle_short_version'",
229
+ is_string: false,
230
+ default_value: false,
231
+ verify_block: proc do |value|
232
+ # validation is done in the action
233
+ end),
148
234
  FastlaneCore::ConfigItem.new(key: :notes,
149
235
  env_name: "FL_HOCKEY_NOTES",
150
236
  description: "Beta Notes",
@@ -181,9 +267,17 @@ module Fastlane
181
267
  env_name: "FL_HOCKEY_TAGS",
182
268
  description: "Comma separated list of tags which will receive access to the build",
183
269
  optional: true),
270
+ FastlaneCore::ConfigItem.new(key: :bundle_short_version,
271
+ env_name: "FL_HOCKEY_BUNDLE_SHORT_VERSION",
272
+ description: "The bundle_short_version of your application, required when using `create_update`",
273
+ optional: true),
274
+ FastlaneCore::ConfigItem.new(key: :bundle_version,
275
+ env_name: "FL_HOCKEY_BUNDLE_VERSION",
276
+ description: "The bundle_version of your application, required when using `create_update`",
277
+ optional: true),
184
278
  FastlaneCore::ConfigItem.new(key: :public_identifier,
185
279
  env_name: "FL_HOCKEY_PUBLIC_IDENTIFIER",
186
- description: "App id of the app you are targeting, usually you won't need this value. Required, if `upload_dsm_only` set to `true`",
280
+ description: "App id of the app you are targeting, usually you won't need this value. Required, if `upload_dsym_only` set to `true`",
187
281
  optional: true),
188
282
  FastlaneCore::ConfigItem.new(key: :commit_sha,
189
283
  env_name: "FL_HOCKEY_COMMIT_SHA",
@@ -235,11 +329,11 @@ module Fastlane
235
329
  end
236
330
 
237
331
  def self.author
238
- ["KrauseFx", "modzelewski"]
332
+ ["KrauseFx", "modzelewski", "lacostej"]
239
333
  end
240
334
 
241
335
  def self.is_supported?(platform)
242
- [:ios, :mac, :android].include? platform
336
+ true
243
337
  end
244
338
 
245
339
  def self.details
@@ -255,6 +349,15 @@ module Fastlane
255
349
  api_token: "...",
256
350
  ipa: "./app.ipa",
257
351
  notes: "Changelog"
352
+ )',
353
+ 'hockey(
354
+ api_token: "...",
355
+ create_update: true,
356
+ public_identifier: "....",
357
+ bundle_short_version: "1.0.2,
358
+ bundle_version: "1.0.2.145",
359
+ ipa: "./my.msi",
360
+ notes: "Changelog"
258
361
  )'
259
362
  ]
260
363
  end