u3d 1.2.1 → 1.3.0

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +43 -10
  3. data/.github/workflows/ci.yml +35 -0
  4. data/.github_changelog_generator +3 -1
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +15 -3
  7. data/CHANGELOG.md +90 -11
  8. data/DEVELOPMENT_PROCESS.md +1 -0
  9. data/Gemfile.lock +148 -88
  10. data/Rakefile +55 -6
  11. data/appveyor.yml +25 -6
  12. data/examples/Example1/Gemfile +4 -2
  13. data/examples/Example1/Gemfile.lock +12 -7
  14. data/examples/Example1/Rakefile +2 -0
  15. data/examples/Example1/fastlane/Fastfile +2 -0
  16. data/examples/Example2/Gemfile +4 -2
  17. data/examples/Example2/Gemfile.lock +12 -7
  18. data/examples/Example2/fastlane/Fastfile +2 -0
  19. data/exe/u3d +3 -1
  20. data/lib/u3d/asset.rb +6 -2
  21. data/lib/u3d/cache.rb +14 -10
  22. data/lib/u3d/commands.rb +22 -17
  23. data/lib/u3d/commands_generator.rb +9 -4
  24. data/lib/u3d/compatibility.rb +2 -0
  25. data/lib/u3d/download_validator.rb +6 -3
  26. data/lib/u3d/downloader.rb +12 -8
  27. data/lib/u3d/failure_reporter.rb +4 -3
  28. data/lib/u3d/hub_modules_parser.rb +24 -7
  29. data/lib/u3d/ini_modules_parser.rb +10 -32
  30. data/lib/u3d/installation.rb +77 -66
  31. data/lib/u3d/installer.rb +50 -34
  32. data/lib/u3d/log_analyzer.rb +31 -27
  33. data/lib/u3d/unity_license.rb +2 -0
  34. data/lib/u3d/unity_module.rb +2 -0
  35. data/lib/u3d/unity_project.rb +4 -1
  36. data/lib/u3d/unity_runner.rb +12 -10
  37. data/lib/u3d/unity_version_definition.rb +3 -0
  38. data/lib/u3d/unity_version_number.rb +8 -2
  39. data/lib/u3d/unity_versions.rb +28 -23
  40. data/lib/u3d/utils.rb +82 -15
  41. data/lib/u3d/version.rb +8 -6
  42. data/lib/u3d.rb +13 -0
  43. data/lib/u3d_core/admin_tools.rb +2 -0
  44. data/lib/u3d_core/command_executor.rb +11 -7
  45. data/lib/u3d_core/command_runner.rb +17 -19
  46. data/lib/u3d_core/core_ext/hash.rb +2 -0
  47. data/lib/u3d_core/core_ext/operating_system_symbol.rb +3 -0
  48. data/lib/u3d_core/core_ext/string.rb +2 -0
  49. data/lib/u3d_core/credentials.rb +9 -7
  50. data/lib/u3d_core/env.rb +35 -0
  51. data/lib/u3d_core/globals.rb +7 -7
  52. data/lib/u3d_core/helper.rb +6 -4
  53. data/lib/u3d_core/ui/disable_colors.rb +2 -0
  54. data/lib/u3d_core/ui/implementations/shell.rb +8 -5
  55. data/lib/u3d_core/ui/interface.rb +3 -0
  56. data/lib/u3d_core/ui/ui.rb +5 -4
  57. data/lib/u3d_core/update_checker/changelog.rb +67 -0
  58. data/lib/u3d_core/update_checker/update_checker.rb +129 -0
  59. data/lib/u3d_core/version.rb +2 -0
  60. data/lib/u3d_core.rb +5 -0
  61. data/u3d.gemspec +20 -10
  62. metadata +106 -31
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Original work Copyright (c) 2015-present the fastlane authors
3
5
  # Modified work Copyright 2016-present WeWantToKnow AS
@@ -26,7 +28,7 @@ require 'security'
26
28
 
27
29
  module U3dCore
28
30
  class Credentials
