obst 0.1.2 → 0.1.3
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 +4 -4
- data/exe/obst +1 -9
- data/lib/obst/group_by_days.rb +1 -1
- data/lib/obst/pack_log.rb +23 -1
- data/lib/obst/touched_files.rb +58 -0
- data/lib/obst/version.rb +1 -1
- data/lib/obst.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98098746bf391bc2ef384eb8fd5f5a16ed462ecb2392aedafa4ad817a173afb6
|
4
|
+
data.tar.gz: a96c73fed2dcf4f6a14c695f8da6e08fb8f62e6e93d579d867971453b40b6dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a168e81dc31da12781806ebd4ab199ef5554d9293b39d3d7578085fc9bd3b5f1dcb7a0a8cacca5f2af655ba8111e1b4299690c14c7a7573e0ef0413a6468061
|
7
|
+
data.tar.gz: 5bd90a681ea26bf5b8f599465ab6a47b3a8b51baf913df9211b26792418122294228f7aff8848ed1f25d109e4242409f3aa779e9f08b199c6ab0eebc07f246fe
|
data/exe/obst
CHANGED
@@ -9,15 +9,7 @@ File.open(gitignore, 'a+') do |f|
|
|
9
9
|
f.puts("# Obst\nobst.md") unless f.read =~ /# Obst/
|
10
10
|
end
|
11
11
|
|
12
|
-
buffer = []
|
13
|
-
Obst::GroupByDays.new(C: path, days: 1).take(7).each do |record|
|
14
|
-
buffer << "- #{record.time} (#{record.statuses.size})"
|
15
|
-
record.statuses.each_key do |name|
|
16
|
-
buffer << "\t- [[#{name}]]"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
12
|
obst_md = File.join(path, 'obst.md')
|
21
13
|
File.open(obst_md, 'w') do |f|
|
22
|
-
f.puts
|
14
|
+
f.puts Obst::TouchedFiles.new(C: path).to_s
|
23
15
|
end
|
data/lib/obst/group_by_days.rb
CHANGED
@@ -8,7 +8,7 @@ module Obst
|
|
8
8
|
ONE_DAY = 60 * 60 * 24
|
9
9
|
|
10
10
|
def initialize(**opts)
|
11
|
-
duration =
|
11
|
+
duration = ONE_DAY * (opts[:days] || 1)
|
12
12
|
latest = opts[:before] ? Time.parse(opts[:before]) : Time.parse(Time.now.strftime('%F 23:59:59'))
|
13
13
|
|
14
14
|
@timeline = Enumerator.new do |y|
|
data/lib/obst/pack_log.rb
CHANGED
@@ -18,9 +18,31 @@ module Obst
|
|
18
18
|
def inspect
|
19
19
|
@arr
|
20
20
|
end
|
21
|
+
|
22
|
+
def final
|
23
|
+
return :d if @arr[0] == :d
|
24
|
+
return :a if @arr[-1] == :a
|
25
|
+
:m
|
26
|
+
end
|
21
27
|
end
|
22
28
|
|
23
|
-
Record = Struct.new(:time, :statuses)
|
29
|
+
Record = Struct.new(:time, :statuses) do
|
30
|
+
def status_sum
|
31
|
+
sum = Hash.new{ |h, k| h[k] = 0 }
|
32
|
+
statuses.each_value do |status|
|
33
|
+
sum[status.final] += 1
|
34
|
+
end
|
35
|
+
sum
|
36
|
+
end
|
37
|
+
|
38
|
+
def str_status_sum
|
39
|
+
sb = []
|
40
|
+
status_sum.each_pair do |st, count|
|
41
|
+
sb << "#{st}: #{count}"
|
42
|
+
end
|
43
|
+
sb.join(', ')
|
44
|
+
end
|
45
|
+
end
|
24
46
|
|
25
47
|
def each(&block)
|
26
48
|
current_time = nil
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "obst/group_by_days"
|
2
|
+
|
3
|
+
module Obst
|
4
|
+
class TouchedFiles
|
5
|
+
def initialize(**opts)
|
6
|
+
@path = opts[:C]
|
7
|
+
@buffer = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
last_7_days
|
12
|
+
@buffer << ''
|
13
|
+
last_4_weeks_without_last_7_days
|
14
|
+
@buffer << ''
|
15
|
+
last_3_months_without_last_4_weeks
|
16
|
+
@buffer.join("\n")
|
17
|
+
end
|
18
|
+
|
19
|
+
def last_7_days
|
20
|
+
@buffer << "# Last 7 days\n"
|
21
|
+
|
22
|
+
GroupByDays.new(C: @path).take(7).each do |record|
|
23
|
+
wday = Time.parse(record.time).strftime('%a')
|
24
|
+
@buffer << "- #{record.time} #{wday} (#{record.statuses.size})"
|
25
|
+
list_files(record)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def last_4_weeks_without_last_7_days
|
30
|
+
before = (Time.now - (60 * 60 * 24 * 7)).strftime('%FT23:59:59')
|
31
|
+
|
32
|
+
@buffer << "# 3 weeks earlier\n"
|
33
|
+
|
34
|
+
GroupByDays.new(C: @path, before: before, days: 7).take(3).each do |record|
|
35
|
+
@buffer << "- #{record.time} (#{record.statuses.size})"
|
36
|
+
list_files(record)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def last_3_months_without_last_4_weeks
|
41
|
+
before = (Time.now - (60 * 60 * 24 * 28)).strftime('%FT23:59:59')
|
42
|
+
|
43
|
+
@buffer << "# 1 month earlier\n"
|
44
|
+
|
45
|
+
GroupByDays.new(C: @path, before: before, days: 28).take(2).each do |record|
|
46
|
+
@buffer << "- #{record.time} (#{record.statuses.size})"
|
47
|
+
list_files(record)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def list_files(record)
|
52
|
+
record.statuses.each_pair do |name, status|
|
53
|
+
entry = status.final == :a ? "\t- [[#{name}]] *new !*" : "\t- [[#{name}]]"
|
54
|
+
@buffer << entry
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/obst/version.rb
CHANGED
data/lib/obst.rb
CHANGED
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.
|
4
|
+
version: 0.1.3
|
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-
|
11
|
+
date: 2022-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- lib/obst/git_log.rb
|
33
33
|
- lib/obst/group_by_days.rb
|
34
34
|
- lib/obst/pack_log.rb
|
35
|
+
- lib/obst/touched_files.rb
|
35
36
|
- lib/obst/version.rb
|
36
37
|
- obst.gemspec
|
37
38
|
homepage: https://github.com/turnon/obst
|