Class: GitWakaTime::Configuration
- Inherits:
-
Object
- Object
- GitWakaTime::Configuration
- Defined in:
- lib/gitwakatime.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#git ⇒ Object
Returns the value of attribute git.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#project ⇒ Object
Returns the value of attribute project.
-
#root ⇒ Object
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #load_config_yaml ⇒ Object
- #setup_local_db ⇒ Object
- #user_name ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 |
# File 'lib/gitwakatime.rb', line 27 def initialize self.api_key = nil self.log_level = :info end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
25 26 27 |
# File 'lib/gitwakatime.rb', line 25 def api_key @api_key end |
#git ⇒ Object
Returns the value of attribute git.
25 26 27 |
# File 'lib/gitwakatime.rb', line 25 def git @git end |
#log_level ⇒ Object
Returns the value of attribute log_level.
25 26 27 |
# File 'lib/gitwakatime.rb', line 25 def log_level @log_level end |
#project ⇒ Object
Returns the value of attribute project.
25 26 27 |
# File 'lib/gitwakatime.rb', line 25 def project @project end |
#root ⇒ Object
Returns the value of attribute root.
25 26 27 |
# File 'lib/gitwakatime.rb', line 25 def root @root end |
Instance Method Details
#load_config_yaml ⇒ Object
36 37 38 39 40 |
# File 'lib/gitwakatime.rb', line 36 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 ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/gitwakatime.rb', line 42 def setup_local_db 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 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 :project index :dependent_sha index :sha end DB.create_table? :actions do primary_key :id String :uuid DateTime :time integer :duration, default: 0 String :file String :branch String :project index :uuid, unique: true end end |
#user_name ⇒ Object
32 33 34 |
# File 'lib/gitwakatime.rb', line 32 def user_name GitWakaTime.config.git.config('user.name') end |