fastlane_core 0.43.2 → 0.43.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67e9a9b7c43aaf99b8346244fb9d460ab63610ff
4
- data.tar.gz: 0916bd2dfe4f685ada0504433c875c07f3c04ecd
3
+ metadata.gz: dec70f9af0189cb95d059bf6235e5fdb06bdd566
4
+ data.tar.gz: 42c1c4810eec48f3485a90d68297f8904d7788b5
5
5
  SHA512:
6
- metadata.gz: 9b4e6fc941e132c16918f11cfd660ff8f1340eae0d3649ee412788ae4db1f13d0da817f13835c4572752b0294e26941892c6201f98e2933fad3b6cc41314df71
7
- data.tar.gz: 1cd457d395a3b4acd24155c3d2c641a02b6f21dd6d48d67c0b6a8c23be0b0cdb178df9763bca2907a3a03b25fe3847a7e014dc0c097830de34c708ce77d35581
6
+ metadata.gz: d15cbd14e8e175e139caa99dcc27b2ce1513bf2fd3f479f6c994c8df6fee287a6b944c82d20d1e57ce5f8b183cf6b3d05f8d73af783073189bd649afea255e45
7
+ data.tar.gz: eff76516a1a921b4edbdeb7ea5f9ab0ec4508f10dd555957b79a8ce48bdd401590f5f72bd23f178c5d3a3deb0104026228065049a1aa754255c920259e988ca7
data/lib/fastlane_core.rb CHANGED
@@ -1,4 +1,8 @@
1
1
  require 'json'
2
+
3
+ # Ruby monkey-patches - should be before almost all else
4
+ require 'fastlane_core/core_ext/string'
5
+
2
6
  require 'fastlane_core/version'
3
7
  require 'fastlane_core/helper'
4
8
  require 'fastlane_core/xcodebuild_list_output_parser'
@@ -0,0 +1,17 @@
1
+ class String
2
+ def fastlane_class
3
+ split('_').collect!(&:capitalize).join
4
+ end
5
+
6
+ def fastlane_module
7
+ self == "pem" ? 'PEM' : self.fastlane_class
8
+ end
9
+
10
+ def fastlane_underscore
11
+ self.gsub(/::/, '/').
12
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
13
+ gsub(/([a-z\d])([A-Z])/, '\1_\2').
14
+ tr("-", "_").
15
+ downcase
16
+ end
17
+ end
@@ -1,17 +1,58 @@
1
1
  module FastlaneCore
2
2
  class ToolCollector
3
- HOST_URL = "https://fastlane-enhancer.herokuapp.com"
3
+ HOST_URL = ENV['FASTLANE_ENHANCER_URL'] || "https://fastlane-enhancer.herokuapp.com"
4
4
 
5
+ # This is the original error reporting mechanism, which has always represented
6
+ # either controlled (UI.user_error!), or uncontrolled (UI.crash!, anything else)
7
+ # exceptions.
8
+ #
9
+ # Thus, if you call `did_crash`, it will record the failure both here, and in the
10
+ # newer, more specific `crash` field.
11
+ #
12
+ # This value is a String, which is the name of the tool that caused the error
5
13
  attr_reader :error
6
14
 
15
+ # This is the newer field for tracking only uncontrolled exceptions.
16
+ #
17
+ # This is written to only when `did_crash` is called, and therefore excludes
18
+ # controlled exceptions.
19
+ #
20
+ # This value is a boolean, which is true if the error was an uncontrolled exception
21
+ attr_reader :crash
22
+
23
+ def initialize
24
+ @crash = false
25
+ end
26
+
7
27
  def did_launch_action(name)
8
28
  name = name.to_sym
9
- launches[name] += 1 if is_official?(name)
29
+
30
+ if is_official?(name)
31
+ launches[name] += 1
32
+ versions[name] ||= determine_version(name)
33
+ end
10
34
  end
11
35
 
36
+ # Call when the problem is a caught/controlled exception (e.g. via UI.user_error!)
12
37
  def did_raise_error(name)
13
38
  name = name.to_sym
14
- @error = name if is_official?(name)
39
+ if is_official?(name)
40
+ @error = name
41
+ # Don't write to the @crash field so that we can distinguish this exception later
42
+ # as being controlled
43
+ end
44
+ end
45
+
46
+ # Call when the problem is an uncaught/uncontrolled exception (e.g. via UI.crash!)
47
+ def did_crash(name)
48
+ name = name.to_sym
49
+ if is_official?(name)
50
+ # Write to the @error field to maintain the historical behavior of the field, so
51
+ # that the server gets the same data in that field from old and new clients
52
+ @error = name
53
+ # Also specifically note that this exception was uncontrolled in the @crash field
54
+ @crash = true
55
+ end
15
56
  end
