git-fit 0.10.1 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f00d864bc0153b49693ed1071d589185132cf8bc406daaed05842785cd7755b
4
- data.tar.gz: 898585b7a36e5d4e65b9aec09dd2f51bed8ab29910c655e50a4120ca910298ff
3
+ metadata.gz: 77257605901cdd10a709540de4c851e9dc88363f01caaf5958be8af03bf8309e
4
+ data.tar.gz: ad58eb929563158796c13e50bc2761302b5f6925a427bd7beca5b0f418aab438
5
5
  SHA512:
6
- metadata.gz: 3cbc6a344ac658b3d02dbd48e60e45c1015f579229b8f1ac601710ac889f5551dd1d31869a7585592d67542862824aee19c028d715fcfb0157446b9e398a03bd
7
- data.tar.gz: 6613e3b0ed69d3236f75027f108f80cce8b32f7e57ad24d9d90a455ffe230bb6993feaf23caaf580b479409ed390960edbb9a732a5fa1d0cbd602cd4268f669a
6
+ metadata.gz: 632eb40baab1d63a04745c4b65d13344444f11ffb35cd7226e4b2b1156283f1d73740ed2c19e797a9b46db9ce528c5438f7559e7e54d1333375d796938303ba9
7
+ data.tar.gz: 5165dc77377ffd3f43afb2a9175f1255ee5e430c04fa8ca0e624ad4693aba83d57d88e6a347685af2177f1179cee953f2a48ea91a674d891c08a0329cbdf0fe1
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'thor'
4
4
  require 'fileutils'
5
+ require 'tzinfo'
5
6
  require 'stravaweb'
6
7
 
7
8
  module GitFit
@@ -67,6 +68,7 @@ module GitFit
67
68
  end
68
69
 
69
70
  client = build_client(jwt, auth_seed, cookie_path)
71
+ print_token_info(client)
70
72
  fmt_sym = format.to_sym
71
73
  stats = { success: 0, skipped: 0, failed: 0, token_errors: 0 }
72
74
 
@@ -98,6 +100,22 @@ module GitFit
98
100
  exit 1
99
101
  end
100
102
 
103
+ def print_token_info(client)
104
+ exp = client.expires_at
105
+ return unless exp
106
+
107
+ days = ((exp - Time.now) / 86_400).round
108
+ say "token: expires #{format_expiry(exp)} (#{days} days left)", :cyan
109
+ end
110
+
111
+ def format_expiry(exp)
112
+ zone = git_fit_config.dig('system', 'timezone')
113
+ local = TZInfo::Timezone.get(zone).utc_to_local(exp)
114
+ local.strftime('%Y-%m-%d %H:%M %Z')
115
+ rescue TZInfo::InvalidTimezoneIdentifier, ArgumentError
116
+ exp.getutc.strftime('%Y-%m-%d %H:%M UTC')
117
+ end
118
+
101
119
  def pending_ids(config, output_dir)
102
120
  db_path_val = options[:db] || config.db_path
103
121
  all_ids = begin
@@ -84,6 +84,9 @@ module GitFit
84
84
  @data['sync']['total_timeout'] =
85
85
  ENV['GIT_FIT_SYNC_TOTAL_TIMEOUT'].to_f
86
86
  end
87
+ if ENV['GIT_FIT_SYSTEM_TIMEZONE'] && !ENV['GIT_FIT_SYSTEM_TIMEZONE'].empty?
88
+ @data['system']['timezone'] = ENV['GIT_FIT_SYSTEM_TIMEZONE']
89
+ end
87
90
 
88
91
  GitFit.registered_configs.each do |reg|
89
92
  reg[:keys].each do |key|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitFit
4
- VERSION = '0.10.1'
4
+ VERSION = '0.10.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-fit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lax