29
- MAC_U3D_SERVER = 'u3d'.freeze
31
+ MAC_U3D_SERVER = 'u3d'
30
32
  def initialize(user: nil, password: nil)
31
33
  @user = user
32
34
  @password = password
@@ -39,6 +41,7 @@ module U3dCore
39
41
  while @user.to_s.empty?
40
42
  UI.verbose 'Username does not exist or is empty'
41
43
  raise CredentialsError, 'Username missing and context is not interactive. Please check that the environment variable is correct' unless UI.interactive?
44
+
42
45
  @user = UI.input 'Username for u3d:'
43
46
  end
44
47
 
@@ -48,12 +51,10 @@ module U3dCore
48
51
  def password
49
52
  @password ||= ENV['U3D_PASSWORD']
50
53
 
51
- if Helper.mac? && @use_keychain
52
- unless @password
53
- UI.message 'Fetching password from keychain'
54
- password_holder = Security::InternetPassword.find(server: server_name)
55
- @password = password_holder.password unless password_holder.nil?
56
- end
54
+ if Helper.mac? && @use_keychain && !@password
55
+ UI.message 'Fetching password from keychain'
56
+ password_holder = Security::InternetPassword.find(server: server_name)
57
+ @password = password_holder.password unless password_holder.nil?
57
58
  end
58
59
 
59
60
  if @password.nil?
@@ -76,6 +77,7 @@ module U3dCore
76
77
  while @password.nil?
77
78
  UI.verbose 'Password does not exist'
78
79
  raise CredentialsError, 'Password missing and context is not interactive. Please make sure it is correct' unless UI.interactive?
80
+
79
81
  @password = UI.password "Password for #{user}:"
80
82
  end
81
83
 
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ ## --- BEGIN LICENSE BLOCK ---
4
+ # Original work Copyright (c) 2015-present the fastlane authors
5
+ # Modified work Copyright 2019-present WeWantToKnow AS
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ ## --- END LICENSE BLOCK ---
25
+
26
+ module U3dCore
27
+ class Env
28
+ def self.truthy?(env)
29
+ return false unless ENV[env]
30
+ return false if %w[no false off 0].include?(ENV[env].to_s)
31
+
32
+ return true
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Original work Copyright (c) 2015-present the fastlane authors
3
5
  # Modified work Copyright 2016-present WeWantToKnow AS
@@ -52,13 +54,14 @@ module U3dCore
52
54
  end
53
55
 
54
56
  def method_missing(method_sym, *arguments, &block)
55
- if method_sym.to_s =~ /^with_(.*)$/
57
+ case method_sym.to_s
58
+ when /^with_(.*)$/
56
59
  if attributes.include? Regexp.last_match(1)
57
60
  with(Regexp.last_match(1).to_sym, arguments.first, &block)
58
61
  else
59
62
  super
60
63
  end
61
- elsif method_sym.to_s =~ /^(.*)\?$/
64
+ when /^(.*)\?$/
62
65
  if attributes.include? Regexp.last_match(1)
63
66
  is?(Regexp.last_match(1).to_sym)
64
67
  else
@@ -70,15 +73,12 @@ module U3dCore
70
73
  end
71
74
 
72
75
  def respond_to_missing?(method_sym, include_private = false)
73
- # rubocop:disable GuardClause
74
- if method_sym.to_s =~ /^with_(.*)$/
75
- return attributes.include? Regexp.last_match(1)
76
- elsif method_sym.to_s =~ /^(.*)\?$/
76
+ case method_sym.to_s
77
+ when /^with_(.*)$/ || /^(.*)\?$/
77
78
  return attributes.include? Regexp.last_match(1)
78
79
  else
79
80
  super
80
81
  end
81
- # rubocop:enable GuardClause
82
82
  end
83
83
  end
84
84
  private_class_method :is?, :with, :attributes
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Original work Copyright (c) 2015-present the fastlane authors
3
5
  # Modified work Copyright 2016-present WeWantToKnow AS
@@ -42,7 +44,7 @@ module U3dCore
42
44
  end
43
45
 
44
46
  def self.windows_path(path)
