Class: RocketFuel::Fix::CommandLineToolFix

Inherits:
AbstractFix
  • Object
show all
Includes:
Thor::Base
Defined in:
lib/rocket_fuel/fix/command_line_tool_fix.rb

Constant Summary collapse

ACCOUNT_CREATION_URL =
'https://developer.apple.com/register/index.action'
APPLESCRIPT_PATH =
File.join(File.dirname(__FILE__),
'command_line_tools', 'install.applescript')

Instance Method Summary collapse

Methods inherited from AbstractFix

#check, fix_name, fix_name_value, register!

Instance Method Details

#messageObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rocket_fuel/fix/command_line_tool_fix.rb', line 44

def message
  'Installing Ruby requires a C compiler. For the Mac, Apple provides ' +
  'a package known as "Command Line Tools" which includes a C compiler. ' +
  'In order to download these tools, you must create an Apple Developer ' +
  "account @ #{ACCOUNT_CREATION_URL}. Once " +
  'you\'ve created an account, you can download the version of command ' +
  'line tools appropriate for your version of OS X at ' +
  'https://developer.apple.com/downloads/index.action' +
  'Our fix is available in an experimental capacity. Once you have ' +
  'created an Apple Developer account, invoke: ' +
  '`rocket_fuel fix command_line_tools` ' +
  'The fix involves an experimental script that will ask for your ' +
  'Apple ID and password. Please note that rocket_fuel NEVER stores ' +
  'your login information'
end

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rocket_fuel/fix/command_line_tool_fix.rb', line 15

def run
   = ask('Do you have an apple developer account?',
    :limited_to => ['y', 'n'])
  if  == 'n'
    say("Please register at #{ACCOUNT_CREATION_URL} and rerun " +
      "this command.")
    return false
  else
    routine = CommandLineTools::DownloadRoutine.new
    say('')
    say('Downloading Command Line Tools. ' +
      'You will be prompted for your Apple account and password. ' +
      'NOTE: rocket_fuel never stores your Apple account or password.')
    dmg_path = routine.run
    say('Done.')

    install = CommandLineTools::Install.new(dmg_path)
    say('')
    say("Installing Command Line Tools. " +
      "You will be prompted for your sudo password.")
    install.run
    say('Done.')
  end
end

#titleObject



40
41
42
# File 'lib/rocket_fuel/fix/command_line_tool_fix.rb', line 40

def title
  'Command Line Tools must be installed for you to install ruby!'
end