mymedia-card 0.1.3 → 0.2.0
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-card.rb +7 -83
- data.tar.gz.sig +0 -0
- metadata +7 -7
- 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: 686c5229a24c651b2c4232af1dea7a1ea41b0a71
|
4
|
+
data.tar.gz: ce5f1c9bdb25cf6dbeb7bc2542d76221d37546da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64133d65de20de9d983e37d6de0b4eafa584097071e7b396715af87403a16effa6fdaa8f40e72d84521d2acb80f18846cc00de10950cad2b75fee70085b62ed8
|
7
|
+
data.tar.gz: 21c2726e17e7e4e6b9852633b3369fe560434824e4c7bafcf08cd51b31a73b43c6aea680f0e16bc210fcf082861a41e3f307a11f609ac156042f3fcad52abcbb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mymedia-card.rb
CHANGED
@@ -2,24 +2,19 @@
|
|
2
2
|
|
3
3
|
# file: mymedia-card.rb
|
4
4
|
|
5
|
-
require 'mymedia'
|
5
|
+
require 'mymedia-kvx'
|
6
6
|
|
7
7
|
|
8
|
-
class MyMediaCard <
|
8
|
+
class MyMediaCard < MyMediaKvx
|
9
9
|
|
10
|
-
attr_reader :kvx
|
11
10
|
|
12
11
|
def initialize(opt={}, public_type: 'kvx', media_type: public_type,
|
13
12
|
config: nil, ext: nil)
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
super(media_type: media_type, public_type: public_type,
|
15
|
+
config: config, ext: ext)
|
17
16
|
|
18
|
-
@
|
19
|
-
@target_ext = '.xml'
|
20
|
-
|
21
|
-
@media_type = media_type
|
22
|
-
@ext = ext
|
17
|
+
@prefix = 'meta'
|
23
18
|
|
24
19
|
end
|
25
20
|
|
@@ -56,87 +51,16 @@ class MyMediaCard < MyMedia::Base
|
|
56
51
|
|
57
52
|
private
|
58
53
|
|
59
|
-
def copy_publish(filename, raw_msg='')
|
60
|
-
|
61
|
-
src_path = File.join(@media_src, filename)
|
62
|
-
raise "file not found : " + src_path unless File.exists? src_path
|
63
|
-
|
64
|
-
file_publish(src_path, raw_msg) do |destination, raw_destination|
|
65
|
-
|
66
|
-
if not raw_msg or raw_msg.empty? then
|
67
|
-
raw_msg = File.basename(src_path) + " updated: " + Time.now.to_s
|
68
|
-
end
|
69
|
-
|
70
|
-
if File.extname(src_path) == '.txt' then
|
71
|
-
|
72
|
-
kvx, raw_msg = copy_edit(src_path, destination)
|
73
|
-
copy_edit(src_path, raw_destination)
|
74
|
-
|
75
|
-
else
|
76
|
-
|
77
|
-
kvx = Kvx.new(src_path)
|
78
|
-
title = kvx.summary[:title] || ''
|
79
|
-
|
80
|
-
kvx.summary[:original_source] = File.basename(src_path)
|
81
|
-
|
82
|
-
File.write destination, kvx.to_s
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
if not File.basename(src_path)[/meta\d{6}T\d{4}\.txt/] then
|
87
|
-
|
88
|
-
xml_filename = File.basename(src_path).sub(/txt$/,'xml')
|
89
|
-
FileUtils.cp destination, @home + "/#{@public_type}/" + xml_filename
|
90
|
-
|
91
|
-
if File.extname(src_path) == '.txt' then
|
92
|
-
FileUtils.cp src_path, @home + "/#{public_type}/" + File.basename(src_path)
|
93
|
-
end
|
94
|
-
|
95
|
-
#publish the static links feed
|
96
|
-
kvx_filepath = @home + "/#{@public_type}/static.xml"
|
97
|
-
|
98
|
-
target_url = "%s/%s/%s" % [@website, @public_type, xml_filename]
|
99
|
-
|
100
|
-
publish_dynarex(kvx_filepath, {title: xml_filename, url: target_url })
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
[raw_msg,target_url]
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
54
|
|
109
55
|
def copy_edit(src_path, destination, raw='')
|
110
56
|
|
111
|
-
|
112
|
-
FileUtils.cp src_path, txt_destination
|
113
|
-
|
114
|
-
buffer = File.read(src_path)
|
115
|
-
buffer2 = buffer.gsub(/\[[xX]\]/,'✓').gsub(/\[\s*\]/,'.')
|
116
|
-
|
117
|
-
@kvx = Kvx.new(buffer2.strip)
|
118
|
-
|
119
|
-
title = kvx.summary[:title]
|
120
|
-
|
121
|
-
tags = if kvx.summary[:tags] then
|
122
|
-
'#' + kvx.summary[:tags].split.join(' #')
|
123
|
-
else
|
124
|
-
''
|
125
|
-
end
|
126
|
-
|
127
|
-
raw_msg = ("%s %s" % [title, tags]).strip
|
128
|
-
|
129
|
-
kvx.summary[:original_source] = File.basename(src_path)
|
130
|
-
kvx.summary[:source] = File.basename(txt_destination)
|
131
|
-
|
132
|
-
kvx.summary[:xslt] = @xsl unless kvx.item[:xslt]
|
133
|
-
File.write destination, kvx.to_xml
|
57
|
+
kvx, raw_msg = super(src_path, destination)
|
134
58
|
|
135
59
|
# copy the media file to the destination
|
136
60
|
destination = kvx.body[:file][/^https?:\/\/[^\/]+(.*)/,1]
|
137
61
|
file = destination[/[^\/]+$/]
|
138
62
|
FileUtils.cp File.join(@media_src, file), File.join(@home, destination)
|
139
|
-
|
63
|
+
|
140
64
|
[kvx, raw_msg]
|
141
65
|
end
|
142
66
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mymedia-card
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,28 +31,28 @@ cert_chain:
|
|
31
31
|
Fel3ZehmfCVTepbDhmN9wy+aNa/pfEaGrRqjtvpPYQwVqzZBqxM39Y+hopVu2SCv
|
32
32
|
2Atqh3hHPujBHw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-05-
|
34
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name: mymedia
|
37
|
+
name: mymedia-kvx
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '0.
|
42
|
+
version: '0.1'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
45
|
+
version: 0.1.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '0.
|
52
|
+
version: '0.1'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.
|
55
|
+
version: 0.1.0
|
56
56
|
description:
|
57
57
|
email: james@r0bertson.co.uk
|
58
58
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|