From f6399c77a3e237e8ee5dd6ed3684d82bbaeaedc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Mon, 3 Aug 2015 07:40:00 +0300 Subject: [PATCH] Added the defaults in the library. --- bin/git-stats | 32 ++++---------------------------- lib/index.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/bin/git-stats b/bin/git-stats index 55642e3..f9fb996 100755 --- a/bin/git-stats +++ b/bin/git-stats @@ -1,7 +1,8 @@ #!/usr/bin/env node // Dependencies -var GitStats = new (require("../lib"))() +var GitStatsLib = require("../lib") + , GitStats = new GitStatsLib() , Ul = require("ul") , Moment = require("moment") , Logger = require("bug-killer") @@ -13,33 +14,8 @@ var GitStats = new (require("../lib"))() ; // Constants -const CONFIG_PATH = Abs("~/.git-stats-config.json") - , DEFAULT_CONFIG = { - // Dark theme by default - theme: "DARK" - - // This defaults in library - , path: undefined - - // This defaults in cli-gh-cal - , first_day: undefined - - // This defaults to *one year ago* - , since: undefined - - // This defaults to *now* - , until: undefined - - // This defaults to "DARK" -- this can be a - // string or an object - , theme: undefined - - // Don't show authors by default - , authors: false - - // No global activity by default - , global_activity: false - } +const CONFIG_PATH = GitStatsLib.CONFIG_PATH + , DEFAULT_CONFIG = GitStatsLib.DEFAULT_CONFIG ; // Configurations diff --git a/lib/index.js b/lib/index.js index 08f1f3b..3e48d8b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -22,6 +22,7 @@ const DATE_FORMAT = "MMM D, YYYY" , DEFAULT_DATA = { commits: {} } + , CONFIG_PATH = Abs("~/.git-stats-config.json") ; /** @@ -36,6 +37,35 @@ function GitStats(dataPath) { this.path = Abs(Deffy(dataPath, DEFAULT_STORE)); } +// Defaults +GitStats.CONFIG_PATH = CONFIG_PATH +GitStats.DEFAULT_CONFIG = { + // Dark theme by default + theme: "DARK" + + // This defaults in library + , path: undefined + + // This defaults in cli-gh-cal + , first_day: undefined + + // This defaults to *one year ago* + , since: undefined + + // This defaults to *now* + , until: undefined + + // This defaults to "DARK" -- this can be a + // string or an object + , theme: undefined + + // Don't show authors by default + , authors: false + + // No global activity by default + , global_activity: false +}; + /** * record * Records a new commit.