mymedia 0.2.2 → 0.2.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 +18 -12
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b8983d355aa38374c602e7b11bbcb7a7ace0119
|
|
4
|
+
data.tar.gz: 5f1690ddad0fc9d7e8a23de3f79d1ece366b9d61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99be99eb504341ba213204c68b0e56078643cda41c96b1576c1daf1c51a5566d4d03af08723658c6d9e834418d44c710ee24c10770f8c45e12d71cb4eb5faaec
|
|
7
|
+
data.tar.gz: 052fdf440a4ddd84475a7f384f96640b95eab283f9f5257b11a5f8787aedd8cf7bef980a98b755bcd86d106dc34f35cc040547b1b32992f25c688ba5b2506287
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/mymedia.rb
CHANGED
|
@@ -30,7 +30,7 @@ module MyMedia
|
|
|
30
30
|
record={title: '',url: '', raw_url: ''}, options={})
|
|
31
31
|
|
|
32
32
|
opt = {id: nil, rss: false}.merge(options)
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
dynarex = if File.exists? dynarex_filepath then
|
|
35
35
|
Dynarex.new(dynarex_filepath)
|
|
36
36
|
else
|
|
@@ -62,6 +62,7 @@ module MyMedia
|
|
|
62
62
|
"template path: #{template_path} not found" unless \
|
|
63
63
|
File.exists?(template_path)
|
|
64
64
|
dataisland = DataIsland.new(template_path, @opts)
|
|
65
|
+
|
|
65
66
|
File.open(path2 + '/index.html','w'){|f| f.write dataisland.html_doc.xml pretty: true}
|
|
66
67
|
end
|
|
67
68
|
|
|
@@ -78,8 +79,7 @@ module MyMedia
|
|
|
78
79
|
|
|
79
80
|
super()
|
|
80
81
|
|
|
81
|
-
@schema = 'posts/post(title, url, raw_url)'
|
|
82
|
-
@logger = Logger.new('/tmp/mymedia.log','daily')
|
|
82
|
+
@schema = 'posts/post(title, url, raw_url)'
|
|
83
83
|
|
|
84
84
|
raise BaseException, "no config found" if config.nil?
|
|
85
85
|
|
|
@@ -92,6 +92,11 @@ module MyMedia
|
|
|
92
92
|
@domain = @website[/[^\.]+\.[^\.]+$/]
|
|
93
93
|
|
|
94
94
|
@sps = c[:sps]
|
|
95
|
+
logfile = c[:log]
|
|
96
|
+
|
|
97
|
+
@logger = nil
|
|
98
|
+
@logger = Logger.new(logfile,'daily') if logfile
|
|
99
|
+
@logger.info('inside MyMedia::Base') if @logger
|
|
95
100
|
|
|
96
101
|
@media_type = media_type
|
|
97
102
|
@public_type = public_type ||= @media_type
|
|
@@ -198,17 +203,17 @@ module MyMedia
|
|
|
198
203
|
msg = "the %s %s %s" % [notice, @public_type.sub(/s$/,''), target_url]
|
|
199
204
|
end
|
|
200
205
|
|
|
201
|
-
sps_message = [
|
|
206
|
+
sps_message = ['publish', @public_type,
|
|
202
207
|
target_url, static_url, "'" + raw_msg + "'"]
|
|
203
208
|
|
|
204
|
-
|
|
205
|
-
send_message(topic: topic, msg: msg)
|
|
209
|
+
send_message(msg: sps_msg.join(' '))
|
|
206
210
|
|
|
207
211
|
static_url
|
|
208
212
|
|
|
209
213
|
end
|
|
210
214
|
|
|
211
215
|
def normalize(s)
|
|
216
|
+
|
|
212
217
|
r = s.downcase.gsub(/\s#\w+/,'').strip.gsub(/\W/,'-').gsub(/-{2,}/,'-').gsub(/^-|-$/,'')
|
|
213
218
|
return s.scan(/#(\w+)/)[0..1].join('_').downcase if r.empty?
|
|
214
219
|
return r
|
|
@@ -247,9 +252,9 @@ module MyMedia
|
|
|
247
252
|
class Frontpage < Publisher
|
|
248
253
|
|
|
249
254
|
def initialize(config: nil, public_type: '', rss: nil)
|
|
250
|
-
|
|
255
|
+
|
|
251
256
|
raise FrontpageException, "no config found" if config.nil?
|
|
252
|
-
|
|
257
|
+
|
|
253
258
|
c = SimpleConfig.new(config).to_h
|
|
254
259
|
|
|
255
260
|
@home = c[:home]
|
|
@@ -258,7 +263,6 @@ module MyMedia
|
|
|
258
263
|
@rss = rss
|
|
259
264
|
@opts = {username: c[:username], password: c[:password]}
|
|
260
265
|
|
|
261
|
-
@logger = Logger.new('/tmp/mymedia.log','daily')
|
|
262
266
|
end
|
|
263
267
|
|
|
264
268
|
def publish_frontpage(s='index.html')
|
|
@@ -274,6 +278,7 @@ module MyMedia
|
|
|
274
278
|
|
|
275
279
|
raw_msg, static_url, target_url = \
|
|
276
280
|
record[:title], record[:url], record[:static_url]
|
|
281
|
+
|
|
277
282
|
dynarex_filepath = "%s/%s/dynarex.xml" % [@home, @public_type]
|
|
278
283
|
raw_dynarex_filepath = "%s/r/%s/dynarex.xml" % [@home, @public_type]
|
|
279
284
|
|
|
@@ -281,15 +286,16 @@ module MyMedia
|
|
|
281
286
|
publish_dynarex(raw_dynarex_filepath, record, {rss: @rss || false})
|
|
282
287
|
|
|
283
288
|
publish_timeline(raw_msg, static_url, target_url)
|
|
289
|
+
send_message(msg: 'publish_to_lists completed')
|
|
284
290
|
|
|
285
291
|
end
|
|
286
292
|
|
|
287
293
|
|
|
288
294
|
def publish_timeline(raw_msg, static_url, target_url='')
|
|
289
|
-
|
|
290
|
-
timeline_filepath = "%s/timeline/dynarex.xml" % @home
|
|
291
295
|
|
|
296
|
+
timeline_filepath = "%s/timeline/dynarex.xml" % @home
|
|
292
297
|
record = Dynarex.new(@home + '/dynarex/main-directory.xml').find_by_title(@public_type)
|
|
298
|
+
|
|
293
299
|
thumbnail, subject_url = record.thumbnail, record.url
|
|
294
300
|
|
|
295
301
|
content = {
|
|
@@ -299,7 +305,7 @@ module MyMedia
|
|
|
299
305
|
subject_url: subject_url,
|
|
300
306
|
raw_url: target_url
|
|
301
307
|
}
|
|
302
|
-
|
|
308
|
+
|
|
303
309
|
publish_dynarex(timeline_filepath, content, rss: true)
|
|
304
310
|
|
|
305
311
|
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.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Robertson
|
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
|
31
31
|
AuNecS7mQYhxSVKaAH8VGzIiea4rbybYlYRsOllgAkcmCFTQW39mbtmMPtDedk1N
|
|
32
32
|
ZQNJr93cq0mf/Q==
|
|
33
33
|
-----END CERTIFICATE-----
|
|
34
|
-
date: 2015-
|
|
34
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
|
35
35
|
dependencies:
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: dynarex
|
metadata.gz.sig
CHANGED
|
Binary file
|