macaroni 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -1
- data/example/example.rb +6 -0
- data/lib/macaroni/plugin/input/html.rb +19 -0
- data/lib/macaroni/plugin/input/rss.rb +3 -2
- data/lib/macaroni/version.rb +1 -1
- data/lib/macaroni.rb +1 -0
- data/macaroni.gemspec +2 -1
- metadata +19 -2
data/.travis.yml
CHANGED
data/example/example.rb
CHANGED
@@ -15,6 +15,12 @@ pipe :news do
|
|
15
15
|
plug Output::Stdout
|
16
16
|
end
|
17
17
|
|
18
|
+
pipe :ruby_news do
|
19
|
+
plug Input::HTML, 'http://www.ruby-lang.org/en/'
|
20
|
+
plug Filter::Css, '#content div.post h3'
|
21
|
+
plug Output::Stdout
|
22
|
+
end
|
23
|
+
|
18
24
|
pipe :string_processing_sample, :data => 'Hello World!' do
|
19
25
|
plug Filter::Downcase
|
20
26
|
plug Output::Stdout
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'feed-normalizer'
|
3
|
+
require 'nokogiri'
|
4
|
+
|
5
|
+
module Macaroni
|
6
|
+
module Plugin
|
7
|
+
module Input
|
8
|
+
class HTML
|
9
|
+
def initialize(url)
|
10
|
+
@url = url
|
11
|
+
end
|
12
|
+
|
13
|
+
def exec(data)
|
14
|
+
Nokogiri::HTML(open(@url))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -6,11 +6,12 @@ module Macaroni
|
|
6
6
|
module Input
|
7
7
|
class RSS
|
8
8
|
def initialize(url)
|
9
|
-
@
|
9
|
+
@url = url
|
10
10
|
end
|
11
11
|
|
12
12
|
def exec(data)
|
13
|
-
|
13
|
+
feed = FeedNormalizer::FeedNormalizer.parse open(@url)
|
14
|
+
data + feed.entries
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
data/lib/macaroni/version.rb
CHANGED
data/lib/macaroni.rb
CHANGED
@@ -2,6 +2,7 @@ require 'macaroni/version'
|
|
2
2
|
require 'macaroni/core/application'
|
3
3
|
require 'macaroni/core/pipe'
|
4
4
|
require 'macaroni/plugin/input/rss'
|
5
|
+
require 'macaroni/plugin/input/html'
|
5
6
|
require 'macaroni/plugin/filter'
|
6
7
|
require 'macaroni/plugin/filter/deduped'
|
7
8
|
require 'macaroni/plugin/output/stdout'
|
data/macaroni.gemspec
CHANGED
@@ -10,13 +10,14 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["r.mizokami@gmail.com"]
|
11
11
|
gem.description = %q{Macaroni is a ruby DSL for easily feed agregation and pipeline processing.}
|
12
12
|
gem.summary = %q{Ruby DSL for feed aggregation.}
|
13
|
-
gem.homepage = ""
|
13
|
+
gem.homepage = "https://github.com/mizoR/macaroni"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
gem.add_dependency "feed-normalizer"
|
20
|
+
gem.add_dependency "nokogiri"
|
20
21
|
|
21
22
|
gem.add_development_dependency "pry"
|
22
23
|
gem.add_development_dependency "rspec"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macaroni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: nokogiri
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: pry
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,6 +115,7 @@ files:
|
|
99
115
|
- lib/macaroni/plugin/filter.rb
|
100
116
|
- lib/macaroni/plugin/filter/base.rb
|
101
117
|
- lib/macaroni/plugin/filter/deduped.rb
|
118
|
+
- lib/macaroni/plugin/input/html.rb
|
102
119
|
- lib/macaroni/plugin/input/rss.rb
|
103
120
|
- lib/macaroni/plugin/output/im_kayac.rb
|
104
121
|
- lib/macaroni/plugin/output/stdout.rb
|
@@ -111,7 +128,7 @@ files:
|
|
111
128
|
- spec/macaroni/plugin/output/stdout_spec.rb
|
112
129
|
- spec/macaroni_spec.rb
|
113
130
|
- spec/spec_helper.rb
|
114
|
-
homepage:
|
131
|
+
homepage: https://github.com/mizoR/macaroni
|
115
132
|
licenses: []
|
116
133
|
post_install_message:
|
117
134
|
rdoc_options: []
|