16
57
 
17
58
  def did_finish
@@ -24,8 +65,10 @@ module FastlaneCore
24
65
  require 'excon'
25
66
  url = HOST_URL + '/did_launch?'
26
67
  url += URI.encode_www_form(
68
+ versions: versions.to_json,
27
69
  steps: launches.to_json,
28
- error: @error
70
+ error: @error,
71
+ crash: @crash ? @error : nil
29
72
  )
30
73
 
31
74
  if Helper.is_test? # don't send test data
@@ -57,6 +100,19 @@ module FastlaneCore
57
100
  @launches ||= Hash.new(0)
58
101
  end
59
102
 
103
+ # Maintains a hash of tool names to their detected versions.
104
+ #
105
+ # This data is sent in the same manner as launches, as an inline form-encoded JSON value in the POST.
106
+ # For example:
107
+ #
108
+ # {
109
+ # match: '0.5.0',
110
+ # fastlane: '1.86.1'
111
+ # }
112
+ def versions
113
+ @versions ||= {}
114
+ end
115
+
60
116
  def is_official?(name)
61
117
  return true
62
118
  end
@@ -67,5 +123,34 @@ module FastlaneCore
67
123
  File.write(path, '1') unless did_show
68
124
  did_show
69
125
  end
126
+
127
+ def determine_version(name)
128
+ begin
129
+ name = name.to_s.downcase
130
+
131
+ # We need to pre-load the version file because tools that are invoked through their actions
132
+ # will not yet have run their action, and thus will not yet have loaded the file which defines
133
+ # the module and constant we need.
134
+ require File.join(name, "version")
135
+
136
+ # Go from :foo_bar to 'FooBar'
137
+ module_name = name.fastlane_module
138
+
139
+ # Look up the VERSION constant defined for the given tool name,
140
+ # or return 'unknown' if we can't find it where we'd expect
141
+ if Kernel.const_defined?(module_name)
142
+ tool_module = Kernel.const_get(module_name)
143
+
144
+ if tool_module.const_defined?('VERSION')
145
+ return tool_module.const_get('VERSION')
146
+ end
147
+ end
148
+ rescue LoadError
149
+ # If there is no version file to load, this is not a tool for which
150
+ # we can report a particular version
151
+ end
152
+
153
+ return nil
154
+ end
70
155
  end
71
156
  end
@@ -24,7 +24,6 @@ module Commander
24
24
  begin
25
25
  collector.did_launch_action(@program[:name])
26
26
  run_active_command
27
- collector.did_finish
28
27
  rescue InvalidCommandError => e
29
28
  abort "#{e}. Use --help for more information"
30
29
  rescue Interrupt => ex
@@ -43,8 +42,10 @@ module Commander
43
42
  collector.did_raise_error(@program[:name])
44
43
  display_user_error!(e, e.message)
45
44
  rescue => e # high chance this is actually FastlaneCore::Interface::FastlaneCrash, but can be anything else
46
- collector.did_raise_error(@program[:name])
45
+ collector.did_crash(@program[:name])
47
46
  handle_unknown_error!(e)
47
+ ensure
48
+ collector.did_finish
48
49
  end
49
50
  end
50
51
 
@@ -22,7 +22,10 @@ module FastlaneCore
22
22
 
23
23
  def releases(gem_name)
24
24
  url = "https://api.github.com/repos/fastlane/#{gem_name}/releases"
25
- JSON.parse(Excon.get(url).body)
25
+ # We have to follow redirects, since some repos were moved away into a separate org
26
+ server_response = Excon.get(url,
27
+ middlewares: Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower])
28
+ JSON.parse(server_response.body)
26
29
  end
27
30
  end
28
31
  end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.43.2".freeze
2
+ VERSION = "0.43.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.2
4
+ version: 0.43.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-09 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -355,6 +355,7 @@ files:
355
355
  - lib/fastlane_core/configuration/config_item.rb
356
356
  - lib/fastlane_core/configuration/configuration.rb
357
357
  - lib/fastlane_core/configuration/configuration_file.rb
358
+ - lib/fastlane_core/core_ext/string.rb
358
359
  - lib/fastlane_core/crash_reporting/clean_stack_trace.rb
359
360
  - lib/fastlane_core/crash_reporting/crash_reporting.rb
360
361
  - lib/fastlane_core/device_manager.rb
@@ -400,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
400
401
  version: '0'
401
402
  requirements: []
402
403
  rubyforge_project:
403
- rubygems_version: 2.4.0
404
+ rubygems_version: 2.4.5.1
404
405
  signing_key:
405
406
  specification_version: 4
406
407
  summary: Contains all shared code/dependencies of the fastlane.tools