|
| 1 | + |
| 2 | +# The script is for easy install of the gems Eve requires |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +# This function checks if a gem is installed and installs it if it isn't |
| 8 | +def install_check(gem) |
| 9 | + say "Checking if '#{gem}' is installed." |
| 10 | + if system('gem list -i "^#{gem}$"') # This ensures we don't get a false positive |
| 11 | + say "Found '#{gem}'." |
| 12 | + else |
| 13 | + say "Gem '#{gem}' is not installed, installing..." |
| 14 | + system("gem install #{gem}") |
| 15 | + say "Installation of '#{gem}' successful!" |
| 16 | + end |
| 17 | +end |
| 18 | + |
| 19 | +# This function is for installing highline to make output pretty |
| 20 | +def install_highline |
| 21 | + puts "In order to continue with automatic installation 'highline' is required!" |
| 22 | + puts "Should I install the 'highline' gem now? [y/n]:" |
| 23 | + answer = gets.chomp |
| 24 | + if answer.downcase != 'y' |
| 25 | + puts "Highline is needed to proceed! Exiting in 3 seconds..." |
| 26 | + puts "Please see documentation for manual install." |
| 27 | + sleep 3 |
| 28 | + system("kill #{Process.pid}") |
| 29 | + else |
| 30 | + system("gem install highline") |
| 31 | + end |
| 32 | +end |
| 33 | + |
| 34 | +# Here we check to see if highline is installed |
| 35 | +puts "Checking to see if 'highline' is installed..." |
| 36 | +if system('gem list -i "^highline$"') |
| 37 | + puts "Looks like 'highline' is already installed, good!" |
| 38 | + sleep 2 |
| 39 | +else |
| 40 | + puts "Looks like 'highline' is NOT installed" |
| 41 | + install_highline # Install highline if it's not |
| 42 | +end |
| 43 | + |
| 44 | +# Prepare script to use highline |
| 45 | +require 'highline/import' |
| 46 | +cli = HighLine.new |
| 47 | +system("clear") |
| 48 | + |
| 49 | +# Start main script, ask if they wanna update their gems |
| 50 | +say "Welcome to eve6!" |
| 51 | +if agree("Would you like to run an update on your Ruby Gems? [y/n]: ", true) |
| 52 | + system("gem update") |
| 53 | + say("Your gems have been updated!") |
| 54 | +else |
| 55 | + say("Ok! Continuing without updating...") |
| 56 | +end |
| 57 | + |
| 58 | +# Confirm that they want us installing gems |
| 59 | +say "This script is for use if you plan on using a full-featured Eve." |
| 60 | +say "We will install things to your system using gems." |
| 61 | +if agree("Would you like to proceed? [y/n]: ", true) |
| 62 | + say "Alright! Proceeding with framework install!" |
| 63 | +else |
| 64 | + say "Please see documentation to continue." |
| 65 | + system("kill #{Process.pid}") |
| 66 | +end |
| 67 | + |
| 68 | +# Start checking for bundler, and then install based on Gemfile |
| 69 | +say "Checking basic dependencies..." |
| 70 | + |
| 71 | +install_check("bundler") |
| 72 | +say "Using Bundler to install needed gems..." |
| 73 | +system *%W[bundler install --system] |
| 74 | + |
| 75 | +say "Required dependencies for eve6 now installed." |
| 76 | +say "Once you've configured Eve you can start it using: ruby Eve.rb" |
| 77 | + |
| 78 | +system("kill #{Process.pid}") # End program |
| 79 | + |
0 commit comments