class GitWakaTime::Configuration

Stores primary config and project information Currently not thread safe.

Attributes

api_key[RW]
git[RW]
log_level[RW]
project[RW]
root[RW]

Public Class Methods

new() click to toggle source
# File lib/gitwakatime.rb, line 36
def initialize
  self.api_key = nil
  self.log_level = :info
end

Public Instance Methods

create_commited_files_table() click to toggle source
# File lib/gitwakatime.rb, line 70
def create_commited_files_table
  DB.create_table? :commited_files do
    primary_key :id
    integer :commit_id
    String :dependent_sha
    DateTime :dependent_date
    integer :time_in_seconds, default: 0
    String :sha
    String :name
    String :entity
    String :project
    index :dependent_sha
    index :sha
  end
end
create_commits_table() click to toggle source
# File lib/gitwakatime.rb, line 57
def create_commits_table
  DB.create_table? :commits do
    primary_key :id
    String :sha
    String :parent_sha
    String :project
    integer :time_in_seconds, default: 0
    datetime :date
    text :message
    String :author
  end
end
create_heartbeats_table() click to toggle source
# File lib/gitwakatime.rb, line 86
def create_heartbeats_table
  DB.create_table? :heartbeats do
    primary_key :id
    String :uuid
    DateTime :time
    integer :duration, default: 0
    String :entity
    String :type
    String :branch
    String :project
    index :uuid, unique: true
  end
end
load_config_yaml() click to toggle source
# File lib/gitwakatime.rb, line 45
def load_config_yaml
  yaml = YAML.load_file(File.join(Dir.home, '.wakatime.yml'))
  self.api_key = yaml[:api_key]
  self.log_level = yaml[:log_level]
end
setup_local_db() click to toggle source
# File lib/gitwakatime.rb, line 51
def setup_local_db
  create_commits_table
  create_commited_files_table
  create_heartbeats_table
end
user_name() click to toggle source
# File lib/gitwakatime.rb, line 41
def user_name
  GitWakaTime.config.git.config('user.name')
end