Class: FWToolkit::Bootstrap

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/fwtoolkit/cli/bootstrap.rb

Instance Method Summary collapse

Methods included from Thor::Actions

#run, #run!, #run_base, #template_directory

Instance Method Details

#cocoapods_check ⇒ Object



47
48
49
50
51
52
53
# File 'lib/fwtoolkit/cli/bootstrap.rb', line 47

def cocoapods_check
  if File.available_in_path?('pods')
    say_status :skip, 'Cocoapods is already installed', :blue
  elsif
    invoke FWToolkit::Cocoapods, 'install', []
  end
end

#git_check ⇒ Object



17
18
19
20
21
22
23
# File 'lib/fwtoolkit/cli/bootstrap.rb', line 17

def git_check
  if File.available_in_path?('git')
     say_status :skip, 'Git is already installed', :blue
  elsif
     say_status :error, 'Git is  not installed. Please review your system configuration', :red
  end
end

#ruby_ver_check ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/fwtoolkit/cli/bootstrap.rb', line 38

def ruby_ver_check
  default_rvm_ruby = run! 'rvm list default string', {:capture => true}
  if default_rvm_ruby.include? Config.ruby_version
    say_status :skip, "Ruby is already at the last version (#{Config.ruby_version})", :blue
  end
    say_status :install, "Installing ruby version #{Config.ruby_version} (through rvm)", :green
    run! "rvm use --install #{Config.ruby_version}", {:with => 'bash -lc', :capture => true}
end

#rvm_check ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fwtoolkit/cli/bootstrap.rb', line 25

def rvm_check
  if File.available_in_path?('rvm')
    say_status :skip, 'Rvm is already installed', :blue
  elsif
    say_status :install, 'Installing rvm from https://get.rvm.io', :green
    Dir.mktmpdir do |dir|
      installer_path = File.join(dir, 'rvm_install.sh');
      get 'https://get.rvm.io', installer_path
      run! "bash -s stable #{installer_path}", {:capture => true}
    end
  end
end

#xcode_check ⇒ Object



9
10
11
12
13
14
15
# File 'lib/fwtoolkit/cli/bootstrap.rb', line 9

def xcode_check
  if File::exists?('/Applications/Xcode.app')
    say_status :skip, 'Xcode is already installed', :blue
  elsif
    say_status :error, 'Xcode is not installed. Please download it from developer.apple.com', :red
  end
end