rss_creator 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 +0 -0
- data.tar.gz.sig +1 -0
- data/lib/rss_creator.rb +60 -0
- metadata +87 -0
- metadata.gz.sig +2 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c744cef7596827d02c2f4c1aa6267850df2f9786
|
4
|
+
data.tar.gz: 21f9c9128dfe8b924814d29e5d7fbb799b684e5b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db59fed0d65c18a8355c3a7ddff94fa4a62ad876aca775b0a255971473661bbcc1ee291f70f1ea6ff6ab8f59259a4cfbfa5c5f9822be0805380966f7464c9227
|
7
|
+
data.tar.gz: ca1a2eeb755a0d91da0fce00d5514f36dc883d33ebc85884002dfcc6643d69295dacd8b27b895096a87703514d2f82707fce3b3d6289d1d6722605eb01b97b49
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
j��M�7d�6���Z��%|lI��u���Q��V���� q������w� ��{�A�ث3e�G�rM����o�d�Uv���`|��i�~!�.*�mm�Ty�+�W�ag�պ-}(�2<8y���>y3f=�`�������G�IT{'U��~�1^���4rU�%��V�_�sK8�Y����09��`2D�-�����A��ߔ�x�e�Ӫ�ua?�$M�{NA��N,���K*Û1�&��r- e�j`
|
data/lib/rss_creator.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: rss_creator.rb
|
4
|
+
|
5
|
+
require 'dynarex'
|
6
|
+
|
7
|
+
|
8
|
+
class RSScreator
|
9
|
+
|
10
|
+
attr_accessor :title, :desc, :limit
|
11
|
+
|
12
|
+
def initialize(filepath=nil)
|
13
|
+
|
14
|
+
@filepathpath = filepath
|
15
|
+
@dx = Dynarex.new 'channel[title,desc]/item(title, link, description, created_at)'
|
16
|
+
@dx.order = 'descending'
|
17
|
+
@dx.xslt_schema = 'channel[title:title,description:desc]/' \
|
18
|
+
+ 'item(title:title,description:description,link:link,pubDate:created_at)'
|
19
|
+
@dx.title, @dx.desc = '', ''
|
20
|
+
|
21
|
+
# maxium number of items saved in the RSS feed
|
22
|
+
@limit = 11
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def add(item={title: '', link: '', description: ''})
|
27
|
+
|
28
|
+
record = {created_at: Time.now.strftime("%a, %d %b %Y %H:%M:%S %z")}.\
|
29
|
+
merge(item)
|
30
|
+
@dx.create record
|
31
|
+
end
|
32
|
+
|
33
|
+
def save(new_filepath)
|
34
|
+
|
35
|
+
filepath = new_filepath ? new_filepath : @filepath
|
36
|
+
File.write filepath, print_rss
|
37
|
+
end
|
38
|
+
|
39
|
+
def dynarex()
|
40
|
+
@dx
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_s()
|
44
|
+
print_rss
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def print_rss()
|
50
|
+
|
51
|
+
if @title.nil? or @desc.nil? then
|
52
|
+
raise 'RSScreator: title, or desc can\'t be blank'
|
53
|
+
end
|
54
|
+
|
55
|
+
@dx.title, @dx.desc = @title, @desc
|
56
|
+
@dx.to_rss({limit: @limit})
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rss_creator
|
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
|
+
YXN0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R27tYXsGZaQIwS5d
|
29
|
+
k0Urk+04PNVuoDNbgG8Gr0gxwZq4zdxep2/79Ztefpz1hhKjZubjzP4IJVd3jnOM
|
30
|
+
lr9ynL4ipctg16hYjhemfj9eBQ4cqHO9qNts9MT8L2b95O8SwNB898tHlYWvF2GG
|
31
|
+
9HFHvRHJvHbKI5qIF3G+KkFUx2ZXkSCaRP6NDkkPo0IY6vJ34w4pDwdSH4jHpld9
|
32
|
+
4pCsHtS+NYWg/g==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: dynarex
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.5'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.5.38
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.5'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.5.38
|
56
|
+
description:
|
57
|
+
email: james@r0bertson.co.uk
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/rss_creator.rb
|
63
|
+
homepage: https://github.com/jrobertson/rss_creator
|
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 gem for creating RSS feeds
|
87
|
+
test_files: []
|
metadata.gz.sig
ADDED