Class: DyCI::UninstallCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/dyci/commands/uninstall_command.rb

Class Method Summary collapse

Class Method Details

.plugins_dirObject



40
41
42
43
44
45
# File 'lib/dyci/commands/uninstall_command.rb', line 40

def self.plugins_dir
  user_dir = File.expand_path("~")
  plugins_dir = "#{user_dir}/Library/Application Support/Developer/Shared/Xcode/Plug-ins"
  FileUtils.mkdir_p plugins_dir
  plugins_dir
end

.restore_clangObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/dyci/commands/uninstall_command.rb', line 10

def self.restore_clang
  developer_path = %x[ xcode-select -print-path ].chomp
  clang_path = "#{developer_path}/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  clang_backup_path = "#{clang_path}.backup"
  if File.exists? clang_backup_path
    print "Restore clang."
    %x[ sudo mv #{clang_backup_path} #{clang_path} ]
    puts "Done."
  end
end

.run(args) ⇒ Object



3
4
5
6
7
8
# File 'lib/dyci/commands/uninstall_command.rb', line 3

def self.run args
  uninstall_appcode_plugin
  uninstall_xcode_plugin "DyCIFakeClang"
  uninstall_xcode_plugin "DyCIHelper"
  restore_clang
end

.uninstall_appcode_pluginObject



21
22
23
24
25
26
27
28
29
# File 'lib/dyci/commands/uninstall_command.rb', line 21

def self.uninstall_appcode_plugin
  app_code_path = "#{File.expand_path '~'}/Library/Preferences/appCode10"
  app_code_plugin_path = "#{app_code_path}/tools/DyCIPlugin.xml"
  if File.exists? app_code_plugin_path
    print "Removing AppCode plugin. "
    FileUtils.remove_file app_code_plugin_path
    puts "Done."
  end
end

.uninstall_xcode_plugin(plugin_name) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/dyci/commands/uninstall_command.rb', line 31

def self.uninstall_xcode_plugin plugin_name
  plugin_path = "#{plugins_dir}/#{plugin_name}.xcplugin" 
  if File.exists? plugin_path
    print "Removing #{plugin_name}. "
    FileUtils.rm_rf plugin_path
    puts "Done."
  end
end