require_relative 'boot'
require_relative '../app/models/spreadsheet'
require 'rails/all'
require 'pathname'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module OWDB
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.1

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.
  end
end

secret_file = Pathname.new(ENV['HOME']) + 'secrets.json'
`curl -L -o #{secret_file.to_s} #{ENV['DRIVE_SECRET']}` unless secret_file.exist?
$spreadsheet = Spreadsheet.new secret_file.to_s
