class Gitrob::CLI::Commands::AcceptTermsOfUse

Constants

AGREEMENT
AGREEMENT_FILE_PATH
LICENSE_FILE_PATH
POSITIVE_ANSWERS
VALID_ANSWERS

Public Class Methods

new(options) click to toggle source
# File lib/gitrob/cli/commands/accept_terms_of_use.rb, line 23
def initialize(options)
  @options = options
  return if terms_of_use_accepted?
  present_terms_of_use
  handle_user_input
end

Private Instance Methods

accept_terms_of_use() click to toggle source
# File lib/gitrob/cli/commands/accept_terms_of_use.rb, line 49
def accept_terms_of_use
  File.open(AGREEMENT_FILE_PATH, "w") do |file|
    file.write("user accepted")
  end
end
handle_user_input() click to toggle source
# File lib/gitrob/cli/commands/accept_terms_of_use.rb, line 41
def handle_user_input
  if agree("\n\nDo you agree to the terms of use? (y/n): ".light_green)
    accept_terms_of_use
  else
    fatal("Exiting Gitrob.")
  end
end
license() click to toggle source
# File lib/gitrob/cli/commands/accept_terms_of_use.rb, line 55
def license
  File.read(LICENSE_FILE_PATH)
end
present_terms_of_use() click to toggle source
# File lib/gitrob/cli/commands/accept_terms_of_use.rb, line 36
def present_terms_of_use
  output "\n#{license}\n\n"
  output AGREEMENT.light_red
end
terms_of_use_accepted?() click to toggle source
# File lib/gitrob/cli/commands/accept_terms_of_use.rb, line 32
def terms_of_use_accepted?
  File.exist?(AGREEMENT_FILE_PATH)
end