mymedia 0.4.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mymedia.rb +54 -16
- data.tar.gz.sig +0 -0
- metadata +11 -52
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6db4be538139117711e0efb648d7e93873b129692f1319cf82523e9caf96d1cf
|
4
|
+
data.tar.gz: 494646f0e3e962bbb9764aa64b683f6ac04b985b8df375f5d80b2f57261d875c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044a56092a8239fe598563ece75a9e288526201883fb8083f6aa8cce40ff6a79bca679133a49da2730c14b55066ed6ac5ed1539ddbb472d7bbc8d3b8139bdbed
|
7
|
+
data.tar.gz: c296255f7b2f2e43c719ddfc1cdbae91314fe7dd6fc73c5e396027fad0ed4be5f969534fcc63e0e253b593478d79fd5b76a619cdccfee9ff8b696a66dfee87ce
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mymedia.rb
CHANGED
@@ -10,6 +10,7 @@ require 'dir-to-xml'
|
|
10
10
|
require 'dataisland'
|
11
11
|
require 'increment'
|
12
12
|
require 'simple-config'
|
13
|
+
require 'rxfileio'
|
13
14
|
|
14
15
|
|
15
16
|
module MyMedia
|
@@ -19,7 +20,7 @@ module MyMedia
|
|
19
20
|
|
20
21
|
|
21
22
|
class Publisher
|
22
|
-
include
|
23
|
+
include RXFReadWriteModule
|
23
24
|
|
24
25
|
def initialize(opts={})
|
25
26
|
@index_page = true
|
@@ -74,7 +75,7 @@ module MyMedia
|
|
74
75
|
dynarex = if FileX.exists? dynarex_filepath then
|
75
76
|
DxLite.new(dynarex_filepath)
|
76
77
|
else
|
77
|
-
DxLite.new(@schema)
|
78
|
+
DxLite.new(@schema, order: 'descending')
|
78
79
|
end
|
79
80
|
|
80
81
|
dynarex.create record
|
@@ -92,7 +93,7 @@ module MyMedia
|
|
92
93
|
end
|
93
94
|
|
94
95
|
module IndexReader
|
95
|
-
include
|
96
|
+
include RXFRead
|
96
97
|
|
97
98
|
def browse()
|
98
99
|
|
@@ -125,11 +126,11 @@ module MyMedia
|
|
125
126
|
end
|
126
127
|
|
127
128
|
class Base < Publisher
|
128
|
-
include
|
129
|
+
include RXFileIOModule
|
129
130
|
|
130
131
|
attr_reader :to_s
|
131
132
|
|
132
|
-
def initialize(media_type: 'blog', public_type:
|
133
|
+
def initialize(media_type: 'blog', public_type: media_type,
|
133
134
|
ext: 'txt', config: nil, log: nil, debug: false)
|
134
135
|
|
135
136
|
super()
|
@@ -141,6 +142,7 @@ module MyMedia
|
|
141
142
|
c = SimpleConfig.new(config).to_h
|
142
143
|
|
143
144
|
@home = c[:home]
|
145
|
+
puts '@home: ' + @home.inspect if @debug
|
144
146
|
@media_src = "%s/media/%s" % [@home, media_type]
|
145
147
|
@website = c[:website]
|
146
148
|
|
@@ -149,6 +151,7 @@ module MyMedia
|
|
149
151
|
@domain = @website[/[^\.]+\.[^\.]+$/]
|
150
152
|
|
151
153
|
@sps = c[:sps]
|
154
|
+
@omit_html_ext = c[:omit_html_ext]
|
152
155
|
|
153
156
|
@log = log
|
154
157
|
|
@@ -162,7 +165,7 @@ module MyMedia
|
|
162
165
|
@rss = false
|
163
166
|
@debug = debug
|
164
167
|
|
165
|
-
|
168
|
+
DirX.chdir @home
|
166
169
|
|
167
170
|
end
|
168
171
|
|
@@ -182,26 +185,31 @@ module MyMedia
|
|
182
185
|
|
183
186
|
@log.info 'Base inside auto_copy_publish' if @log
|
184
187
|
puts '@media_src: ' + @media_src.inspect if @debug
|
185
|
-
#exit
|
186
|
-
dir = DirToXML.new(@media_src, recursive: true, debug: false)
|
187
|
-
puts 'before dir.last_modified' if @debug
|
188
|
-
r = dir.last_modified
|
189
|
-
puts 'r: ' + r.inspect if @debug
|
190
188
|
|
191
|
-
|
189
|
+
# fetch the most recent file
|
190
|
+
filename = FileX.ru_r @media_src
|
192
191
|
|
193
|
-
|
192
|
+
if filename then
|
193
|
+
|
194
|
+
puts 'filename: ' + filename.inspect if @debug
|
195
|
+
|
196
|
+
copy_publish( filename ,raw_msg, &blk)
|
197
|
+
|
198
|
+
end
|
194
199
|
|
195
200
|
end
|
196
201
|
|
197
|
-
def basename(
|
202
|
+
def basename(raw_s1, raw_s2)
|
203
|
+
|
204
|
+
s1 = raw_s1.sub(/dfs:\/\/[^\/]+/,'')
|
205
|
+
s2 = raw_s2.sub(/dfs:\/\/[^\/]+/,'')
|
198
206
|
|
199
207
|
(s2.split('/') - s1.split('/')).join('/')
|
200
208
|
|
201
209
|
end
|
202
210
|
|
203
211
|
def copy_publish(filename, raw_msg='', &blk)
|
204
|
-
file_publish(
|
212
|
+
file_publish(filename, raw_msg)
|
205
213
|
end
|
206
214
|
|
207
215
|
|
@@ -219,7 +227,7 @@ module MyMedia
|
|
219
227
|
|
220
228
|
public_path2 = "%s/%s/%shrs%s%s" % [@public_type, \
|
221
229
|
Time.now.strftime('%Y/%b/%d').downcase, Time.now.strftime('%H%M'),
|
222
|
-
|
230
|
+
Time.now.strftime('%S%2N'), @target_ext]
|
223
231
|
|
224
232
|
raw_destination = "%s/%s/%s" % [@home, 'r', public_path]
|
225
233
|
|
@@ -232,6 +240,11 @@ module MyMedia
|
|
232
240
|
FileX.mkdir_p File.dirname(raw_destination)
|
233
241
|
FileX.mkdir_p File.dirname(destination)
|
234
242
|
|
243
|
+
if @debug then
|
244
|
+
puts "file_publish() #50 mkdir_p %s" % [File.dirname(raw_destination)]
|
245
|
+
puts "file_publish() #70 mkdir_p %s" % [File.dirname(destination)]
|
246
|
+
end
|
247
|
+
|
235
248
|
raw_msg = raw_msg.join ' ' if raw_msg.is_a? Array
|
236
249
|
|
237
250
|
raw_msg = src_path[/([^\/]+)\.\w+$/,1] + ' ' + raw_msg if raw_msg[/^#/]
|
@@ -241,8 +254,21 @@ module MyMedia
|
|
241
254
|
raw_msg, target_url = yield(destination, raw_destination)
|
242
255
|
static_url = target_url
|
243
256
|
else
|
257
|
+
|
258
|
+
if @debug then
|
259
|
+
puts "file_publish() #80 cp %s to %s" % [src_path, destination]
|
260
|
+
puts "file_publish() #90 cp %s to %s" % [src_path, destination]
|
261
|
+
end
|
262
|
+
|
244
263
|
FileX.cp src_path, destination
|
245
264
|
FileX.cp src_path, raw_destination
|
265
|
+
|
266
|
+
if @debug then
|
267
|
+
puts "file_publish() #100 copied %s to %s" % [src_path, destination]
|
268
|
+
puts "file_publish() #200 copied %s to %s" % \
|
269
|
+
[src_path, raw_destination]
|
270
|
+
end
|
271
|
+
|
246
272
|
end
|
247
273
|
|
248
274
|
raw_msg = raw_msg.join if raw_msg.is_a? Array
|
@@ -263,6 +289,12 @@ module MyMedia
|
|
263
289
|
static_destination = "%s/%s" % [@home, static_path]
|
264
290
|
|
265
291
|
#FileUtils.mkdir_p File.dirname(static_destination)
|
292
|
+
|
293
|
+
if @debug then
|
294
|
+
puts "file_publish() #300 copy %s to %s" % [destination,
|
295
|
+
static_destination]
|
296
|
+
end
|
297
|
+
|
266
298
|
FileX.cp destination, static_destination
|
267
299
|
|
268
300
|
#jr010817 FileUtils.cp raw_destination, raw_static_destination
|
@@ -273,7 +305,13 @@ module MyMedia
|
|
273
305
|
xmlfilepath = destination.sub('.html','.xml')
|
274
306
|
|
275
307
|
if FileX.exists?(xmlfilepath) then
|
308
|
+
|
276
309
|
FileX.cp xmlfilepath, static_destination.sub('.html','.xml')
|
310
|
+
|
311
|
+
if @debug then
|
312
|
+
puts "file_publish() #400 copied %s to %s" % [xmlfilepath, static_destination.sub('.html','.xml')]
|
313
|
+
end
|
314
|
+
|
277
315
|
end
|
278
316
|
|
279
317
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mymedia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,88 +35,48 @@ cert_chain:
|
|
35
35
|
bL55NDdi8BFHkNVohRBak7aqxsw41LJKy3UTP+4TzU5vyluDJMiscK6JJFaM4JiS
|
36
36
|
xtlAM0O5ZFe9QflatP+P8JnB
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-03-19 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - "~>"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '1.9'
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 1.9.2
|
50
|
-
type: :runtime
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - "~>"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '1.9'
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: 1.9.2
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: sps-pub
|
41
|
+
name: dir-to-xml
|
62
42
|
requirement: !ruby/object:Gem::Requirement
|
63
43
|
requirements:
|
64
44
|
- - "~>"
|
65
45
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
46
|
+
version: '1.2'
|
67
47
|
- - ">="
|
68
48
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
49
|
+
version: 1.2.2
|
70
50
|
type: :runtime
|
71
51
|
prerelease: false
|
72
52
|
version_requirements: !ruby/object:Gem::Requirement
|
73
53
|
requirements:
|
74
54
|
- - "~>"
|
75
55
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
56
|
+
version: '1.2'
|
77
57
|
- - ">="
|
78
58
|
- !ruby/object:Gem::Version
|
79
|
-
version:
|
59
|
+
version: 1.2.2
|
80
60
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
61
|
+
name: dataisland
|
82
62
|
requirement: !ruby/object:Gem::Requirement
|
83
63
|
requirements:
|
84
64
|
- - "~>"
|
85
65
|
- !ruby/object:Gem::Version
|
86
|
-
version: '
|
66
|
+
version: '0.3'
|
87
67
|
- - ">="
|
88
68
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
69
|
+
version: 0.3.0
|
90
70
|
type: :runtime
|
91
71
|
prerelease: false
|
92
72
|
version_requirements: !ruby/object:Gem::Requirement
|
93
73
|
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.0'
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: 1.0.8
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
name: dataisland
|
102
|
-
requirement: !ruby/object:Gem::Requirement
|
103
|
-
requirements:
|
104
|
-
- - ">="
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: 0.3.0
|
107
74
|
- - "~>"
|
108
75
|
- !ruby/object:Gem::Version
|
109
76
|
version: '0.3'
|
110
|
-
type: :runtime
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
77
|
- - ">="
|
115
78
|
- !ruby/object:Gem::Version
|
116
79
|
version: 0.3.0
|
117
|
-
- - "~>"
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0.3'
|
120
80
|
- !ruby/object:Gem::Dependency
|
121
81
|
name: increment
|
122
82
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
143
|
- !ruby/object:Gem::Version
|
184
144
|
version: '0'
|
185
145
|
requirements: []
|
186
|
-
|
187
|
-
rubygems_version: 2.7.10
|
146
|
+
rubygems_version: 3.2.22
|
188
147
|
signing_key:
|
189
148
|
specification_version: 4
|
190
149
|
summary: Makes publishing to the web easier
|
metadata.gz.sig
CHANGED
Binary file
|