mymedia-pages 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: 330417d937dbbe7440a0336adaf92f3231573b00
4
+ data.tar.gz: e7b2c40465f02d83c53d60ae278b9ad7e7f1c343
5
+ SHA512:
6
+ metadata.gz: 523a1840bd08ab76786326c36e5ec445bf095dfe041eb3fda1c27fd9c27f7b61388a3d9187930771deb5b7b26725d60b21b20dcff5dd059261c3503962fc6724
7
+ data.tar.gz: 6d0965a86d6e6500989f00d7c8607c56671a048b22bca21a468833bedf4187ad299a7f0d900f1c0820f9fffe8a84504d40177fc93269b8a71460571ecb5ae5ad
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ g��>�WZ�O���*ڮg���S̎&���H���v�Y�'�«{�R�~=�tTm�:����wZ+�5Sa��޳�ʰ��`�©�ڸH�.ڃ0�ܿ��#�)�_��0�o�d3����w�����46��ׇc���0��L�tLXބ_,KF�t��/�|��%x#ٍ@Eԝ`km�����/���K�EIV�O�fz�3 �����i
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: mymedia-pages.rb
4
+
5
+
6
+ require 'mymedia-blogbase'
7
+
8
+
9
+ class MyMediaPages < MyMediaBlogBase
10
+
11
+ def initialize(config: nil)
12
+
13
+ super(media_type: 'pages', public_type: @public_type='pages', ext: '.(html|md)', config: config)
14
+ @media_src = "%s/media/pages" % @home
15
+ end
16
+
17
+ def copy_publish_to_be_removed(src_path, raw_msg='')
18
+ msg = super(src_path, raw_msg)
19
+ end
20
+
21
+ def copy_publish(filename, raw_msg='')
22
+
23
+ @filename = filename
24
+ src_path = File.join(@media_src, filename)
25
+
26
+ if File.basename(src_path)[/[pw]\d{6}T\d{4}\.(?:html)/] then
27
+ return file_publish(src_path, raw_msg)
28
+ end
29
+
30
+ file_publish(src_path, raw_msg) do |destination, raw_destination|
31
+
32
+ #FileUtils.cp src_path, destination
33
+ #FileUtils.cp src_path, raw_destination
34
+
35
+ if File.extname(src_path) == '.md' then
36
+
37
+ raw_dest_xml = raw_destination.sub(/html$/,'xml')
38
+ md_destination = raw_destination.sub(/html$/,'md')
39
+ FileUtils.cp src_path, md_destination
40
+
41
+ doc = xml(File.open(src_path, 'r').read,
42
+ md_destination[/\/r\/#{@public_type}.*/], filename)
43
+
44
+ modify_xml(doc, raw_dest_xml)
45
+
46
+ basic_xsl = File.read "#{@home}/r/xsl/#{@public_type}.xsl"
47
+
48
+ File.write raw_destination,
49
+ Nokogiri::XSLT(basic_xsl)\
50
+ .transform(Nokogiri::XML(File.read raw_dest_xml))
51
+
52
+ xsl = File.read "#{@home}/#{@www}/xsl/#{@public_type}.xsl"
53
+
54
+ File.write destination,
55
+ Nokogiri::XSLT(xsl).transform(Nokogiri::XML(File.read raw_dest_xml))
56
+ else
57
+ FileUtils.cp src_path, destination
58
+ FileUtils.cp src_path, raw_destination
59
+ end
60
+
61
+
62
+ if not File.basename(src_path)[/[pw]\d{6}T\d{4}\.(?:html|md)/] then
63
+ html_filename = File.basename(src_path).sub(/md$/,'html')
64
+
65
+ FileUtils.cp destination, @home + "/#{@public_type}/" + html_filename
66
+ html_filepath = @home + "/#{@public_type}/static.xml"
67
+ target_url = [@website, @public_type, html_filename].join('/')
68
+ publish_dynarex(html_filepath, {title: html_filename, url: target_url })
69
+ tags = doc.root.xpath('summary/tags/tag/text()')
70
+
71
+ raw_msg = "%s %s" % [doc.root.text('summary/title'),
72
+ tags.map {|x| "#%s" % x }.join]
73
+
74
+ end
75
+
76
+ [raw_msg, target_url]
77
+ end
78
+
79
+ end
80
+
81
+ private
82
+
83
+ def modify_xml(doc, filepath)
84
+
85
+ raw_msg = microblog_title2(doc)
86
+ doc.instructions.push %w(xml-stylesheet title='XSL_formatting' type='text/xsl') + ["href='#{@website}/r/xsl/#{@public_type}.xsl'"]
87
+ doc = yield(doc) if block_given?
88
+ File.write filepath, doc.xml(pretty: true)
89
+ end
90
+
91
+
92
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mymedia-pages
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
+ 8ixkARkWAmV1MB4XDTE0MTAxMTA3MjEyNloXDTE1MTAxMTA3MjEyNlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAO4uMlwDp8SzCTHHoNR5yg7iXw30qPSFTo/0o9mZUUgAL4FBVZ3cW0q+SKFb
19
+ AD6WxWLXMQMEwiWK2vjqatc3/OVKmXiTJwCnpv5c1Dhe3weKu+GQQjBy/d9WwwsB
20
+ qpcWvJVWfSB0juu0j71y3X2GyAkuas7jwarVIANiz/bw61IyPxWwB+Z/Fk3SHon3
21
+ 7myi4HUyAyI3Hzh9LYv5x70hFaNv8iBz3jtAJoO5LdqfEBsJNcVNP5CTRqcdsMXy
22
+ ZV+lfBPWlTObaiWKjoTZzWqKSuqDKXvJeSy+NjJ2TUyD7AYBh0ZYEwgw76+ek4Cb
23
+ QJJu5cWB8ahHCNQMKhHCa6A/eLkCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQU9nDRpUKIQRdeqhpJ5U+IYU9IcUwwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAhd+6VtkW
27
+ zTWhEASEUzwwdljhmphQ9+LnB7kr4v48YdzWItKmxP7JB+G7NlUltNxQdKP8NaQp
28
+ 0c5Sclk44z8+40sitYz4L+NN0XOnfPPKaEzNpKwD24PfKzpEfimgoWu7GYgBMqPv
29
+ iMlNwLMWUP/1odJBfaZA5SSlXzEI5BiFeOtxfTRpk0PZPB/mAPTGfJrfoAedfVrR
30
+ HYQ7SZQHsL53Qog6zW3FIF708tn1G20bkYqWnYKdzKBvpSxGk4BShAaKFZ7g0xJt
31
+ R8qQYTqUH5uyN1gXTamDXNnXrSWNIRgATqBFU0Rk4ia1O2X6/oMnJctbKR+A3n78
32
+ zZLvJwXE0u524g==
33
+ -----END CERTIFICATE-----
34
+ date: 2014-10-11 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: mymedia-blogbase
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.0
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.0
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/mymedia-pages.rb
63
+ homepage: https://github.com/jrobertson/mymedia-pages
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.2.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: A MyMedia gem to publish a basic web page
87
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ {�ļ�~�Z
2
  ��������a:���%�Sd�o% �Z�����IwҺ���3�o���n����$����i�@~�aנ�н!�+k"��qliW�Ŗ9�y�IQٴ&=��q�9��)�m�[ �Ts���j�@��?0O��(�~��s��n������3504�J���n�oc���$���m��*^Z�B�UN��`��'�ʓ�?����"�xh�5!)����^ n<���=;�� u�*�c��]M��j�Mma��