mymedia-card 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6eb64ce65fea73f3d375dde28b6fe6f48fd9b13e
4
+ data.tar.gz: 606bc45cf16d54d464035e8180ade24c32e984f9
5
+ SHA512:
6
+ metadata.gz: f47626962f884926df6f3ec01958661d8d7d768eaeddfde73d5424742b8777f45cfc897f55ec0ab5cc660f90c5d012b417c7646738c5b639cea1b3d838987847
7
+ data.tar.gz: f2b658fdff1afda35de3311bfb4a1c524051bb1dbd438261c756ca0dbe9b6ea56f4d6816dd32eb45b9669a796cdb67ebddd324a7f53ee25aaacb28fcaaa536fa
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ !�&U��m���P
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ 1uS����5Jc�%p)��K� ����Ȕ���d�L����wlk��{~�C4����b�" U�e���.^'����Ӭl��a�9=x�ք `x墈�J3���vY�*��)3�O��z��6���� 6����2pq�A��� G�g��aM� ��*�����%ix�"r3�K���Z&Uq)�+v�#����z��)x*_�eu��j,�%C[^��/�FcR���pc�i?�S)>�8.?��]�e�$���@�
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: mymedia-card.rb
4
+
5
+ require 'mymedia'
6
+
7
+
8
+
9
+ class MyMediaCard < MyMedia::Base
10
+
11
+ attr_reader :kvx
12
+
13
+ def initialize(opt={}, media_type: 'kvx', public_type: 'kvx',
14
+ config: nil, prefix: 'k')
15
+
16
+ @public_type = public_type
17
+ super(media_type: media_type, public_type: public_type, config: config)
18
+ @media_src = "%s/media/%s" % [@home, public_type]
19
+ @target_ext = '.xml'
20
+ @prefix = prefix
21
+ end
22
+
23
+ def copy_publish(filename, raw_msg='')
24
+
25
+ src_path = File.join(@media_src, filename)
26
+ raise "file not found : " + src_path unless File.exists? src_path
27
+
28
+ file_publish(src_path, raw_msg) do |destination, raw_destination|
29
+
30
+ if not raw_msg or raw_msg.empty? then
31
+ raw_msg = File.basename(src_path) + " updated: " + Time.now.to_s
32
+ end
33
+
34
+ if File.extname(src_path) == '.txt' then
35
+
36
+ kvx, raw_msg = copy_edit(src_path, destination)
37
+ copy_edit(src_path, raw_destination)
38
+
39
+ else
40
+
41
+ kvx = Kvx.new(src_path)
42
+ title = kvx.summary[:title] || ''
43
+
44
+ kvx.summary[:original_source] = File.basename(src_path)
45
+
46
+ File.write destination, kvx.to_s
47
+
48
+ end
49
+
50
+ if not File.basename(src_path)[/#{@prefix}\d{6}T\d{4}\.txt/] then
51
+
52
+ xml_filename = File.basename(src_path).sub(/txt$/,'xml')
53
+ FileUtils.cp destination, @home + "/#{@public_type}/" + xml_filename
54
+
55
+ if File.extname(src_path) == '.txt' then
56
+ FileUtils.cp src_path, @home + "/#{public_type}/" + File.basename(src_path)
57
+ end
58
+
59
+ #publish the static links feed
60
+ kvx_filepath = @home + "/#{@public_type}/static.xml"
61
+
62
+ target_url = "%s/%s/%s" % [@website, @public_type, xml_filename]
63
+
64
+ publish_dynarex(kvx_filepath, {title: xml_filename, url: target_url })
65
+
66
+ end
67
+
68
+ [raw_msg,target_url]
69
+ end
70
+
71
+ end
72
+
73
+ def copy_edit(src_path, destination, raw='')
74
+
75
+ txt_destination = destination.sub(/xml$/,'txt')
76
+ FileUtils.cp src_path, txt_destination
77
+
78
+ buffer = File.read(src_path)
79
+ buffer2 = buffer.gsub(/\[[xX]\]/,'✓').gsub(/\[\s*\]/,'.')
80
+
81
+ @kvx = Kvx.new(buffer2.strip)
82
+
83
+ title = kvx.summary[:title]
84
+
85
+ tags = if kvx.summary[:tags] then
86
+ '#' + kvx.summary[:tags].split.join(' #')
87
+ else
88
+ ''
89
+ end
90
+
91
+ raw_msg = ("%s %s" % [title, tags]).strip
92
+
93
+ kvx.summary[:original_source] = File.basename(src_path)
94
+ kvx.summary[:source] = File.basename(txt_destination)
95
+
96
+ kvx.summary[:xslt] = @xsl unless kvx.item[:xslt]
97
+ File.write destination, kvx.to_xml
98
+
99
+ [kvx, raw_msg]
100
+ end
101
+
102
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mymedia-card
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE1MDUwNDA5NTQxNVoXDTE2MDUwMzA5NTQxNVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAKWghCT9xt7q4TkdgjyLPzVVIqQmMlM5UMRxKq/KjfiwDDwebk+oUZpuEWpH
19
+ HZD/PDZZcqE/hufurCV6B+l6kY3SPKfJaf0eKH1h0jtzCLPUckjZX/71uCoHftu4
20
+ AnFLV13hKyEwvf0efSZ0NLEXlhJg4v+NB61YdzF+Db9o/YSiC1I9U7IbqWm9XaZz
21
+ dxSmrhDEdQ4v6Z1qVTKAmhlq+Vz47nXCvzDkQDFMcC3uVvTzXnrOzuIf9domJRxR
22
+ s2m6U52s1ymeTDsLANKpXlFugLV7MQlw0GpIPK6mQSNzzwNbQDHcXHI34tsBw+KZ
23
+ OOcE1uDRqc50nug0J0nZzv1eX3UCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUf7D6sDYIcmp7uTf6z7nuyH6vefIwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAMwnW0pLx
27
+ LAgnCm6j6LfoxoveXJ65MGKOv0JARHqy7Mh2HO4+FhIFkvS8modeRh/c9h/ry5hx
28
+ HfVwL/f07F/PxbfwsAUdEDdJm043JNxOaiJ5KlqI57MkwRAAlq6bYiHod8cqOUHz
29
+ U1K6apudw1mONP8ejyrfVagQbKWPU92TDBwlNSrJQqTpoSbWZgrdW+pPyR72CON1
30
+ 8cLPykB+oW7ik7P3pF8Dql+Jz8WgstRH/sh7yVFYtSft1jWE33+53aiYCZ5929m6
31
+ Fel3ZehmfCVTepbDhmN9wy+aNa/pfEaGrRqjtvpPYQwVqzZBqxM39Y+hopVu2SCv
32
+ 2Atqh3hHPujBHw==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-05-04 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: mymedia
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.2'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.2.5
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.2'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.2.5
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/mymedia-card.rb
63
+ homepage: https://github.com/jrobertson/mymedia-card
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.4.6
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: In the context of the MyMedia system it is used for publishing a media file
87
+ using the Kvx XML format as the container.
88
+ test_files: []
metadata.gz.sig ADDED
Binary file