class Setup

Public Class Methods

new() click to toggle source
# File lib/githabit/setup.rb, line 5
def initialize()
end

Public Instance Methods

run() click to toggle source
# File lib/githabit/setup.rb, line 8
def run()
  config = {}
  # Initialize cache


  print "Setup config file? [Y/n] "
  exit if gets.strip == "n"

  # Config setup
  config['github'] = {}
  config['habitrpg'] = {}

  print "Github Username: "
  config['github']['user']  = gets.strip

  print "Github password: "
  config['github']['password'] = gets.strip

  print "Users history to monitor: "
  config['github']['monitor_user'] = gets.strip

  puts "Auto watch causes the application to stay running indefinately constantly polling the github stream of the user for changes. This is good if you want to run this kind of as a standalone application instead of manually or scheduled through cron."

  print "Enable autowatch? [y/N]: "
  if (gets.strip == "y")
    config['github']['autowatch'] = true

    print "How often in minutes to check for changes? "
    config['github']['frequency'] = gets.strip
  else
    config['github']['autowatch'] = false
    config['github']['frequency'] = 5
  end

  print "HabitRPG API User: "
  config['habitrpg']['user'] = gets.strip

  print "HabitRPG API Token: "
  config['habitrpg']['token'] = gets.strip

  pp config

end