require 'fileutils'
no_doc = RUBY_VERSION.to_f > 2.5 ? "--no-document" : "--no-ri --no-rdoc" 

# ffi and sqlite3 gems might need to re-install with DevKit (recompile for your machine)
# the way: add "--platform=ruby"
output = `gem list sqlite3`
if output.include?("sqlite3 (")
  puts("sqlite3 already installed.")  
else
  system("gem install #{no_doc} --platform=ruby sqlite3")
end

output = `gem list ffi`
if output.include?("ffi (1.11")
  puts("ffi already installed")
else
  system("gem install #{no_doc} --platform=ruby ffi")    
end

if File.exist?("del Gemfile.install.lock")
  FileUtils.rm("del Gemfile.install.lock")  
end

# if alerady installed bundler 1, may comment out the next line
# system("gem install --no-document bundler --version 1.17.3")
# use bundler 1 (there is one gem depended on it)
# system("bundle _1.17.3_ install --gemfile=Gemfile.install")

system("bundle install --gemfile=Gemfile.install")