45
- path.gsub(%r{\/(\d)}, '/\\\\\1').tr('/', '\\')
47
+ path.gsub(%r{/(\d)}, '/\\\\\1').tr('/', '\\')
46
48
  end
47
49
 
48
50
  # Runs a given command using backticks (`)
@@ -95,6 +97,7 @@ module U3dCore
95
97
  # taken from: https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
96
98
  proc_version = '/proc/version'
97
99
  return false unless File.exist? proc_version
100
+
98
101
  File.open(proc_version, 'r') do |f|
99
102
  return !(/Microsof|WSL/ =~ f.read).nil?
100
103
  end
@@ -112,7 +115,7 @@ module U3dCore
112
115
 
113
116
  # the current operating system
114
117
  def self.operating_system
115
- # rubocop:disable GuardClause
118
+ # rubocop:disable Style/GuardClause
116
119
  if linux?
117
120
  return :linux
118
121
  elsif mac?
@@ -122,7 +125,7 @@ module U3dCore
122
125
  else
123
126
  raise 'Could not assume what OS you\'re running, please specify it as much as possible'
124
127
  end
125
- # rubocop:enable GuardClause
128
+ # rubocop:enable Style/GuardClause
126
129
  end
127
130
 
128
131
  def self.win_64?
@@ -153,5 +156,4 @@ module U3dCore
153
156
  # return ENV["FL_BUILDLOG_PATH"] || "~/Library/Logs"
154
157
  # end
155
158
  end
156
- # rubocop:enable Metrics/ModuleLength
157
159
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Original work Copyright (c) 2015-present the fastlane authors
3
5
  # Modified work Copyright 2016-present WeWantToKnow AS
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Original work Copyright (c) 2015-present the fastlane authors
3
5
  # Modified work Copyright 2016-present WeWantToKnow AS
@@ -27,6 +29,7 @@ module U3dCore
27
29
  class Shell < Interface
28
30
  # test_log_buffer: by default, don't show any logs when running tests
29
31
  def initialize(test_log_buffer: nil)
32
+ super()
30
33
  @test_log_buffer = test_log_buffer
31
34
  end
32
35
 
@@ -52,16 +55,15 @@ module U3dCore
52
55
 
53
56
  class EPipeIgnorerLogDevice < Logger::LogDevice
54
57
  def initialize(logdev)
58
+ super
55
59
  @logdev = logdev
56
60
  end
57
61
 
58
- # rubocop:disable HandleExceptions
59
62
  def write(message)
60
63
  @logdev.write(message)
61
64
  rescue Errno::EPIPE
62
65
  # ignored
63
66
  end
64
- # rubocop:enable HandleExceptions
65
67
  end
66
68
 
67
69
  def format_string(datetime = Time.now, severity = "")
@@ -79,7 +81,7 @@ module U3dCore
79
81
  s = []
80
82
  s << "#{severity} " if U3dCore::Globals.verbose? && severity && !severity.empty?
81
83
  s << "[#{datetime.strftime(timestamp)}] " if timestamp
82
- s.join('')
84
+ s.join
83
85
  end
84
86
 
85
87
  #####################################################
@@ -114,7 +116,7 @@ module U3dCore
114
116
  actual = (message.split("\r").last || "") # as clearing the line will remove the `>` and the time stamp
115
117
  actual.split("\n").each do |msg|
116
118
  prefix = msg.include?("▸") ? "" : "▸ "
117
- log.info(prefix + "" + msg.magenta)
119
+ log.info("#{prefix}#{msg.magenta}")
118
120
  end
119
121
  end
120
122
 
@@ -125,7 +127,7 @@ module U3dCore
125
127
  def header(message)
126
128
  i = message.length + 8
127
129
  success("-" * i)
128
- success("--- " + message + " ---")
130
+ success("--- #{message} ---")
129
131
  success("-" * i)
130
132
  end
131
133
 
@@ -167,6 +169,7 @@ module U3dCore
167
169
 
168
170
  def verify_interactive!(message)
169
171
  return if interactive?
172
+
170
173
  important(message)
