mymedia 0.5.0 → 0.5.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
- checksums.yaml.gz.sig +0 -0
- data/lib/mymedia.rb +71 -13
- data.tar.gz.sig +0 -0
- metadata +28 -49
- 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: 1a714cd992ef14c2e9ee41a3e29ce25bf90b2d8378636903108993dcb2dd7d21
|
4
|
+
data.tar.gz: f9f81cd5d692cb58cd0b7d82cb9d535f19cbfff5b8c33077d8bef48f50a570f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6acc8fcf2c6e792f361921e9769879d8ff871f429f36b76276c3a413d60f258b219e66ffa96754cb6d86d4e41268b58632596f274630fd985379887f0d6d72b
|
7
|
+
data.tar.gz: 7a6d6fb05c2600876bb44bf3bde49104f7bb48b573f19e69ea4d2a30d2e5e7245f9995d65a41af613290f688b1855fbb42cd7307c5dada51f0df96b49ad3f959
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mymedia.rb
CHANGED
@@ -10,6 +10,8 @@ require 'dir-to-xml'
|
|
10
10
|
require 'dataisland'
|
11
11
|
require 'increment'
|
12
12
|
require 'simple-config'
|
13
|
+
require 'rxfileio'
|
14
|
+
require 'wordsdotdat'
|
13
15
|
|
14
16
|
|
15
17
|
module MyMedia
|
@@ -19,7 +21,7 @@ module MyMedia
|
|
19
21
|
|
20
22
|
|
21
23
|
class Publisher
|
22
|
-
include
|
24
|
+
include RXFReadWriteModule
|
23
25
|
|
24
26
|
def initialize(opts={})
|
25
27
|
@index_page = true
|
@@ -74,7 +76,7 @@ module MyMedia
|
|
74
76
|
dynarex = if FileX.exists? dynarex_filepath then
|
75
77
|
DxLite.new(dynarex_filepath)
|
76
78
|
else
|
77
|
-
DxLite.new(@schema)
|
79
|
+
DxLite.new(@schema, order: 'descending')
|
78
80
|
end
|
79
81
|
|
80
82
|
dynarex.create record
|
@@ -92,16 +94,38 @@ module MyMedia
|
|
92
94
|
end
|
93
95
|
|
94
96
|
module IndexReader
|
95
|
-
include
|
97
|
+
include RXFRead
|
96
98
|
|
97
|
-
def browse()
|
99
|
+
def browse(startswith=nil)
|
98
100
|
|
99
101
|
json_filepath = "%s/%s/dynarex.json" % [@home, @public_type]
|
100
102
|
|
101
103
|
if FileX.exists? json_filepath then
|
102
104
|
|
103
105
|
dx = DxLite.new(json_filepath)
|
104
|
-
|
106
|
+
|
107
|
+
if startswith then
|
108
|
+
|
109
|
+
@stopwords = WordsDotDat.stopwords
|
110
|
+
q = startswith
|
111
|
+
|
112
|
+
r = dx.all.select do |x|
|
113
|
+
|
114
|
+
found = x.title.scan(/\b\w+/).select do |raw_word|
|
115
|
+
|
116
|
+
word = raw_word.downcase
|
117
|
+
word[0..(q.length-1)] == q and not @stopwords.include? word
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
found.any?
|
122
|
+
end
|
123
|
+
|
124
|
+
else
|
125
|
+
|
126
|
+
return dx.all
|
127
|
+
|
128
|
+
end
|
105
129
|
|
106
130
|
end
|
107
131
|
|
@@ -125,7 +149,7 @@ module MyMedia
|
|
125
149
|
end
|
126
150
|
|
127
151
|
class Base < Publisher
|
128
|
-
include
|
152
|
+
include RXFileIOModule
|
129
153
|
|
130
154
|
attr_reader :to_s
|
131
155
|
|
@@ -141,6 +165,7 @@ module MyMedia
|
|
141
165
|
c = SimpleConfig.new(config).to_h
|
142
166
|
|
143
167
|
@home = c[:home]
|
168
|
+
puts '@home: ' + @home.inspect if @debug
|
144
169
|
@media_src = "%s/media/%s" % [@home, media_type]
|
145
170
|
@website = c[:website]
|
146
171
|
|
@@ -149,6 +174,7 @@ module MyMedia
|
|
149
174
|
@domain = @website[/[^\.]+\.[^\.]+$/]
|
150
175
|
|
151
176
|
@sps = c[:sps]
|
177
|
+
@omit_html_ext = c[:omit_html_ext]
|
152
178
|
|
153
179
|
@log = log
|
154
180
|
|
@@ -184,27 +210,29 @@ module MyMedia
|
|
184
210
|
puts '@media_src: ' + @media_src.inspect if @debug
|
185
211
|
|
186
212
|
# fetch the most recent file
|
187
|
-
|
213
|
+
filename = FileX.ru_r @media_src
|
188
214
|
|
189
|
-
if
|
215
|
+
if filename then
|
190
216
|
|
191
|
-
puts '
|
217
|
+
puts 'filename: ' + filename.inspect if @debug
|
192
218
|
|
193
|
-
filename = r.sub(/^#{@media_src}/,'')
|
194
219
|
copy_publish( filename ,raw_msg, &blk)
|
195
220
|
|
196
221
|
end
|
197
222
|
|
198
223
|
end
|
199
224
|
|
200
|
-
def basename(
|
225
|
+
def basename(raw_s1, raw_s2)
|
226
|
+
|
227
|
+
s1 = raw_s1.sub(/dfs:\/\/[^\/]+/,'')
|
228
|
+
s2 = raw_s2.sub(/dfs:\/\/[^\/]+/,'')
|
201
229
|
|
202
230
|
(s2.split('/') - s1.split('/')).join('/')
|
203
231
|
|
204
232
|
end
|
205
233
|
|
206
234
|
def copy_publish(filename, raw_msg='', &blk)
|
207
|
-
file_publish(
|
235
|
+
file_publish(filename, raw_msg)
|
208
236
|
end
|
209
237
|
|
210
238
|
|
@@ -222,7 +250,7 @@ module MyMedia
|
|
222
250
|
|
223
251
|
public_path2 = "%s/%s/%shrs%s%s" % [@public_type, \
|
224
252
|
Time.now.strftime('%Y/%b/%d').downcase, Time.now.strftime('%H%M'),
|
225
|
-
|
253
|
+
Time.now.strftime('%S%2N'), @target_ext]
|
226
254
|
|
227
255
|
raw_destination = "%s/%s/%s" % [@home, 'r', public_path]
|
228
256
|
|
@@ -235,6 +263,11 @@ module MyMedia
|
|
235
263
|
FileX.mkdir_p File.dirname(raw_destination)
|
236
264
|
FileX.mkdir_p File.dirname(destination)
|
237
265
|
|
266
|
+
if @debug then
|
267
|
+
puts "file_publish() #50 mkdir_p %s" % [File.dirname(raw_destination)]
|
268
|
+
puts "file_publish() #70 mkdir_p %s" % [File.dirname(destination)]
|
269
|
+
end
|
270
|
+
|
238
271
|
raw_msg = raw_msg.join ' ' if raw_msg.is_a? Array
|
239
272
|
|
240
273
|
raw_msg = src_path[/([^\/]+)\.\w+$/,1] + ' ' + raw_msg if raw_msg[/^#/]
|
@@ -244,8 +277,21 @@ module MyMedia
|
|
244
277
|
raw_msg, target_url = yield(destination, raw_destination)
|
245
278
|
static_url = target_url
|
246
279
|
else
|
280
|
+
|
281
|
+
if @debug then
|
282
|
+
puts "file_publish() #80 cp %s to %s" % [src_path, destination]
|
283
|
+
puts "file_publish() #90 cp %s to %s" % [src_path, destination]
|
284
|
+
end
|
285
|
+
|
247
286
|
FileX.cp src_path, destination
|
248
287
|
FileX.cp src_path, raw_destination
|
288
|
+
|
289
|
+
if @debug then
|
290
|
+
puts "file_publish() #100 copied %s to %s" % [src_path, destination]
|
291
|
+
puts "file_publish() #200 copied %s to %s" % \
|
292
|
+
[src_path, raw_destination]
|
293
|
+
end
|
294
|
+
|
249
295
|
end
|
250
296
|
|
251
297
|
raw_msg = raw_msg.join if raw_msg.is_a? Array
|
@@ -266,6 +312,12 @@ module MyMedia
|
|
266
312
|
static_destination = "%s/%s" % [@home, static_path]
|
267
313
|
|
268
314
|
#FileUtils.mkdir_p File.dirname(static_destination)
|
315
|
+
|
316
|
+
if @debug then
|
317
|
+
puts "file_publish() #300 copy %s to %s" % [destination,
|
318
|
+
static_destination]
|
319
|
+
end
|
320
|
+
|
269
321
|
FileX.cp destination, static_destination
|
270
322
|
|
271
323
|
#jr010817 FileUtils.cp raw_destination, raw_static_destination
|
@@ -276,7 +328,13 @@ module MyMedia
|
|
276
328
|
xmlfilepath = destination.sub('.html','.xml')
|
277
329
|
|
278
330
|
if FileX.exists?(xmlfilepath) then
|
331
|
+
|
279
332
|
FileX.cp xmlfilepath, static_destination.sub('.html','.xml')
|
333
|
+
|
334
|
+
if @debug then
|
335
|
+
puts "file_publish() #400 copied %s to %s" % [xmlfilepath, static_destination.sub('.html','.xml')]
|
336
|
+
end
|
337
|
+
|
280
338
|
end
|
281
339
|
|
282
340
|
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.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,128 +35,108 @@ cert_chain:
|
|
35
35
|
bL55NDdi8BFHkNVohRBak7aqxsw41LJKy3UTP+4TzU5vyluDJMiscK6JJFaM4JiS
|
36
36
|
xtlAM0O5ZFe9QflatP+P8JnB
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-
|
38
|
+
date: 2022-04-06 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: dir-to-xml
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
46
|
+
version: '1.2'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.
|
49
|
+
version: 1.2.2
|
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.
|
56
|
+
version: '1.2'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.
|
59
|
+
version: 1.2.2
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
61
|
+
name: dataisland
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0.
|
66
|
+
version: '0.3'
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.3.0
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0.
|
76
|
+
version: '0.3'
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.
|
79
|
+
version: 0.3.0
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
|
-
name:
|
81
|
+
name: increment
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
84
|
- - "~>"
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: '1
|
86
|
+
version: '0.1'
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 0.1.4
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1
|
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
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0.3'
|
110
|
-
type: :runtime
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
96
|
+
version: '0.1'
|
114
97
|
- - ">="
|
115
98
|
- !ruby/object:Gem::Version
|
116
|
-
version: 0.
|
117
|
-
- - "~>"
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0.3'
|
99
|
+
version: 0.1.4
|
120
100
|
- !ruby/object:Gem::Dependency
|
121
|
-
name:
|
101
|
+
name: simple-config
|
122
102
|
requirement: !ruby/object:Gem::Requirement
|
123
103
|
requirements:
|
124
104
|
- - "~>"
|
125
105
|
- !ruby/object:Gem::Version
|
126
|
-
version: '0.
|
106
|
+
version: '0.7'
|
127
107
|
- - ">="
|
128
108
|
- !ruby/object:Gem::Version
|
129
|
-
version: 0.
|
109
|
+
version: 0.7.2
|
130
110
|
type: :runtime
|
131
111
|
prerelease: false
|
132
112
|
version_requirements: !ruby/object:Gem::Requirement
|
133
113
|
requirements:
|
134
114
|
- - "~>"
|
135
115
|
- !ruby/object:Gem::Version
|
136
|
-
version: '0.
|
116
|
+
version: '0.7'
|
137
117
|
- - ">="
|
138
118
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.
|
119
|
+
version: 0.7.2
|
140
120
|
- !ruby/object:Gem::Dependency
|
141
|
-
name:
|
121
|
+
name: wordsdotdat
|
142
122
|
requirement: !ruby/object:Gem::Requirement
|
143
123
|
requirements:
|
144
124
|
- - "~>"
|
145
125
|
- !ruby/object:Gem::Version
|
146
|
-
version: '0.
|
126
|
+
version: '0.2'
|
147
127
|
- - ">="
|
148
128
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.
|
129
|
+
version: 0.2.0
|
150
130
|
type: :runtime
|
151
131
|
prerelease: false
|
152
132
|
version_requirements: !ruby/object:Gem::Requirement
|
153
133
|
requirements:
|
154
134
|
- - "~>"
|
155
135
|
- !ruby/object:Gem::Version
|
156
|
-
version: '0.
|
136
|
+
version: '0.2'
|
157
137
|
- - ">="
|
158
138
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
139
|
+
version: 0.2.0
|
160
140
|
description:
|
161
141
|
email: digital.robertson@gmail.com
|
162
142
|
executables: []
|
@@ -183,8 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
163
|
- !ruby/object:Gem::Version
|
184
164
|
version: '0'
|
185
165
|
requirements: []
|
186
|
-
|
187
|
-
rubygems_version: 2.7.10
|
166
|
+
rubygems_version: 3.2.22
|
188
167
|
signing_key:
|
189
168
|
specification_version: 4
|
190
169
|
summary: Makes publishing to the web easier
|
metadata.gz.sig
CHANGED
Binary file
|