fewald-worklog 0.2.13 → 0.2.15

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: 190a52d7236e8befad053e79f9fbba8f32f149e354695148a73b732b21172e6b
4
- data.tar.gz: 5bbd3f3a1200119a20288eb59889bd7498c8d08a01e6ebbc1506b95dd8233e38
3
+ metadata.gz: 25cba6c16164da66d60c6ea7f00d3f37a32b2e0cb2fdefd8be7ea862346542a5
4
+ data.tar.gz: c094a3fca2e496c9d70684db1fde141695a8db36d1511c4ab01df7764da33e4a
5
5
  SHA512:
6
- metadata.gz: a2a075eeda5349c0190ce4a6420c5bd6b34759ffdf11845227f9c4fc89d2b522ba095c5059abb19b8c4508c7eaf0a2faf72ac6a980844bd89e6d5dde7d982052
7
- data.tar.gz: 8af5b16a3b3288f5c124d59442d76e83a0d6743ad5a34de5d4c930d3217c0277809082c8fe9c4b2045bf77311c03617b4fb9d5c4b9f495045b737d9a21345efc
6
+ metadata.gz: 10fdaa8f8ca7ee544d5476c22bac3652eda53548a9d439178cc7b4ab8c7fdd904f8831f779146985d2224f6d6395e310f6d692d45e7fed82c5434a989152d527
7
+ data.tar.gz: c6a472717293fbe7ba7dc6a79175c5a9b305c8a14e5039e4e260594b388e90355899a9cf10cc4e95198a1a5621dc9a6542292bd2afdcaa16521da4b6803dbf4c
data/.version CHANGED
@@ -1 +1 @@
1
- 0.2.13
1
+ 0.2.15
data/lib/configuration.rb CHANGED
@@ -5,6 +5,14 @@ require 'yaml'
5
5
 
6
6
  module Worklog
7
7
  # Configuration class for the application.
8
+ # @!attribute [rw] storage_path
9
+ # @return [String] The path where the application stores its data.
10
+ # @!attribute [rw] log_level
11
+ # @return [Symbol] The logging level for the application.
12
+ # Possible values: :debug, :info, :warn, :error, :fatal
13
+ # @!attribute [rw] webserver_port
14
+ # @return [Integer] The port on which the web server runs.
15
+ # Default is 3000.
8
16
  class Configuration
9
17
  attr_accessor :storage_path, :log_level, :webserver_port
10
18
 
@@ -35,5 +43,17 @@ module Worklog
35
43
 
36
44
  config
37
45
  end
46
+
47
+ # Check if the storage path exists.
48
+ # @return [Boolean] true if the storage path exists, false otherwise
49
+ def storage_path_exist?
50
+ File.exist?(@storage_path)
51
+ end
52
+
53
+ # Check if the storage path is the default path.
54
+ # @return [Boolean] true if the storage path is the default, false otherwise
55
+ def default_storage_path?
56
+ @storage_path == File.join(Dir.home, '.worklog')
57
+ end
38
58
  end
39
59
  end
data/lib/storage.rb CHANGED
@@ -13,6 +13,9 @@ class Storage
13
13
 
14
14
  FILE_SUFFIX = '.yaml'
15
15
 
16
+ # Regular expression to match daily log file names
17
+ LOG_PATTERN = /\d{4}-\d{2}-\d{2}#{FILE_SUFFIX}\z/
18
+
16
19
  def initialize(config)
17
20
  @config = config
18
21
  end
@@ -28,7 +31,7 @@ class Storage
28
31
 
29
32
  logs = []
30
33
  Dir.glob(File.join(@config.storage_path, "*#{FILE_SUFFIX}")).map do |file|
31
- next if file.end_with?('people.yaml')
34
+ next unless file.match?(LOG_PATTERN)
32
35
 
33
36
  logs << load_log(file)
34
37
  end
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.13
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Friedrich Ewald