mymedia-polyrex 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1bedbdd4837681c0de37181db7a8e272bb6a890e
4
+ data.tar.gz: 43b0b76c2cf33584666776a3bff18459d581470a
5
+ SHA512:
6
+ metadata.gz: 44162f41391e21c270ade4672a63ca12902717a76b1cf0b439823fa03f3e6700c191f2890a5aacc6fe87aa51b845850a6fd4ebdda8c368023f30edb07cd9b852
7
+ data.tar.gz: 50a573d4881f67836a009cc99bbcb61580281470648a90bdc5aafa96ee438e1aff6243ba62285c3081d9fc9ef2207a13bab7f182a6bb6f9a813151fcefc59e59
@@ -0,0 +1 @@
1
+ ��bWex9y���YH���x'��xm�L�:QW�,g+q:�<�:'��\�q�[���jt&B���ic4�ש@�x�� Gd���b�&~bO
@@ -0,0 +1 @@
1
+ \�0]����@r�KV]�?�/�2̀�N�|C7�CH}"\��.5�mw��)飧G L�?�τ��O��o�sόw�`�!��6��$x[���p�3�l+V��ǽr�k��h"��'�͈�^�B�忱NU�&���ͤ�b�^��M���u� WYR$�N*te\����3�۹���V_AF����lϞ�r�CI����Q�3���~�+�se��"i$pK4�n��p<�`��@�ߒu�I�Ge)L8yc�IMɉPZ
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: mymedia-polyrex.rb
4
+
5
+ require 'fileutils'
6
+ require 'mymedia'
7
+
8
+ class MyMediaPolyrexException < Exception
9
+ end
10
+
11
+ class MyMediaPolyrex < MyMedia::Base
12
+
13
+ def initialize(public_type: 'polyrex', media_type: 'mmpolyrex', \
14
+ config: nil, xsl: '/xsl/polyrex-b.xsl')
15
+
16
+ @xsl = xsl
17
+ super(media_type: media_type, public_type: @public_type=public_type, config: config)
18
+
19
+ @media_src = "%s/media/%s" % [@home, public_type]
20
+ @target_ext = '.xml'
21
+ @rss = true
22
+ end
23
+
24
+ def copy_publish(filename, raw_msg='')
25
+
26
+ src_path = File.join(@media_src,filename)
27
+
28
+ r = 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
+ raw_msg = copy_edit(src_path, destination)
36
+ copy_edit(src_path, raw_destination,'r/')
37
+ end
38
+
39
+ if not File.basename(src_path)[/px\d{6}T\d{4}\.txt/] then
40
+
41
+ xml_filename = File.basename(src_path).sub(/txt$/,'xml')
42
+
43
+ FileUtils.cp destination, @home + '/polyrex/' + xml_filename
44
+
45
+ if File.extname(src_path) == '.txt' then
46
+ FileUtils.cp src_path, @home + '/polyrex/' + File.basename(src_path)
47
+ end
48
+
49
+ # publish the static links feed
50
+ dynarex_filepath = @home + '/polyrex/static.xml'
51
+ target_url = "%s/polyrex/%s" % [@website, xml_filename]
52
+
53
+ publish_dynarex(dynarex_filepath, {title: xml_filename, url: target_url })
54
+
55
+ end
56
+
57
+ raw_msg
58
+ end
59
+
60
+ r
61
+
62
+ end
63
+
64
+ def copy_edit(src_path, destination,raw='')
65
+
66
+ txt_destination = destination.sub(/xml$/,'txt')
67
+
68
+ FileUtils.cp src_path, txt_destination
69
+
70
+ buffer = File.read(src_path)
71
+ polyrex = buffer[/<?polyrex /] ? Polyrex.new.parse(buffer) : \
72
+ PolyrexHeadings.new(buffer).to_polyrex
73
+
74
+ title = polyrex.summary.title || ''
75
+ #puts 'dynarex.summary['tags'] : ' + dynarex.summary.inspect
76
+ tags = polyrex.summary.tags ? '#' + polyrex.summary.tags.split.join(' #') : ''
77
+ raw_msg = ("%s %s" % [title, tags]).strip
78
+ #polyrex.summary[:title] = raw_msg
79
+
80
+ polyrex.summary.original_source = File.basename(src_path)
81
+ polyrex.summary.source = File.basename(txt_destination)
82
+
83
+ polyrex.save(destination, {pretty: true}) do |xml|
84
+ a = xml.lines.to_a
85
+ line1 = a.shift
86
+ a.unshift %Q{<?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/xsl/#{raw}polyrex-b.xsl"?>\n}
87
+ a.unshift line1
88
+ a.join
89
+ end
90
+
91
+ raw_msg
92
+ end
93
+
94
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mymedia-polyrex
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
+ 8ixkARkWAmV1MB4XDTE1MTAyMTIxMTI0OFoXDTE2MTAyMDIxMTI0OFowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAKmcM9cuEMICTkWkYPTH1tHA77Rv1Y+ip5JOV8SZqr4FNx94eJrkkQyLoy1p
19
+ 4A7K/vA4cRdNsPWwxxG70r0urQVOflSqgkI7ZwiqaMZAQ8hVR/wybZ+39ZVavp3d
20
+ 3XR0dbQ1e0bSWJGzS1wLpAB/1rIlWvm0ovs0olFHJ/XLjh6HHCWOrb/fqb5hNj7A
21
+ BLxu+DABS3cq6qcqgXXbzIt7nzBvo5673a9vPOKLKVsCvpUX5GrmFsJ2c2CumEGX
22
+ ZwW7iX+987frioXFLiYWm38uT7oMHiCU3qB0kik4R7+SSTK7A1Zee4NIVduuiUQc
23
+ ZSCreSWsb6jML4cpwFpNGKQoVw8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUQZXAyIAxrvW5Vaxs5AW8KatkJl8wJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAAh1qldOL
27
+ uLT7JO57GwoF9v9SS7a1Qdkq+16+V3MzRcBJ3eRF3fhTIQ4k7erDfFMbpyZRg8cl
28
+ OwnXx2vQVatHS09Sk576SPHUHn/PEVkWjavAIO7+BYxWaLzTburUqNTUvNd2p+mp
29
+ Rnoz7g/5UfMvNPnqgyLtwuwXbYEI3j0UTzAsy0xMfS20KEhRUQRGDlEimfTrlIGj
30
+ Z4OaDe2KxY4tQCuc8bm01UPtkd1onMDsPXaleFW9Kp/Air1VW0xMbruQEmhHdfhf
31
+ ldSX0yjAlsLIkBEpEGf7kvoPFe9xge+Fho6JD/9QD1ndnAmIonn1bL/NopBwRDtF
32
+ Aw2L0gTauxXypQ==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-10-21 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.1'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.1
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.1'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.1.1
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/mymedia-polyrex.rb
63
+ homepage: https://github.com/jrobertson/mymedia-polyrex
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.8
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: A MyMedia gem to publish a Polyrex file to a website.
87
+ test_files: []
Binary file