mns_timeline 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +1 -0
- data/lib/mns_timeline.rb +89 -0
- metadata +128 -0
- metadata.gz.sig +2 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d421b97678029d8c0e9aa0459b17bad60a6ba617
|
4
|
+
data.tar.gz: cf64d5b6293e45c7ae6073d2a727812028aba920
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5d95206d0aa340b713acc710660a85bc3b2046ba29fc0cd10f6a397f5109117418c7997d9bee3da07154a9531c73a226d1b03f5acab13b0b8f1e78691a72dca9
|
7
|
+
data.tar.gz: 7a0be83d9445481d5a27ae23b7b23183ace3694448dfbeb4136989f75ede21028af5f41081aacc93aa98e83f102c2e7f9fc34edc1268a22d11388236070548ef
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
e����Z���`��?z�o*�$i|/�J�_�q��K���2=b�N{�Ij�_��d
|
data/lib/mns_timeline.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: mns_timeline.rb
|
4
|
+
|
5
|
+
|
6
|
+
require 'sps-sub'
|
7
|
+
require "sqlite3"
|
8
|
+
require 'fileutils'
|
9
|
+
require 'daily_notices'
|
10
|
+
|
11
|
+
|
12
|
+
class MNSTimeline < SPSSub
|
13
|
+
|
14
|
+
def initialize(timeline: 'notices', host: 'sps', port: 59000, dir: '.', options: {})
|
15
|
+
|
16
|
+
# note: a valid url_base must be provided
|
17
|
+
|
18
|
+
@options = {
|
19
|
+
url_base: 'http://yourwebsitehere.co.uk/',
|
20
|
+
dx_xslt: '/xsl/dynarex.xsl',
|
21
|
+
rss_xslt: '/xsl/feed.xsl',
|
22
|
+
target_page: :page,
|
23
|
+
target_xslt: '/xsl/page.xsl'
|
24
|
+
}.merge(options)
|
25
|
+
|
26
|
+
super(host: host, port: port)
|
27
|
+
@filepath = dir
|
28
|
+
@timeline = timeline
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def subscribe(topic='timeline/add')
|
33
|
+
super(topic)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def ontopic(timeline_topic, msg)
|
39
|
+
|
40
|
+
puts "%s: %s %s" % [timeline_topic, Time.now.to_s, msg.inspect]
|
41
|
+
|
42
|
+
topic, id = msg.split('/').values_at 0, -1
|
43
|
+
url_base = @options[:url_base]
|
44
|
+
fileid = Time.at(id.to_i).strftime("%Y/%b/%d/").downcase + id + '/index.xml'
|
45
|
+
|
46
|
+
url = "%s%s/%s" % [url_base, topic, fileid]
|
47
|
+
kvx = Kvx.new url
|
48
|
+
msg = kvx.body[:description]
|
49
|
+
|
50
|
+
add_notice(topic, msg, id)
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_notice(topic, msg, id)
|
55
|
+
|
56
|
+
timeline_dir = File.join(@filepath, @timeline)
|
57
|
+
notices = DailyNotices.new timeline_dir,
|
58
|
+
@options.merge(identifier: @timeline, title: @timeline.capitalize)
|
59
|
+
|
60
|
+
return_status = notices.add({description: msg, topic: topic}, id: id)
|
61
|
+
|
62
|
+
return if return_status == :duplicate
|
63
|
+
|
64
|
+
dbfilename = File.join(timeline_dir, topic + '.db')
|
65
|
+
|
66
|
+
if File.exists? dbfilename then
|
67
|
+
|
68
|
+
db = SQLite3::Database.new dbfilename
|
69
|
+
|
70
|
+
else
|
71
|
+
|
72
|
+
db = SQLite3::Database.new dbfilename
|
73
|
+
|
74
|
+
db.execute <<-SQL
|
75
|
+
create table notices (
|
76
|
+
ID INT PRIMARY KEY NOT NULL,
|
77
|
+
MESSAGE TEXT
|
78
|
+
);
|
79
|
+
SQL
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
db.execute("INSERT INTO notices (id, message)
|
84
|
+
VALUES (?, ?)", [id, msg])
|
85
|
+
sleep 1.5
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mns_timeline
|
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
|
+
8ixkARkWAmV1MB4XDTE3MDMxMDIzMzM1M1oXDTE4MDMxMDIzMzM1M1owSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBAKBLZKgJAc38dgFWdhE84zSch2txJcVmitzDgyuDlhyG364FzW7yntfMDtQF
|
19
|
+
qs0sGGPHEkvrfA/wzDgsVLeUK7hRSTqZ/fHD7cEMaX1LkQpkol8vOw2XlOivd0vn
|
20
|
+
qr9sZKdwPwfcdDgv9+/tzXXcX6jkrbpKd3A8R5Ufp7SHwp4TraDBGEzNlw5Fy1tk
|
21
|
+
+mwpmob6t5J4rzJaAwrX32jZuF8ohxkVX94HwLGplT2TXvQa9K3If2SWk8ZM9ZQJ
|
22
|
+
aTLLIFpvZT43hX++QQrUEip0xX7mqKkcGGxEh83s5wHECY0ICsCQmVRPYZ1fdTt6
|
23
|
+
8eg5+ga5CpB0P1Kca/xiYSv7RfMCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUMx7M/RsU1hk+LyaRigpyNTBulCYwJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAfxfUSKHy
|
27
|
+
SHtXC3PAjboLJJBxnIwrAEWS/UcHXhYqkhuSRlJ5GBaEwvyfeL9h6PCdVDhVzbtw
|
28
|
+
ztZneINHuOkEjNzuOH8d+F8WSfDDQr6HkOXCxNaaA4NW/sjJoHxngG9RJgPVSeTD
|
29
|
+
QlyKsIOpxS/XpEN3ZWO9Ul9wB7n6n/pXznb9ccfCIY1AtU/4zkpPC9Yn+LaqWgg/
|
30
|
+
tt1wOxojdLg/n0voyTNCNByk+EgDsC4ZxvVi3jOo2Edlt5s+j1IF7O4uMwToaFnh
|
31
|
+
YBz+URMHtVq6O+d7EkE/k4kCrvXbft0ECyMz6y5LS2066ci943uRhmBABvzPeO1K
|
32
|
+
tBQ+W56kQhJC1g==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: sps-sub
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.3'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.3.4
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.3'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.3.4
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: daily_notices
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.5'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.5.6
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.5'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.5.6
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: sqlite3
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.3.13
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '1.3'
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.3.13
|
96
|
+
description:
|
97
|
+
email: james@jamesrobertson.eu
|
98
|
+
executables: []
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- lib/mns_timeline.rb
|
103
|
+
homepage: https://github.com/jrobertson/mns_timeline
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.6.8
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: Subscribes to the SPS topic *timeline/add*, fetches the topic, message +
|
127
|
+
id and posts it to the timeline feed
|
128
|
+
test_files: []
|
metadata.gz.sig
ADDED