Module: GitHub::Config

Defined in:
lib/github_api/config.rb

Overview

Keeps all the configuration stuff

Constant Summary collapse

Path =

Constant with defined all the paths used in the application

{:dir => ENV['HOME'] + "/.github", :dbfile => ENV['HOME'] + "/.github/github.db", :migrations => Gem.loaded_specs['github-api-client'].full_gem_path +  "/db/migrate", :secrets => ENV['HOME'] + "/.github" + "/secrets.yml"}
Secrets =

Secrets array, uses env vars if defined

{"login" => ENV['GITHUB_USER'], "token" => ENV['GITHUB_TOKEN']}

Class Method Summary collapse

Class Method Details

.setupnil

Sets up the database and migrates it

Returns:

  • (nil)


28
29
30
31
32
# File 'lib/github_api/config.rb', line 28

def self.setup
  Dir.mkdir GitHub::Config::Path[:dir] rescue nil
  ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => GitHub::Config::Path[:dbfile]
  ActiveRecord::Migrator.migrate(GitHub::Config::Path[:migrations], nil)
end