ruboty-feed 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +17 -0
- data/Rakefile +10 -0
- data/lib/ruboty/feed/version.rb +5 -0
- data/lib/ruboty/feed.rb +2 -0
- data/lib/ruboty/handlers/feed.rb +42 -0
- data/ruboty-feed.gemspec +26 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 86e94bc72e665f27f93e894a81fc4267afbc69b0
|
4
|
+
data.tar.gz: df56ea088bb0b58d36c610a3a7162f0c979250b3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 79d5ed5b6a05f70ed1f1980a9b75b5b04711dd719644167715118f1ea1e187356c36c91859e4b97f5489324a533cbf10f832973304b4f3a1e9eead48ef205fcd
|
7
|
+
data.tar.gz: 6ced012925958f0ac713718f700dd57769d58c517e0ba0e6fd2bceaf2fa5b9e18b5d36069d760fb16c454bf8fe04ae628a57c51ed812bcbda74e981e9df99090
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Hirofumi Wakasugi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Ruboty::Feed
|
2
|
+
|
3
|
+
Ruboty plug-in to subscribe RSS feed (along with [ruboty-cron](ruboty-cron)).
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Fetch RSS/Atom Feed by providing a feed's URL.
|
8
|
+
|
9
|
+
```
|
10
|
+
@ruboty subscribe <feed url>
|
11
|
+
```
|
12
|
+
|
13
|
+
However, as you usually want to subscribe a feed for fetching periodically, use this together with ruboty-cron is recommended.
|
14
|
+
|
15
|
+
```
|
16
|
+
@ruboty add job "0 * * * *" @ruboty subscribe <feed url>
|
17
|
+
```
|
data/Rakefile
ADDED
data/lib/ruboty/feed.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'ruboty'
|
2
|
+
require 'ruboty/feed'
|
3
|
+
require 'feedjira'
|
4
|
+
|
5
|
+
module Ruboty
|
6
|
+
module Handlers
|
7
|
+
class Feed < Base
|
8
|
+
NAMESPACE = 'feed'
|
9
|
+
|
10
|
+
on(
|
11
|
+
/subscribe (?<feed_url>.+)/,
|
12
|
+
description: 'Subscribe a feed',
|
13
|
+
name: :subscribe
|
14
|
+
)
|
15
|
+
|
16
|
+
def subscribe(message)
|
17
|
+
feed_url = message[:feed_url]
|
18
|
+
feed = Feedjira::Feed.fetch_and_parse(feed_url)
|
19
|
+
|
20
|
+
feed.entries.each do |entry|
|
21
|
+
next if stored?(entry.url)
|
22
|
+
message.reply(entry.url)
|
23
|
+
store_entry_url(entry.url)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def store
|
30
|
+
robot.brain.data[NAMESPACE] ||= {}
|
31
|
+
end
|
32
|
+
|
33
|
+
def store_entry_url(entry_url)
|
34
|
+
store[entry_url] = true
|
35
|
+
end
|
36
|
+
|
37
|
+
def stored?(entry_url)
|
38
|
+
store[entry_url] ? true : false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/ruboty-feed.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "ruboty/feed/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "ruboty-feed"
|
7
|
+
spec.version = Ruboty::Feed::VERSION
|
8
|
+
spec.authors = ["Hirofumi Wakasugi"]
|
9
|
+
spec.email = ["baenej@gmail.com"]
|
10
|
+
spec.summary = "Ruboty plug-in to subscribe RSS/Atom feed."
|
11
|
+
spec.description = "Ruboty plug-in to subscribe RSS/Atom feed."
|
12
|
+
spec.homepage = "https://github.com/5t111111/ruboty-feed"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_runtime_dependency "ruboty"
|
21
|
+
spec.add_runtime_dependency "feedjira", "~> 2.0.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruboty-feed
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hirofumi Wakasugi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruboty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: feedjira
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
description: Ruboty plug-in to subscribe RSS/Atom feed.
|
84
|
+
email:
|
85
|
+
- baenej@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/ruboty/feed.rb
|
96
|
+
- lib/ruboty/feed/version.rb
|
97
|
+
- lib/ruboty/handlers/feed.rb
|
98
|
+
- ruboty-feed.gemspec
|
99
|
+
homepage: https://github.com/5t111111/ruboty-feed
|
100
|
+
licenses:
|
101
|
+
- MIT
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.5.1
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: Ruboty plug-in to subscribe RSS/Atom feed.
|
123
|
+
test_files: []
|