171
174
  crash!("Could not retrieve response as u3d runs in non-interactive mode")
172
175
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Original work Copyright (c) 2015-present the fastlane authors
3
5
  # Modified work Copyright 2016-present WeWantToKnow AS
@@ -143,6 +145,7 @@ module U3dCore
143
145
  attr_reader :show_github_issues
144
146
 
145
147
  def initialize(show_github_issues: false)
148
+ super
146
149
  @show_github_issues = show_github_issues
147
150
  end
148
151
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Original work Copyright (c) 2015-present the fastlane authors
3
5
  # Modified work Copyright 2016-present WeWantToKnow AS
@@ -30,22 +32,21 @@ module U3dCore
30
32
 
31
33
  attr_writer :current
32
34
  end
33
-
34
- # rubocop:disable Style/MethodMissing
35
+ # rubocop:disable Style/MissingRespondToMissing
35
36
  def self.method_missing(method_sym, *args, &_block)
37
+ # rubocop:enable Style/MissingRespondToMissing
36
38
  # not using `responds` because we don't care about methods like .to_s and so on
37
39
  interface_methods = Interface.instance_methods - Object.instance_methods
38
40
  UI.user_error!("Unknown method '#{method_sym}', supported #{interface_methods}") unless interface_methods.include?(method_sym)
39
41
 
40
42
  current.send(method_sym, *args)
41
43
  end
42
- # rubocop:enable Style/MethodMissing
43
44
  end
44
45
  end
45
46
 
46
47
  require 'u3d_core/ui/interface'
47
48
 
48
49
  # Import all available implementations
49
- Dir[File.expand_path('implementations/*.rb', File.dirname(__FILE__))].each do |file|
50
+ Dir[File.expand_path('implementations/*.rb', File.dirname(__FILE__))].sort.each do |file|
50
51
  require file
51
52
  end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ ## --- BEGIN LICENSE BLOCK ---
