obst 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 242b86d9f4b9803a8ec4b2bf0b6f607fe2c96fce7c6e866e33cb6d825bdd4034
4
- data.tar.gz: 1185c3a07dfebee41587ca1798162f91d5ad4b8523e37ba2fb666736249ed9af
3
+ metadata.gz: a5789a008e6c945b5ec70d5e7fc26f14ddebde0a68bb7439e1b1d7cb704a430a
4
+ data.tar.gz: c765b723bb0761c7b99511d27138dccb0df126197b1d322fef9a5f8c655dc096
5
5
  SHA512:
6
- metadata.gz: fd6a577d0285df5afdbc8001b054da94085a94430bc2b71cb0c720582bfd3a14b319d8741d3635bcff8ed5cf078370d33c296a3a445f1dcb0d79612b80021fb9
7
- data.tar.gz: f9cc2c8f792fef0a4b043e7065b2e4db232fcbd01be8c9287e8bb081b68f5a6953cb73d910b9160ec3a81ac6daeaa459c5ce04c77bf1f806aaf6154d559e39d4
6
+ metadata.gz: ea12a1c66ba26cea6744579da6954119bdb9902899e6903430349b36fab3b9ee464b1b0e1acdcd73b6e3e7f364dbdc595f9c115654989a98d1a4cdd440d902c3
7
+ data.tar.gz: 03b54cfde71edf09ffc5629be69633195c6b51ec1ffed1fa7fc132263a644e7cc61342de951ab217eb93e81c692d2de591748350f8f3d84cba9717d6b1edd1f5
@@ -4,23 +4,21 @@ module Obst
4
4
  class TouchedFiles
5
5
  def initialize(**opts)
6
6
  @path = opts[:C]
7
- @buffer = []
7
+ @buffer = ["# Touch files in periods\n"]
8
8
  end
9
9
 
10
10
  def to_s
11
11
  last_7_days
12
- @buffer << ''
13
12
  last_4_weeks_without_last_7_days
14
- @buffer << ''
15
13
  last_3_months_without_last_4_weeks
16
14
  @buffer.join("\n")
17
15
  end
18
16
 
19
17
  def last_7_days
20
- @buffer << "# Last 7 days\n"
18
+ @buffer << "- Last 7 days"
21
19
 
22
20
  GroupByDays.new(C: @path).take(7).each do |record|
23
- @buffer << "- #{record.date_wday} (#{record.file_changes.count})"
21
+ @buffer << "\t- #{record.date_wday} (#{record.file_changes.count})"
24
22
  list_files(record)
25
23
  end
26
24
  end
@@ -28,10 +26,10 @@ module Obst
28
26
  def last_4_weeks_without_last_7_days
29
27
  before = (Time.now - (60 * 60 * 24 * 7)).strftime('%FT23:59:59')
30
28
 
31
- @buffer << "# 3 weeks earlier\n"
29
+ @buffer << "- 1 week ago"
32
30
 
33
- GroupByDays.new(C: @path, before: before, days: 7).take(3).each do |record|
34
- @buffer << "- #{record.time} (#{record.file_changes.count})"
31
+ GroupByDays.new(C: @path, before: before, days: 7).take(3).each_with_index do |record, i|
32
+ @buffer << "\t- #{record.time} is #{1+i}.week#{suffix_s(i)}.ago (#{record.file_changes.count})"
35
33
  list_files(record)
36
34
  end
37
35
  end
@@ -39,10 +37,10 @@ module Obst
39
37
  def last_3_months_without_last_4_weeks
40
38
  before = (Time.now - (60 * 60 * 24 * 28)).strftime('%FT23:59:59')
41
39
 
42
- @buffer << "# 1 month earlier\n"
40
+ @buffer << "- 1 month ago"
43
41
 
44
- GroupByDays.new(C: @path, before: before, days: 28).take(2).each do |record|
45
- @buffer << "- #{record.time} (#{record.file_changes.count})"
42
+ GroupByDays.new(C: @path, before: before, days: 28).take(2).each_with_index do |record, i|
43
+ @buffer << "\t- #{record.time} is #{1+i}.month#{suffix_s(i)}.ago (#{record.file_changes.count})"
46
44
  list_files(record)
47
45
  end
48
46
  end
@@ -60,12 +58,16 @@ module Obst
60
58
  files = group_by_final_status[short]
61
59
  next if files.empty?
62
60
  inline_str = inline(files)
63
- @buffer << "\t- <font color='#{color}'>#{long} #{files.count}:</font> #{inline_str}"
61
+ @buffer << "\t\t- <font color='#{color}'>#{long} #{files.count}:</font> #{inline_str}"
64
62
  end
65
63
  end
66
64
 
67
65
  def inline(files)
68
66
  files.sort!.map{ |name| "[[#{name}]]" }.join(' / ')
69
67
  end
68
+
69
+ def suffix_s(i)
70
+ i == 0 ? '' : 's'
71
+ end
70
72
  end
71
73
  end
data/lib/obst/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Obst
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obst
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-26 00:00:00.000000000 Z
11
+ date: 2022-11-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: