Class: PluginsUpdater

Inherits:
Object
  • Object
show all
Extended by:
CLI
Defined in:
lib/plugins_updater.rb

Class Method Summary collapse

Methods included from CLI

chown_if_required, codesign_exists?, dry_run?, no_colors?, non_interactive?, restore_xcode?, separator, unsign_xcode?, update_plugins?

Class Method Details

.update_pluginsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/plugins_updater.rb', line 7

def self.update_plugins
  xcodes = Xcode.find_xcodes

  if xcodes.empty?
    error "没有发现任何安装的 Xcode"
    return
  else
    title '已找到'
    puts xcodes.map { |xcode| "- #{xcode.detailed_description}" }
  end

  separator

  plugins = XcodePlugin.find_plugins

  if plugins.empty?
    error "未发现任何已安装的Xcode插件"
    return
  else
    title '插件:'
    puts plugins.map { |s| "- #{s}" }
  end

  separator
  process '更新UUID...'

  uuids = xcodes.collect(&:uuid)
  uuids.each do |uuid|
    plugins.each do |plugin|
      if plugin.add_uuid(uuid) && !CLI.dry_run?
        success "添加 #{uuid}#{plugin}"
      end
    end
  end

  separator
  success '完成! 🎉'

  return if CLI.no_colors?

  # if xcodes.any? { |xcode| xcode.version.to_f >= 8 }
  #   separator
  #   warning 'It seems that you have Xcode 8+ installed!'
  #   puts 'Some plugins might not work on recent versions of Xcode because of library validation.',
  #        "See #{'https://github.com/alcatraz/Alcatraz/issues/475'.underline}"

  #   separator
  #   puts "Run `#{'update_xcode_plugins --unsign'.bold}` to fix this."
  # end
end