dynarex-daily 0.5.0 → 0.6.0

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: 59be52b7780b87131cd48a8f44e5578630430b04426bf1dae6e8ed61c36c7288
4
- data.tar.gz: 0a567c0a7f3f370ac3fe82dd4df9d9cd6aab9cb0a40b2e93915c360710c6dc2a
3
+ metadata.gz: 00f7ad05f669c0844f8593b020b7b6365dde43ed38d92a9ef7b7da91c3f8829a
4
+ data.tar.gz: 415a516bce9564a6c91db463522c26485b48c26373fb2788ec282fa437968d03
5
5
  SHA512:
6
- metadata.gz: b5d2c19a2b5212539666d5f9529f908224fca93d76f96a4761e9279d0113c6169344dea9aeb540787d9d86011ad4069fc47c45c10fc16e3afe41cce6ccd5de51
7
- data.tar.gz: a4551e2a227ab58effd6c3b69e0ef2bbc4cc4462556fb18cff42e1fc06475e8fea9b31e62af7cf391022cd605b7527d4d4d12c64cb218b0cbed484fcf6519fd7
6
+ metadata.gz: 84fe28c1d077a3633140d2f4b1660cbf77a648f93ef175d13e6651e937bdea52bfa1fe112788242bd2788e6454379042a07268e20d2d74af30ec4971c7844427
7
+ data.tar.gz: 57a59988df1d7bb38a666cb9583d153acdaa8a256a3733e6d6d0fed71dd7ff662427876c7479de8af1b1a762c7df0a398ace76bb602cfaf8c1eb0ae0b8596ef2
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/dynarex-daily.rb CHANGED
@@ -6,12 +6,12 @@ require 'dynarex'
6
6
  require 'rxfileio'
7
7
 
8
8
 
9
- class DynarexDaily < Dynarex
9
+ class DynarexDaily < Dynarex
10
10
  include RXFileIOModule
11
-
12
- def initialize(stringx=nil, dir_archive: :days, xslt: '',
11
+
12
+ def initialize(stringx=nil, dir_archive: :days, xslt: '',
13
13
  filename: 'dynarexdaily.xml', debug: false)
14
-
14
+
15
15
  @dir_archive = dir_archive
16
16
 
17
17
  @filename = filename
@@ -20,30 +20,31 @@ class DynarexDaily < Dynarex
20
20
  @debug = debug
21
21
 
22
22
  puts 'DynarexDaily::initialize stringx: ' + stringx.inspect if @debug
23
-
23
+
24
24
  if stringx then
25
- s, type = RXFHelper.read(stringx)
25
+ s, type = RXFReader.read(stringx)
26
26
  @filename = stringx if type == :file or type == :dfs
27
27
  end
28
-
28
+
29
29
  puts 'DynarexDaily::initialize @filename: ' + @filename.inspect if @debug
30
-
31
- if FileX.exists?(@filename) then
32
-
30
+
31
+ if FileX.exist?(@filename) then
32
+
33
+ puts 'file exists!' if @debug
33
34
  super @filename, debug: debug
34
-
35
+
35
36
  if !summary[:date].empty? and \
36
37
  Date.parse(summary[:date]) != Date.today then
37
-
38
+
38
39
  archive_file Date.parse(summary[:date])
39
40
  create_file
40
- end
41
-
41
+ end
42
+
42
43
  else
43
44
  puts 'before super: stringx: ' + stringx.inspect if @debug
44
45
  super( stringx || @schema , debug: debug)
45
46
  puts 'after super' if @debug
46
- @delimiter = ' # '
47
+ @delimiter = ' # '
47
48
  create_file
48
49
  end
49
50
 
@@ -51,37 +52,39 @@ class DynarexDaily < Dynarex
51
52
  end
52
53
 
53
54
  def create(h)
55
+
56
+ puts 'Date.today: ' + Date.today.inspect if @debug
54
57
 
55
58
  if !summary[:date].empty? and \
56
59
  Date.parse(summary[:date]) != Date.today then
57
-
60
+
58
61
  archive_file Date.parse(summary[:date])
59
62
  create_file
60
- end
61
-
63
+ end
64
+
62
65
  super(h)
63
66
  end
64
-
65
-
67
+
68
+
66
69
  def save(filename=@filename, options={})
67
70
 
68
71
  puts 'inside DynarexDaily::save() filename: ' + filename.inspect if @debug
69
72
  super(filename, options)
70
73
 
71
74
  end
72
-
75
+
73
76
  def schema=(s)
74
77
  super(s.sub(/^\w+(?=\/)/,'\0[date]'))
75
78
  summary[:date] = Date.today.to_s
76
- summary[:order] = 'descending'
79
+ summary[:order] = 'descending'
77
80
  end
78
81
 
79
82
  private
80
-
83
+
81
84
  def create_file()
82
-
83
- puts 'inside DynarexDaily::create_file' if @debug
84
-
85
+
86
+ puts 'inside DynarexDaily::create_file' if @debug
87
+
85
88
  openx(@schema)
86
89
  summary[:date] = Date.today.to_s
87
90
  summary[:order] = 'descending'
@@ -91,26 +94,29 @@ class DynarexDaily < Dynarex
91
94
 
92
95
  def archive_file(t)
93
96
 
94
- puts 'inside DynarexDaily::archive_file' if @debug
95
-
97
+ puts 'inside DynarexDaily::archive_file' if @debug
98
+
96
99
  dir, file = if @dir_archive == :days then
100
+ puts 'days archive' if @debug
97
101
  ['days', t.strftime("d%d%m%y.xml")]
98
102
  else
103
+ puts 'other archive' if @debug
99
104
  [t.strftime("%Y/%b/%d").downcase, 'index.xml']
100
105
  end
101
106
 
107
+ puts 'about to mkdir ' + dir.inspect if @debug
102
108
  FileX.mkdir_p dir unless FileX.exist? dir
103
-
109
+
104
110
  if @debug then
105
111
  puts 'inside DynarexDaily::archive_file '
106
112
  puts ' @filename: %s' % [@filename]
107
113
  puts ' dir: %s; file: %s' % [dir, file]
108
114
  puts ' FileX: %s' % [dir, FileX.pwd]
109
115
  end
110
-
116
+
111
117
  FileX.mv(@filename, "%s/%s" % [dir, file])
112
118
  puts 'inside DynarexDaily::archive_file after FileX.mv' if @debug
113
-
119
+
114
120
  end
115
121
 
116
122
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynarex-daily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  E/GgkjQ28u/f6qcQgMPVvPiO6Ku2M2Zp4D5AL6Pb4ipSACsLEZZHMWo/CJBLOQ7f
36
36
  KYgoP6fr0Bkw0gyMZIHEwNMH
37
37
  -----END CERTIFICATE-----
38
- date: 2022-02-23 00:00:00.000000000 Z
38
+ date: 2023-01-30 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dynarex
@@ -43,20 +43,20 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.9'
46
+ version: '1.10'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.9.6
49
+ version: 1.10.0
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '1.9'
56
+ version: '1.10'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.9.6
59
+ version: 1.10.0
60
60
  description:
61
61
  email: digital.robertson@gmail.com
62
62
  executables: []
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.2.22
86
+ rubygems_version: 3.4.4
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: A Dynarex flavoured log file for humans which is archived daily
metadata.gz.sig CHANGED
Binary file