mymedia-kvx 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ee5061f83767da337f9fe4ba2c5ebbf5ff4cb7e7
4
+ data.tar.gz: 818d112ea1326f20a9fb9775a67c7dae1fa0a600
5
+ SHA512:
6
+ metadata.gz: 8d04f853d42184fd47670da6e936a84bb3caef76c7acf3afa605ebe76ab9b4b6567c3d389f573582104ee089871e3310ab68a6a9135733bde13597ca8683eedf
7
+ data.tar.gz: 35b26c64a3dce04f55a08b23eb2de0ba8ba0900956e4ee446dba94c0847f7f21038dd13e93aec92ceacc1fe2ab4defbee3a58fa2f98b517e85e7ded75dda053d
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: mymedia-kvx.rb
4
+
5
+
6
+ require 'mymedia'
7
+
8
+
9
+
10
+ class MyMediaKvx < MyMedia::Base
11
+
12
+ attr_reader :kvx
13
+
14
+ def initialize(opt={}, public_type: 'kvx', media_type: public_type,
15
+ config: nil, ext: '.txt')
16
+
17
+ @public_type = public_type
18
+ super(media_type: media_type, public_type: public_type, config: config)
19
+
20
+ @media_src = "%s/media/%s" % [@home, public_type]
21
+ @prefix = 'k'
22
+ @target_ext = '.xml'
23
+
24
+ @media_type = media_type
25
+ @ext = ext
26
+
27
+ end
28
+
29
+
30
+ private
31
+
32
+ def copy_publish(filename, raw_msg='')
33
+
34
+ src_path = File.join(@media_src, filename)
35
+ raise "file not found : " + src_path unless File.exists? src_path
36
+
37
+ file_publish(src_path, raw_msg) do |destination, raw_destination|
38
+
39
+ if not raw_msg or raw_msg.empty? then
40
+ raw_msg = File.basename(src_path) + " updated: " + Time.now.to_s
41
+ end
42
+
43
+ if File.extname(src_path) == '.txt' then
44
+
45
+ kvx, raw_msg = copy_edit(src_path, destination)
46
+ copy_edit(src_path, raw_destination)
47
+
48
+ else
49
+
50
+ kvx = Kvx.new(src_path)
51
+ title = kvx.summary[:title] || ''
52
+
53
+ kvx.summary[:original_source] = File.basename(src_path)
54
+
55
+ File.write destination, kvx.to_s
56
+
57
+ end
58
+
59
+ if not File.basename(src_path)[/#{@prefix}\d{6}T\d{4}\.txt/] then
60
+
61
+ xml_filename = File.basename(src_path).sub(/txt$/,'xml')
62
+ FileUtils.cp destination, @home + "/#{@public_type}/" + xml_filename
63
+
64
+ if File.extname(src_path) == '.txt' then
65
+ FileUtils.cp src_path, @home + "/#{public_type}/" + File.basename(src_path)
66
+ end
67
+
68
+ #publish the static links feed
69
+ kvx_filepath = @home + "/#{@public_type}/static.xml"
70
+
71
+ target_url = "%s/%s/%s" % [@website, @public_type, xml_filename]
72
+
73
+ publish_dynarex(kvx_filepath, {title: xml_filename, url: target_url })
74
+
75
+ end
76
+
77
+ [raw_msg,target_url]
78
+ end
79
+
80
+ end
81
+
82
+ def copy_edit(src_path, destination, raw='')
83
+
84
+ txt_destination = destination.sub(/xml$/,'txt')
85
+ FileUtils.cp src_path, txt_destination
86
+
87
+ buffer = File.read(src_path)
88
+ buffer2 = buffer.gsub(/\[[xX]\]/,'✓').gsub(/\[\s*\]/,'.')
89
+
90
+ @kvx = Kvx.new(buffer2.strip)
91
+
92
+ title = kvx.summary[:title]
93
+
94
+ tags = if kvx.summary[:tags] then
95
+ '#' + kvx.summary[:tags].split.join(' #')
96
+ else
97
+ ''
98
+ end
99
+
100
+ raw_msg = ("%s %s" % [title, tags]).strip
101
+
102
+ kvx.summary[:original_source] = File.basename(src_path)
103
+ kvx.summary[:source] = File.basename(txt_destination)
104
+
105
+ kvx.summary[:xslt] = @xsl unless kvx.item[:xslt]
106
+ File.write destination, kvx.to_xml
107
+
108
+ # copy the media file to the destination
109
+ destination = kvx.body[:file][/^https?:\/\/[^\/]+(.*)/,1]
110
+ file = destination[/[^\/]+$/]
111
+ FileUtils.cp File.join(@media_src, file), File.join(@home, destination)
112
+
113
+ [kvx, raw_msg]
114
+ end
115
+
116
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mymedia-kvx
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
+ 8ixkARkWAmV1MB4XDTE1MDUwNTA4MjQzOVoXDTE2MDUwNDA4MjQzOVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAJWA1DBZW0WsXaTs6ay04jSWMEbqOaOyijG7tUpcc4Jo5zdnwvTYs42Q3QDm
19
+ jPclncNIIiNKFWP7b8b10Wf6UBZkhAZJMit7o4tbQ6pM3J9Bil445vBGoDeAcgrt
20
+ 3LDsJ+JgqBcarJQvJx5ud5IbmotMUOZ7MaPYWoB02ERo9C5u7G0v1ThgYLUTp3a3
21
+ dKvc3MTaZJgRQLOj3K9gWzzOHdHfgmvMmBXX5kgCQYTm0ckbjlqtGijUmyELf+AP
22
+ bisbfLXS8XYDoPY8IKQAiG00Id802FQXc7RpS3YMC3G0VT/I53YGU0njScU40dSu
23
+ cIQ1N2ADYKyIdbduSAr7MDt0Kq0CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUHi8JNZPvhkscL73ZnOEwmkrJh+kwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAK29d0om+
27
+ sUmgt2ULX6g5MkNMa6zi7f4Pp9EzUEdnmpanJnzzApn3LDdAlcfYer1XnJd4RaYy
28
+ USd2WqWSXkLm2XPos/aykHErsOMsQi9MwvxdHL1CirXY8YKa+M6SqKxmVOksFUN7
29
+ qPYifzobekNdPew4WgdIx5lt4H2lgqQOE+vriuyFKznFOplcicIhgUWaYYZgcWkO
30
+ dKVklEKSKbuK/r0L9dtVcXT9HLwjuKIJfKengu4dLyY1XWd97ML91pF8rLGG4oxI
31
+ YzFxKlntIoLHNxMAQ9M9J4Yo+Lqm3HQ1PfyOUBU1Ut9Jkp76o++6L7SZbjSkvntp
32
+ 3P+jHJ4bpGBJQg==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-05-05 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-kvx.rb
63
+ homepage: https://github.com/jrobertson/mymedia-kvx
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: Publishes Kvx files using the MyMedia framework
87
+ test_files: []
metadata.gz.sig ADDED
Binary file