4
+ # Original work Copyright (c) 2015-present the fastlane authors
5
+ # Modified work Copyright 2019-present WeWantToKnow AS
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ ## --- END LICENSE BLOCK ---
25
+
26
+ require_relative '../../u3d/utils'
27
+
28
+ module U3dCore
29
+ class Changelog
30
+ class << self
31
+ def show_changes(gem_name, current_version, update_gem_command: "bundle update")
32
+ did_show_changelog = false
33
+
34
+ releases(gem_name).each_with_index do |release, index|
35
+ next unless Gem::Version.new(to_version(release['tag_name'])) > Gem::Version.new(current_version)
36
+
37
+ puts("")
38
+ puts(release['name'].green)
39
+ puts(release['body'])
40
+ did_show_changelog = true
41
+
42
+ next unless index == 2
43
+
44
+ puts("")
45
+ puts("To see all new releases, open https://github.com/DragonBox/#{gem_name}/releases".green)
46
+ break
47
+ end
48
+
49
+ puts("")
50
+ puts("Please update using `#{update_gem_command}`".green) if did_show_changelog
51
+ rescue StandardError => e
52
+ # Something went wrong, we don't care so much about this
53
+ UI.error("Unable to show_changes: #{e}")
54
+ end
55
+
56
+ def to_version(tag_name)
57
+ tag_name = tag_name[1..-1] if tag_name[0] == 'v'
58
+ tag_name
59
+ end
60
+
61
+ def releases(gem_name)
62
+ url = "https://api.github.com/repos/DragonBox/#{gem_name}/releases"
63
+ JSON.parse(U3d::Utils.page_content(url))
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,129 @@
1
+ # frozen_string_literal: true
2
+
3
+ ## --- BEGIN LICENSE BLOCK ---
4
+ # Original work Copyright (c) 2015-present the fastlane authors
5
+ # Modified work Copyright 2019-present WeWantToKnow AS
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ ## --- END LICENSE BLOCK ---
25
+
26
+ require_relative 'changelog'
27
+ require_relative '../ui/ui'
28
+ require_relative '../../u3d/utils'
29
+
30
+ module U3dCore
31
+ # Verifies the user runs the latest version of this gem
32
+ class UpdateChecker
33
+ def self.start_looking_for_update(gem_name)
34
+ return if Helper.test?
35
+ return if U3dCore::Env.truthy?("U3D_SKIP_UPDATE_CHECK")
36
+
37
+ @start_time = Time.now
38
+
39
+ Thread.new do
40
+ server_results[gem_name] = fetch_latest(gem_name)
41
+ rescue StandardError
42
+ # we don't want to show a stack trace if something goes wrong
43
+ end
44
+ end
45
+
46
+ def self.server_results
47
+ @server_results ||= {}
48
+ end
49
+
50
+ class << self
51
+ attr_reader :start_time
52
+ end
53
+
54
+ def self.update_available?(gem_name, current_version)
55
+ latest = server_results[gem_name]
56
+ return (latest && (Gem::Version.new(latest) > Gem::Version.new(current_version)))
57
+ end
58
+
59
+ # wait a abit for results when commands run real quick
60
+ def self.wait_for_results
61
+ sleep([0, 0.4 - (Time.now - @start_time)].max) if @start_time
62
+ end
63
+
64
+ def self.show_update_status(gem_name, current_version)
65
+ wait_for_results unless update_available?(gem_name, current_version)
66
+ show_update_message(gem_name, current_version) if update_available?(gem_name, current_version)
67
+ end
68
+
69
+ # Show a message to the user to update to a new version of u3d
70
+ # Use this method, as this will detect the current Ruby environment and show an
71
+ # appropriate message to the user
72
+ def self.show_update_message(gem_name, current_version)
73
+ available = server_results[gem_name]
74
+ puts("")
75
+ puts('#######################################################################')
76
+ if available
77
+ puts("# #{gem_name} #{available} is available. You are on #{current_version}.")
78
+ else
79
+ puts("# An update for #{gem_name} is available. You are on #{current_version}.")
80
+ end
81
+ puts("# You should use the latest version.")
82
+ puts("# Please update using `#{update_command(gem_name: gem_name)}`.")
83
+
84
+ # this could be fetched from the gem
85
+ puts("# To see what's new, open https://github.com/DragonBox/#{gem_name}/releases.") if U3dCore::Env.truthy?("U3D_HIDE_CHANGELOG")
86
+
87
+ if !Helper.bundler? && Random.rand(5) == 1
88
+ # We want to show this message from time to time, if the user doesn't use bundler
89
+ puts('#######################################################################')
90
+ puts("# Run `sudo gem cleanup` from time to time to speed up u3d")
91
+ end
92
+ puts('#######################################################################')
93
+ Changelog.show_changes(gem_name, current_version, update_gem_command: UpdateChecker.update_command(gem_name)) unless U3dCore::Env.truthy?("U3D_HIDE_CHANGELOG")
94
+
95
+ ensure_rubygems_source
96
+ end
97
+
98
+ # The command that the user should use to update the gem
99
+ def self.update_command(gem_name)
100
+ if Helper.bundler?
101
+ "bundle update #{gem_name.downcase}"
102
+ else
103
+ "sudo gem install #{gem_name.downcase}"
104
+ end
105
+ end
106
+
107
+ # Check if RubyGems is set as a gem source
108
+ # on some machines that might not be the case
109
+ # and then users can't find the update when
110
+ # running the specified command
111
+ def self.ensure_rubygems_source
112
+ return if `gem sources`.include?("https://rubygems.org")
113
+
114
+ puts("")
115
+ UI.error("RubyGems is not listed as your Gem source")
116
+ UI.error("You can run `gem sources` to see all your sources")
117
+ UI.error("Please run the following command to fix this:")
118
+ UI.command("gem sources --add https://rubygems.org")
119
+ end
120
+
121
+ def self.fetch_latest(gem_name)
122
+ JSON.parse(U3d::Utils.page_content(generate_fetch_url(gem_name)))["version"]
123
+ end
124
+
125
+ def self.generate_fetch_url(gem_name)
126
+ "https://rubygems.org/api/v1/gems/#{gem_name}.json"
127
+ end
128
+ end
129
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Copyright (c) 2016-present WeWantToKnow AS
3
5
  #
