Class: EasyAuto::EasySetup

Inherits:
Object
  • Object
show all
Includes:
ConfigManagerWrapper, SystemHelper
Defined in:
lib/easy_auto/easy_setup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SystemHelper

#check_install, #cli_send, #os

Methods included from ConfigManagerWrapper

#config_manager

Instance Attribute Details

#emailObject

Returns the value of attribute email.



8
9
10
# File 'lib/easy_auto/easy_setup.rb', line 8

def email
  @email
end

#passwordObject

Returns the value of attribute password.



9
10
11
# File 'lib/easy_auto/easy_setup.rb', line 9

def password
  @password
end

Instance Method Details

#check_authorizationObject



24
25
26
27
28
29
30
31
32
# File 'lib/easy_auto/easy_setup.rb', line 24

def check_authorization
  Octokit::Client.new(login: config_manager.github_email, access_token: config_manager.github_token).user
rescue Faraday::Error::ConnectionFailed => e
  p e
  p "It appears you had an SSL error. Read http://mislav.uniqpath.com/2013/07/ruby-openssl/ to fix it."
rescue
  puts "make sure you have octokit installed and have run easy-authorize!"
  system_exit
end

#check_git_extras_installObject



42
43
44
# File 'lib/easy_auto/easy_setup.rb', line 42

def check_git_extras_install
  check_install "git-extras"
end

#check_git_installObject



38
39
40
# File 'lib/easy_auto/easy_setup.rb', line 38

def check_git_install
  check_install "git"
end

#os_checkObject



46
47
48
49
50
51
52
53
# File 'lib/easy_auto/easy_setup.rb', line 46

def os_check
  if os == "Linux" || os == "Darwin"
    puts "You have an acceptable os!"
  else
    puts "Sorry, your OS isn't supported."
    system_exit
  end
end

#runObject



11
12
13
14
15
16
17
18
# File 'lib/easy_auto/easy_setup.rb', line 11

def run
  setup_message
  os_check
  check_git_install
  check_git_extras_install
  check_authorization
  success_message
end

#setup_messageObject



55
56
57
# File 'lib/easy_auto/easy_setup.rb', line 55

def setup_message
  puts "this will check to make sure your computer is set up!"
end

#success_messageObject



34
35
36
# File 'lib/easy_auto/easy_setup.rb', line 34

def success_message
  puts "all set!"
end

#system_exitObject



20
21
22
# File 'lib/easy_auto/easy_setup.rb', line 20

def system_exit
  exit 1
end