fewald-worklog 0.2.22 → 0.2.24

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/lib/storage.rb +0 -7
  4. data/lib/worklog.rb +13 -2
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03ec04755ea87ebd6808b5b9256ad07a0c95514e35ed719628531cbb5cb5a0d9
4
- data.tar.gz: e8c62ab27e88132df53066704a09d0baf585b1c5208c1c2481e0b3940f69419c
3
+ metadata.gz: 3a7181642148629e59e3614c32ef37ed26f26f7378938281a86aee3650e0b5ac
4
+ data.tar.gz: 81f01771c514a785a167137bfec4bcbe30ea439b8463aead1e250457183ca1c7
5
5
  SHA512:
6
- metadata.gz: e735b3fb91b5125e6607e2a2b018fd41038f8b02c32c31fc8bd0f2f56f87ec40ede9731361071071e752addd260f10b65a50bc6678aa8b6d8618bba0acfa975d
7
- data.tar.gz: 85a223a42f4b88a1957e74f570aca7eac3f879a8967b2a40dc266e192b4a36142ae82635df11cb22fb1d1fc941cffa6bd0c3a4b1ba131bec179c1a60913dacca
6
+ metadata.gz: 4d06035360616307b8e2549507816646f5d84b1a8af39d5972501101715745d713bf3804331d588e0f58e5f420a67dc8425feb0e14f5a835d28ac1c5acfefbf7
7
+ data.tar.gz: 716f3acd323acda5ee7be96bbb060615b21746fe7a3219a74276d7fc819679f4f3cad10b29e88c649e93dd1ff0b29d92f2f9ad1b61ce934accc5593d23ab8781
data/.version CHANGED
@@ -1 +1 @@
1
- 0.2.22
1
+ 0.2.24
data/lib/storage.rb CHANGED
@@ -6,10 +6,6 @@ require 'log_entry'
6
6
  require 'worklogger'
7
7
  require 'person'
8
8
 
9
- # Alias for classes to handle existing log entries
10
- DailyLog = Worklog::DailyLog
11
- LogEntry = Worklog::LogEntry
12
-
13
9
  module Worklog
14
10
  # Handles storage of daily logs and people
15
11
  class Storage
@@ -110,9 +106,6 @@ module Worklog
110
106
 
111
107
  def load_log!(file)
112
108
  WorkLogger.debug "Loading file #{file}"
113
-
114
- # Alias DailyLog to Worklog::DailyLog
115
-
116
109
  begin
117
110
  yaml_content = File.read(file)
118
111
  cleaned_yaml = yaml_content.gsub(%r{!ruby/object:[^\s]+}, '')
data/lib/worklog.rb CHANGED
@@ -261,6 +261,7 @@ module Worklog
261
261
  end
262
262
  end
263
263
 
264
+ # Show overview of all tags used in the work log including their count.
264
265
  def tag_overview
265
266
  all_logs = @storage.all_days
266
267
  puts Rainbow('Tags used in the work log:').gold
@@ -268,11 +269,21 @@ module Worklog
268
269
  # Count all tags used in the work log
269
270
  tags = all_logs.map(&:entries).flatten.map(&:tags).flatten.compact.tally
270
271
 
272
+ # Calculate the maximum count for scaling the output if needed
273
+ max_count = tags.values.max || 0
274
+ factor = 32.0 / max_count # Scale to a maximum of 32 characters wide
275
+
276
+ # Calculate longest number length for formatting
277
+ num_length = max_count.to_s.length
278
+
271
279
  # Determine length of longest tag for formatting
272
- # Add one additonal space for formatting
280
+ # Add one additional space for formatting
273
281
  max_len = tags.empty? ? 0 : tags.keys.map(&:length).max + 1
274
282
 
275
- tags.sort.each { |k, v| puts "#{Rainbow(k.ljust(max_len)).gold}: #{v} #{pluralize(v, 'occurrence')}" }
283
+ tags.sort.each do |k, v|
284
+ print "#{Rainbow(k.to_s.rjust(max_len)).gold}: #{v.to_s.rjust(num_length)} "
285
+ puts '#' * (v * factor).ceil
286
+ end
276
287
  end
277
288
 
278
289
  # Show detailed information about a specific tag
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fewald-worklog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.22
4
+ version: 0.2.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Friedrich Ewald