macaroni 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: de6f5db96d312d5132b0c488126d6e79c71c9d06
4
+ data.tar.gz: f5674e1459d23c79573b8426951242998f8f16a7
5
+ SHA512:
6
+ metadata.gz: 5d09ede84f48871a395cffcd84a33f0d6b9e5d966e729371c5bb7d217288cfbf3a059c31689846403c2abd3c213015078dcde31c0b4fe8df47a658de26943d05
7
+ data.tar.gz: c5c894adb9f10f1d44abc27cae1ee95bc6b2378fa816ba48694a520feadbbafad9f9557b334960294728f3fd2eba38d8e8c3a0d65a65081f4debc727ffeaf2e2
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Macaroni [![Build Status](https://secure.travis-ci.org/mizoR/macaroni.png)](https://travis-ci.org/mizoR/macaroni) [![Code Climate](https://codeclimate.com/github/mizoR/macaroni.png)](https://codeclimate.com/github/mizoR/macaroni) [![Coverage Status](https://coveralls.io/repos/mizoR/macaroni/badge.png?branch=master)](https://coveralls.io/r/mizoR/macaroni?branch=master)
1
+ # Macaroni [![Build Status](https://secure.travis-ci.org/mizoR/macaroni.png)](https://travis-ci.org/mizoR/macaroni) [![Code Climate](https://codeclimate.com/github/mizoR/macaroni.png)](https://codeclimate.com/github/mizoR/macaroni) [![Coverage Status](https://coveralls.io/repos/mizoR/macaroni/badge.png?branch=master)](https://coveralls.io/r/mizoR/macaroni?branch=master) [![Dependency Status](https://gemnasium.com/mizoR/macaroni.png)](https://gemnasium.com/mizoR/macaroni)
2
2
 
3
3
 
4
4
  Macaroni is a ruby DSL for easily feed agregation and pipeline processing.
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'net/http'
3
+
4
+ module Macaroni
5
+ module Plugin
6
+ module Output
7
+ class Ikachan
8
+ def initialize(base_url, channel)
9
+ @base_url = base_url
10
+ @channel = channel
11
+ end
12
+
13
+ def exec(data)
14
+ return data if data.empty?
15
+
16
+ uri = URI.parse "#{@base_url}"
17
+ Net::HTTP.new(uri.host, uri.port).start do |http|
18
+ data.each do |row|
19
+ request = Net::HTTP::Post.new('/join')
20
+ request.set_form_data(:channel => @channel)
21
+ http.request(request)
22
+
23
+ request = Net::HTTP::Post.new('/notice')
24
+ request.set_form_data(:channel => @channel, :message => row[:message])
25
+ http.request(request)
26
+
27
+ if row[:handler]
28
+ request = Net::HTTP::Post.new('/notice')
29
+ request.set_form_data(:channel => @channel, :message => row[:handler])
30
+ http.request(request)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
@@ -1,3 +1,3 @@
1
1
  module Macaroni
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/macaroni.rb CHANGED
@@ -7,6 +7,7 @@ require 'macaroni/plugin/filter'
7
7
  require 'macaroni/plugin/filter/deduped'
8
8
  require 'macaroni/plugin/output/stdout'
9
9
  require 'macaroni/plugin/output/im_kayac'
10
+ require 'macaroni/plugin/output/ikachan'
10
11
  require 'optparse'
11
12
 
12
13
  module Macaroni
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ describe Macaroni::Plugin::Input::RSS do
4
+ before do
5
+ @url = 'http://example.com/'
6
+ @rss = described_class.new @url
7
+ OpenURI.stub(:open_uri)
8
+ FeedNormalizer::FeedNormalizer.stub(:parse)
9
+ end
10
+
11
+ it do
12
+ uri = URI.parse(@url)
13
+ OpenURI.should_receive(:open_uri).with(uri).and_return('')
14
+ FeedNormalizer::FeedNormalizer.should_receive(:parse).and_return ['b']
15
+ expect(@rss.exec(['a'])).to eq ['a', 'b']
16
+ end
17
+ end
18
+
@@ -0,0 +1,19 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ describe Macaroni::Plugin::Output::Ikachan do
4
+ before do
5
+ @ikachan = described_class.new 'http://example.com:5000/', '#test'
6
+ end
7
+
8
+ it do
9
+ http = double 'http'
10
+ http.stub :start
11
+ Net::HTTP.stub(:new).and_return(http)
12
+
13
+ Net::HTTP.should_receive(:new).with('example.com', 5000)
14
+ http.should_receive(:start)
15
+
16
+ @ikachan.exec [{:message => 'Hello World!'}]
17
+ end
18
+ end
19
+
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ describe Macaroni::Plugin::Output::ImKayac do
4
+ before do
5
+ @im_kayac = described_class.new({
6
+ :username => 'macaroni',
7
+ :password => 'macar0ni',
8
+ })
9
+ end
10
+
11
+ it do
12
+ http = double 'http'
13
+ http.stub :start
14
+ Net::HTTP.stub(:new).and_return(http)
15
+
16
+ Net::HTTP.should_receive(:new).with('im.kayac.com', 80)
17
+ http.should_receive(:start)
18
+
19
+ @im_kayac.exec [{:message => 'Hello World!'}]
20
+ end
21
+ end
22
+
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macaroni
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - mizoR
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-29 00:00:00.000000000 Z
11
+ date: 2013-07-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: feed-normalizer
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: nokogiri
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: pry
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: coveralls
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  description: Macaroni is a ruby DSL for easily feed agregation and pipeline processing.
@@ -117,6 +106,7 @@ files:
117
106
  - lib/macaroni/plugin/filter/deduped.rb
118
107
  - lib/macaroni/plugin/input/html.rb
119
108
  - lib/macaroni/plugin/input/rss.rb
109
+ - lib/macaroni/plugin/output/ikachan.rb
120
110
  - lib/macaroni/plugin/output/im_kayac.rb
121
111
  - lib/macaroni/plugin/output/stdout.rb
122
112
  - lib/macaroni/version.rb
@@ -125,38 +115,43 @@ files:
125
115
  - spec/macaroni/core/pipe_spec.rb
126
116
  - spec/macaroni/dsl_spec.rb
127
117
  - spec/macaroni/plugin/filter_spec.rb
118
+ - spec/macaroni/plugin/input/rss_spec.rb
119
+ - spec/macaroni/plugin/output/ikachan_spec.rb
120
+ - spec/macaroni/plugin/output/im_kayac_spec.rb
128
121
  - spec/macaroni/plugin/output/stdout_spec.rb
129
122
  - spec/macaroni_spec.rb
130
123
  - spec/spec_helper.rb
131
124
  homepage: https://github.com/mizoR/macaroni
132
125
  licenses: []
126
+ metadata: {}
133
127
  post_install_message:
134
128
  rdoc_options: []
135
129
  require_paths:
136
130
  - lib
137
131
  required_ruby_version: !ruby/object:Gem::Requirement
138
- none: false
139
132
  requirements:
140
- - - ! '>='
133
+ - - '>='
141
134
  - !ruby/object:Gem::Version
142
135
  version: '0'
143
136
  required_rubygems_version: !ruby/object:Gem::Requirement
144
- none: false
145
137
  requirements:
146
- - - ! '>='
138
+ - - '>='
147
139
  - !ruby/object:Gem::Version
148
140
  version: '0'
149
141
  requirements: []
150
142
  rubyforge_project:
151
- rubygems_version: 1.8.23
143
+ rubygems_version: 2.0.3
152
144
  signing_key:
153
- specification_version: 3
145
+ specification_version: 4
154
146
  summary: Ruby DSL for feed aggregation.
155
147
  test_files:
156
148
  - spec/macaroni/core/application_spec.rb
157
149
  - spec/macaroni/core/pipe_spec.rb
158
150
  - spec/macaroni/dsl_spec.rb
159
151
  - spec/macaroni/plugin/filter_spec.rb
152
+ - spec/macaroni/plugin/input/rss_spec.rb
153
+ - spec/macaroni/plugin/output/ikachan_spec.rb
154
+ - spec/macaroni/plugin/output/im_kayac_spec.rb
160
155
  - spec/macaroni/plugin/output/stdout_spec.rb
161
156
  - spec/macaroni_spec.rb
162
157
  - spec/spec_helper.rb