data/lib/u3d_core.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Copyright (c) 2016-present WeWantToKnow AS
3
5
  #
@@ -27,5 +29,8 @@ require 'u3d_core/credentials'
27
29
  require 'u3d_core/ui/ui'
28
30
  require 'u3d_core/command_executor'
29
31
  require 'u3d_core/command_runner'
32
+ require 'u3d_core/env'
33
+ require 'u3d_core/update_checker/changelog'
34
+ require 'u3d_core/update_checker/update_checker'
30
35
  require 'colored'
31
36
  require 'commander'
data/u3d.gemspec CHANGED
@@ -1,4 +1,6 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'u3d/version'
4
6
 
@@ -8,7 +10,7 @@ Gem::Specification.new do |spec|
8
10
  spec.authors = ["Jerome Lacoste", "Paul Niezborala"]
9
11
  spec.email = 'jerome@wewanttoknow.com'
10
12
 
11
- spec.required_ruby_version = '>= 2.1.0'
13
+ spec.required_ruby_version = '>= 2.5.0'
12
14
 
13
15
  spec.summary = "U3d"
14
16
  spec.description = U3d::DESCRIPTION
@@ -25,19 +27,27 @@ Gem::Specification.new do |spec|
25
27
 
26
28
  spec.add_dependency 'colored', '>= 1.2', '< 2.0.0' # terminal
27
29
  spec.add_dependency 'commander', '>= 4.4.0', '< 5.0.0' # CLI parser
28
- spec.add_dependency 'file-tail', '>= 1.2.0'
29
30
  spec.add_dependency 'filesize', '>= 0.1.1' # File sizes prettifier
31
+ spec.add_dependency 'file-tail', '>= 1.2.0'
30
32
  spec.add_dependency 'inifile', '>= 3.0.0', '< 4.0.0' # Parses INI files
31
33
  spec.add_dependency 'plist', '>= 3.1.0', '< 4.0.0' # Generate the Xcode config plist file
34
+ spec.add_dependency "rexml" # rexml was unbundled from the stdlib in ruby 3
32
35
  spec.add_dependency 'rubyzip', '>= 1.0.0' # Installation of .zip files
33
36
  spec.add_dependency 'security', '= 0.1.3' # macOS Keychain manager, a dead project, no updates expected
34
37
  # Development only
35
- spec.add_development_dependency "bundler", "~> 1.13"
38
+ spec.add_development_dependency "activesupport", ">= 5.2.4.3" # force secure transitive dep
39
+ spec.add_development_dependency "addressable", ">= 2.8.0" # force secure transitive dep
40
+ spec.add_development_dependency "bundler", "~> 2.0"
36
41
  spec.add_development_dependency "coveralls"
37
- spec.add_development_dependency "github_changelog_generator"
38
- spec.add_development_dependency "pry-byebug"
39
- spec.add_development_dependency "rake", "~> 10.0"
40
- spec.add_development_dependency "rspec", "~> 3.1.0"
41
- spec.add_development_dependency 'rspec_junit_formatter', '~> 0.2.3'
42
- spec.add_development_dependency 'rubocop', '~> 0.52.1'
42
+ spec.add_development_dependency "excon", ">= 0.71.0" # force secure transitive dep
43
+ spec.add_development_dependency "github_changelog_generator", ">= 1.16.4"
44
+ spec.add_development_dependency "json", ">= 2.3.0" # force secure transitive dep
45
+ # spec.add_development_dependency "pry-byebug"
46
+ spec.add_development_dependency "rake", ">= 12.3.3"
47
+ spec.add_development_dependency "rspec", "~> 3.11.0"
48
+ spec.add_development_dependency 'rspec_junit_formatter', '~> 0.5.1'
49
+ spec.add_development_dependency 'rubocop', '~> 1.27'
50
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
51
+ # spec.add_development_dependency 'rubocop-rspec', '~> 2.10.0'
52
+ spec.metadata['rubygems_mfa_required'] = 'true'
43
53
  end