logbrarian 0.1.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b3a1ab3d949d7f05f68f1e633ac03e6de7614ea
4
- data.tar.gz: c69907ad01a2a3311402f890f85d7adefd499359
3
+ metadata.gz: 45b66b2007db632a830cd073b3d669f4f9fb6bd5
4
+ data.tar.gz: 3b8abbba2d519adb69ff3b7fa558122717028f0a
5
5
  SHA512:
6
- metadata.gz: 8ee9243c3fa5366c41f4e83d65ddf8ba7aacbf07c6b41c9771b813c29a5301bc77a0bf8a8115c329806aef62c8c18bad9f98cf5e105ef4dae4c1866e328f7976
7
- data.tar.gz: 10dcf5823b730d9324abd1d1f86e0d7f704bb56ca616022a93d75bd7535d1258b8ab31406bb8c125dc83e82729f4ea63e3a67fbd98b38232e737f5bf95053f4f
6
+ metadata.gz: 22d1135e9f28601c605438c3f83bf738a7e43bfc22847998cc8293579cf9d114c2cf5cf50a1cc9bf2952364ed24a8cfcfc91ae9c72789e2b87b1ee2f361644aa
7
+ data.tar.gz: 118ba567f15564ad9f7fe1434d176f8bd82763c189ff68b4f94fdb2b0227d7fb843d520b3252b4d807086d88da08bc363331aaa7f7dac30ce3a45fbd2eec2c9e
data/bin/logbrarian CHANGED
@@ -48,6 +48,21 @@ dir_path = File.dirname(current_path)
48
48
  FileUtils.mkdir_p dir_path
49
49
  FileUtils.touch current_path unless File.exist? current_path
50
50
 
51
+ begin
52
+ birthtime = File.birthtime(current_path)
53
+ rescue NotImplementedError
54
+ require 'yaml'
55
+ store_path = File.expand_path("~/.logbrarian.yml")
56
+ FileUtils.touch store_path
57
+ store = YAML.load_file(store_path) || Hash.new
58
+ birth_string = store[current_path] || Time.now.to_s
59
+ birthtime = DateTime.parse(birth_string).to_time
60
+ unless store.key?(current_path)
61
+ store[current_path] = birthtime
62
+ File.open(store_path, 'w') {|f| YAML.dump(store,f) }
63
+ end
64
+ end
65
+
51
66
  if File.birthtime(current_path) < options[:interval].ago
52
67
  # Rotate older file
53
68
  require 'zlib'
@@ -62,6 +77,10 @@ if File.birthtime(current_path) < options[:interval].ago
62
77
  end
63
78
  FileUtils.rm current_path
64
79
  FileUtils.touch current_path
80
+ if store
81
+ store[current_path] = Time.now.to_s
82
+ File.open(store_path, 'w') {|f| YAML.dump(store,f) }
83
+ end
65
84
  end
66
85
 
67
86
  File.open(current_path, 'a') do |log|
@@ -1,3 +1,3 @@
1
1
  module Logbrarian
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logbrarian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Clink