mns_subscriber 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mns_subscriber.rb +23 -29
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6da650c65de84f41584341bfbed925060973d9a
|
4
|
+
data.tar.gz: 1c81ea15f3677db648fd7fc46f482e200612a7d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f9daef95b43094b1136c67ee627c90908d9c7aebab52e456b6d30b7d7003b3938eb91f322679c6d7ce522af91b8714ddabc42d14c577b5753cd3629cae85e35
|
7
|
+
data.tar.gz: 3d96323069f4aa9353ab712eddba10db68634f5365023f06cf7f0df7c61a3ccc4a3aacd0802665f4b2a771e51d8cfc83878cc427dab45630a745391d90ac8234
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mns_subscriber.rb
CHANGED
@@ -26,6 +26,8 @@ class MNSSubscriber < SPSSub
|
|
26
26
|
|
27
27
|
super(host: host, port: port)
|
28
28
|
@filepath, @timeline = dir, timeline
|
29
|
+
|
30
|
+
@index = nil
|
29
31
|
|
30
32
|
end
|
31
33
|
|
@@ -57,14 +59,13 @@ class MNSSubscriber < SPSSub
|
|
57
59
|
|
58
60
|
when :delete
|
59
61
|
|
60
|
-
subtopic
|
61
|
-
|
62
|
-
update_index_xml(subtopic)
|
62
|
+
delete_notice(subtopic=a[-2], msg)
|
63
|
+
|
63
64
|
else
|
64
65
|
|
65
66
|
subtopic, id = a[1..-1]
|
66
67
|
add_notice(subtopic, msg, id)
|
67
|
-
|
68
|
+
|
68
69
|
end
|
69
70
|
|
70
71
|
end
|
@@ -99,6 +100,8 @@ class MNSSubscriber < SPSSub
|
|
99
100
|
table: {items: record})
|
100
101
|
index.create record
|
101
102
|
|
103
|
+
update_index_xml(index, topic_dir)
|
104
|
+
|
102
105
|
end
|
103
106
|
|
104
107
|
self.notice "%s/add: %s/status/%s" % [@timeline, topic, id] if @timeline
|
@@ -120,43 +123,34 @@ class MNSSubscriber < SPSSub
|
|
120
123
|
|
121
124
|
if File.exists? indexdb then
|
122
125
|
|
123
|
-
RecordxSqlite.new(indexdb, table: 'items')
|
124
|
-
|
126
|
+
index = RecordxSqlite.new(indexdb, table: 'items')
|
127
|
+
index.delete id
|
128
|
+
update_index_xml(index, topic_dir)
|
125
129
|
end
|
126
130
|
|
127
131
|
end
|
128
132
|
|
129
|
-
def update_index_xml(
|
133
|
+
def update_index_xml(index, topic_dir)
|
134
|
+
|
135
|
+
# create the index.xml file
|
130
136
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
if File.exists? indexdb then
|
135
|
-
|
136
|
-
items = RecordxSqlite.new(indexdb, table: 'items')
|
137
|
-
|
138
|
-
# create the index.xml file
|
139
|
-
|
140
|
-
a = items.order(:desc).first(15)
|
141
|
-
a2 = a.map(&:to_h)
|
142
|
-
a2.each {|x| x[:item_id] = x.delete :id }
|
137
|
+
a = index.order(:desc).first(15)
|
138
|
+
a2 = a.map(&:to_h)
|
139
|
+
a2.each {|x| x[:item_id] = x.delete :id }
|
143
140
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
dx.save File.join(topic_dir, 'index.xml')
|
151
|
-
|
152
|
-
end
|
141
|
+
dx = Dynarex.new
|
142
|
+
dx.import a2
|
143
|
+
dx.order ='descending'
|
144
|
+
#dx.default_key = 'item_id'
|
145
|
+
|
146
|
+
dx.save File.join(topic_dir, 'index.xml')
|
153
147
|
|
154
148
|
end
|
155
149
|
|
156
150
|
def update_attributes(attribute, topic, value)
|
157
151
|
|
158
152
|
topic_dir = File.join(@filepath, topic)
|
159
|
-
notices = DailyNotices.new topic_dir, @options.merge(identifier: topic)
|
153
|
+
notices = DailyNotices.new topic_dir, @options.merge(identifier: topic)
|
160
154
|
notices.method((attribute.to_s + '=').to_sym).call(value)
|
161
155
|
notices.save
|
162
156
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|