automatic 12.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/Gemfile +23 -0
  2. data/README.md +109 -0
  3. data/Rakefile +42 -0
  4. data/VERSION +1 -0
  5. data/app.rb +15 -0
  6. data/automatic.gemspec +122 -0
  7. data/bin/automatic +15 -0
  8. data/config/default.yml +29 -0
  9. data/config/feed2console.yml +15 -0
  10. data/db/.gitkeep +0 -0
  11. data/doc/COPYING +674 -0
  12. data/doc/ChangeLog +17 -0
  13. data/doc/PLUGINS.ja +205 -0
  14. data/doc/README.ja +449 -0
  15. data/lib/automatic.rb +60 -0
  16. data/lib/automatic/environment.rb +8 -0
  17. data/lib/automatic/feed_parser.rb +36 -0
  18. data/lib/automatic/log.rb +24 -0
  19. data/lib/automatic/pipeline.rb +36 -0
  20. data/lib/automatic/recipe.rb +31 -0
  21. data/lib/config/validator.rb +83 -0
  22. data/plugins/custom_feed/svn_log.rb +56 -0
  23. data/plugins/filter/ignore.rb +60 -0
  24. data/plugins/filter/image.rb +47 -0
  25. data/plugins/filter/tumblr_resize.rb +40 -0
  26. data/plugins/notify/ikachan.rb +85 -0
  27. data/plugins/publish/console.rb +31 -0
  28. data/plugins/publish/google_calendar.rb +86 -0
  29. data/plugins/publish/hatena_bookmark.rb +103 -0
  30. data/plugins/store/full_text.rb +57 -0
  31. data/plugins/store/permalink.rb +47 -0
  32. data/plugins/store/store_database.rb +53 -0
  33. data/plugins/store/target_link.rb +47 -0
  34. data/plugins/subscription/feed.rb +30 -0
  35. data/script/bootstrap +117 -0
  36. data/spec/plugins/custom_feed/svn_log_spec.rb +31 -0
  37. data/spec/plugins/filter/ignore_spec.rb +37 -0
  38. data/spec/plugins/filter/image_spec.rb +55 -0
  39. data/spec/plugins/filter/tumblr_resize_spec.rb +102 -0
  40. data/spec/plugins/notify/ikachan_spec.rb +28 -0
  41. data/spec/plugins/publish/console_spec.rb +24 -0
  42. data/spec/plugins/publish/google_calendar_spec.rb +82 -0
  43. data/spec/plugins/publish/hatena_bookmark_spec.rb +36 -0
  44. data/spec/plugins/store/full_text_spec.rb +39 -0
  45. data/spec/plugins/store/permalink_spec.rb +39 -0
  46. data/spec/plugins/store/target_link_spec.rb +30 -0
  47. data/spec/plugins/subscription/feed_spec.rb +36 -0
  48. data/spec/spec_helper.rb +82 -0
  49. data/test/integration/test_activerecord.yml +24 -0
  50. data/test/integration/test_fulltext.yml +24 -0
  51. data/test/integration/test_hatenabookmark.yml +26 -0
  52. data/test/integration/test_ignore.yml +22 -0
  53. data/test/integration/test_ignore2.yml +25 -0
  54. data/test/integration/test_image2local.yml +26 -0
  55. data/test/integration/test_svnlog.yml +14 -0
  56. data/test/integration/test_tumblr2local.yml +26 -0
  57. data/utils/auto_discovery.rb +18 -0
  58. data/utils/opml_parser.rb +247 -0
  59. data/vendor/.gitkeep +0 -0
  60. metadata +205 -0
@@ -0,0 +1,26 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: info
7
+
8
+ plugins:
9
+ - module: SubscriptionFeed
10
+ config:
11
+ feeds:
12
+ - http://id774.net/blog/feed/
13
+
14
+ - module: FilterIgnore
15
+ config:
16
+ exclude:
17
+ - hoge
18
+
19
+ - module: PublishHatenaBookmark
20
+ config:
21
+ username: username
22
+ password: password
23
+ interval: 1
24
+
25
+ - module: PublishConsole
26
+
@@ -0,0 +1,22 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: info
7
+
8
+ plugins:
9
+ - module: SubscriptionFeed
10
+ config:
11
+ feeds:
12
+ - http://id774.net/blog/feed/
13
+
14
+ - module: FilterIgnore
15
+ config:
16
+ title:
17
+ - Twitter
18
+ description:
19
+ - Facebook
20
+
21
+ - module: PublishConsole
22
+
@@ -0,0 +1,25 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: info
7
+
8
+ plugins:
9
+ - module: SubscriptionFeed
10
+ config:
11
+ feeds:
12
+ - http://id774.net/blog/feed/
13
+
14
+ - module: FilterIgnore
15
+ config:
16
+ title:
17
+ - Twitter
18
+
19
+ - module: FilterIgnore
20
+ config:
21
+ description:
22
+ - Facebook
23
+
24
+ - module: PublishConsole
25
+
@@ -0,0 +1,26 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: info
7
+
8
+ plugins:
9
+ - module: SubscriptionFeed
10
+ config:
11
+ feeds:
12
+ - http://fotologue.jp/sleepyrabbit/rss.xml
13
+
14
+ - module: StorePermalink
15
+ config:
16
+ db: image.db
17
+
18
+ - module: FilterImage
19
+
20
+ - module: FilterTumblrResize
21
+
22
+ - module: StoreTargetLink
23
+ config:
24
+ path: /tmp
25
+ interval: 1
26
+
@@ -0,0 +1,14 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: info
7
+
8
+ plugins:
9
+ - module: CustomFeedSVNLog
10
+ config:
11
+ target: http://redmine.rubyforge.org/svn
12
+ fetch_items: 2
13
+
14
+ - module: PublishConsole
@@ -0,0 +1,26 @@
1
+ global:
2
+ timezone: Asia/Tokyo
3
+ cache:
4
+ base: /tmp
5
+ log:
6
+ level: info
7
+
8
+ plugins:
9
+ - module: SubscriptionFeed
10
+ config:
11
+ feeds:
12
+ - http://reretlet.tumblr.com/rss
13
+
14
+ - module: StorePermalink
15
+ config:
16
+ db: image.db
17
+
18
+ - module: FilterImage
19
+
20
+ - module: FilterTumblrResize
21
+
22
+ - module: StoreTargetLink
23
+ config:
24
+ path: /tmp
25
+ interval: 1
26
+
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ class AutoDiscovery
5
+ require 'rubygems'
6
+ require 'feedbag'
7
+
8
+ def search(url)
9
+ Feedbag.find(url)
10
+ end
11
+ end
12
+
13
+ if __FILE__ == $0
14
+ require 'pp'
15
+ url = ARGV.shift || abort("Usage: autodiscovery.rb <url>")
16
+ auto_discovery = AutoDiscovery.new
17
+ pp auto_discovery.search(url)
18
+ end
@@ -0,0 +1,247 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require 'rexml/document'
5
+ require 'rexml/parsers/pullparser'
6
+
7
+ module OPML
8
+ def self::unnormalize(text)
9
+ text.gsub(/&(\w+);/) {
10
+ x = $1
11
+ case x
12
+ when 'lt'
13
+ '<'
14
+ when 'gt'
15
+ '>'
16
+ when 'quot'
17
+ '"'
18
+ when 'amp'
19
+ '&'
20
+ when 'apos'
21
+ "'"
22
+ when /^\#(\d+)$/
23
+ [$1.to_i].pack("U")
24
+ when /^\#x([0-9a-f]+)$/i
25
+ [$1.hex].pack("U")
26
+ else
27
+ raise "unnormalize error '#{x}'"
28
+ end
29
+ }
30
+ end
31
+
32
+ module DOM
33
+ class Element
34
+ include Enumerable
35
+
36
+ def initialize
37
+ @attr = {}
38
+ @parent = nil
39
+ @children = []
40
+ end
41
+ attr_accessor :parent
42
+ attr_reader :attr, :children
43
+
44
+ def each
45
+ yield self
46
+ @children.each {|c|
47
+ c.each {|x|
48
+ yield x
49
+ }
50
+ }
51
+ end
52
+
53
+ def <<(elem)
54
+ elem.parent = self if elem.respond_to? :parent=
55
+ @children << elem
56
+ self
57
+ end
58
+
59
+ def [](n)
60
+ if n.is_a? String
61
+ @attr[n]
62
+ else
63
+ @children[n]
64
+ end
65
+ end
66
+
67
+ def []=(k,v)
68
+ if k.is_a? String
69
+ @attr[k] = v
70
+ else
71
+ @children[k] = v
72
+ end
73
+ end
74
+
75
+ def text
76
+ @attr['text']
77
+ end
78
+
79
+ def type
80
+ @attr['type']
81
+ end
82
+
83
+ def is_comment?
84
+ @attr['isComment']=='true'
85
+ end
86
+
87
+ def is_breaakpoint?
88
+ @attr['isBreakpoint']=='true'
89
+ end
90
+ end # Element
91
+
92
+ class OPML < Element
93
+ def head
94
+ @children.find {|x| x.is_a? Head }
95
+ end
96
+
97
+ def body
98
+ @children.find {|x| x.is_a? Body }
99
+ end
100
+ end
101
+
102
+ class Head < Element
103
+ end
104
+
105
+ class Body < Element
106
+ def outline
107
+ @children.find {|x| x.is_a? Outline }
108
+ end
109
+ end
110
+
111
+ class Outline < Element
112
+ def method_missing(name,*arg,&block)
113
+ name = name.to_s
114
+ case name
115
+ when /^[a-z][0-9a-zA-Z_]*$/
116
+ key = name.gsub(/_([a-z])/) {|x| ".#{$1.upcase}" }
117
+ @attr[key]
118
+ else
119
+ raise NoMethodError
120
+ end
121
+ end
122
+ end
123
+ end # Model
124
+
125
+ class Parser
126
+ def initialize(port)
127
+ @p = REXML::Parsers::PullParser.new(port)
128
+ @opml = nil
129
+ end
130
+
131
+ def parse_tree
132
+ root = cur = nil
133
+ while event=@p.pull
134
+ case event.event_type
135
+ when :xmldecl
136
+ encoding = event[1]
137
+ when :start_element
138
+ case event[0]
139
+ when "opml"
140
+ root = cur = DOM::OPML.new
141
+ when "head"
142
+ e = DOM::Head.new
143
+ cur << e
144
+ cur = e
145
+ when "body"
146
+ e = DOM::Body.new
147
+ cur << e
148
+ cur = e
149
+ when "outline"
150
+ e = DOM::Outline.new
151
+ cur << e
152
+ cur = e
153
+ else
154
+ cur['.' + event[0]] = read_text
155
+ end
156
+ event[1].each {|k,v|
157
+ cur[k] = OPML::unnormalize(v)
158
+ }
159
+ when :end_element
160
+ cur = cur.parent
161
+ when :text
162
+ when :cdata
163
+ when :start_doctype
164
+ when :end_doctype,:comment
165
+ when :end_document
166
+ break
167
+ else
168
+ p event.event_type
169
+ p event
170
+ raise "unknown event"
171
+ end
172
+ end # while
173
+ root
174
+ end # parse_tree
175
+
176
+ def each_outline
177
+ root = cur = nil
178
+ while event=@p.pull
179
+ case event.event_type
180
+ when :xmldecl
181
+ encoding = event[1]
182
+ when :start_element
183
+ case event[0]
184
+ when "opml"
185
+ root = cur = DOM::OPML.new
186
+ when "head"
187
+ e = DOM::Head.new
188
+ cur << e
189
+ cur = e
190
+ when "body"
191
+ e = DOM::Body.new
192
+ cur << e
193
+ cur = e
194
+ when "outline"
195
+ e = DOM::Outline.new
196
+ # cur << e
197
+ cur = e
198
+ else
199
+ cur['_' + event[0]] = read_text
200
+ end
201
+ event[1].each {|k,v|
202
+ cur[k] = OPML::unnormalize(v)
203
+ }
204
+ if event[0]=="outline"
205
+ yield root, cur
206
+ end
207
+ when :end_element
208
+ cur = cur.parent if cur.kind_of? DOM::Element
209
+ when :text
210
+ when :cdata
211
+ when :start_doctype
212
+ when :end_doctype,:comment
213
+ when :end_document
214
+ break
215
+ else
216
+ p event.event_type
217
+ p event
218
+ raise "unknown event"
219
+ end
220
+ end # while
221
+ end # each_outline
222
+
223
+ def read_text
224
+ text = ""
225
+ while event = @p.pull
226
+ case event.event_type
227
+ when :end_element
228
+ break
229
+ when :text
230
+ text << OPML::unnormalize(event[0])
231
+ when :cdata
232
+ text << event[0]
233
+ else
234
+ raise
235
+ end
236
+ end
237
+ text
238
+ end
239
+ end # Parser
240
+ end # OPML
241
+
242
+ if __FILE__ == $0
243
+ parser = OPML::Parser.new(File.read('opml.xml'))
244
+ parser.each_outline {|opml, o|
245
+ puts "#{o.xmlUrl}"
246
+ }
247
+ end
data/vendor/.gitkeep ADDED
File without changes
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: automatic
3
+ version: !ruby/object:Gem::Version
4
+ version: 12.2.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - id774
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sqlite3
16
+ requirement: &78060030 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *78060030
25
+ - !ruby/object:Gem::Dependency
26
+ name: activesupport
27
+ requirement: &78059770 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *78059770
36
+ - !ruby/object:Gem::Dependency
37
+ name: hashie
38
+ requirement: &78059530 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *78059530
47
+ - !ruby/object:Gem::Dependency
48
+ name: activerecord
49
+ requirement: &78059250 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *78059250
58
+ - !ruby/object:Gem::Dependency
59
+ name: gcalapi
60
+ requirement: &78058990 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *78058990
69
+ - !ruby/object:Gem::Dependency
70
+ name: xml-simple
71
+ requirement: &78058690 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: *78058690
80
+ - !ruby/object:Gem::Dependency
81
+ name: cucumber
82
+ requirement: &78058350 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *78058350
91
+ - !ruby/object:Gem::Dependency
92
+ name: bundler
93
+ requirement: &78058040 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: 1.0.0
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *78058040
102
+ - !ruby/object:Gem::Dependency
103
+ name: jeweler
104
+ requirement: &78057560 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.8.3
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *78057560
113
+ description: Ruby General Automation Framework
114
+ email: idnanashi@gmail.com
115
+ executables:
116
+ - automatic
117
+ extensions: []
118
+ extra_rdoc_files:
119
+ - README.md
120
+ files:
121
+ - Gemfile
122
+ - README.md
123
+ - Rakefile
124
+ - VERSION
125
+ - app.rb
126
+ - automatic.gemspec
127
+ - bin/automatic
128
+ - config/default.yml
129
+ - config/feed2console.yml
130
+ - db/.gitkeep
131
+ - doc/COPYING
132
+ - doc/ChangeLog
133
+ - doc/PLUGINS.ja
134
+ - doc/README.ja
135
+ - lib/automatic.rb
136
+ - lib/automatic/environment.rb
137
+ - lib/automatic/feed_parser.rb
138
+ - lib/automatic/log.rb
139
+ - lib/automatic/pipeline.rb
140
+ - lib/automatic/recipe.rb
141
+ - lib/config/validator.rb
142
+ - plugins/custom_feed/svn_log.rb
143
+ - plugins/filter/ignore.rb
144
+ - plugins/filter/image.rb
145
+ - plugins/filter/tumblr_resize.rb
146
+ - plugins/notify/ikachan.rb
147
+ - plugins/publish/console.rb
148
+ - plugins/publish/google_calendar.rb
149
+ - plugins/publish/hatena_bookmark.rb
150
+ - plugins/store/full_text.rb
151
+ - plugins/store/permalink.rb
152
+ - plugins/store/store_database.rb
153
+ - plugins/store/target_link.rb
154
+ - plugins/subscription/feed.rb
155
+ - script/bootstrap
156
+ - spec/plugins/custom_feed/svn_log_spec.rb
157
+ - spec/plugins/filter/ignore_spec.rb
158
+ - spec/plugins/filter/image_spec.rb
159
+ - spec/plugins/filter/tumblr_resize_spec.rb
160
+ - spec/plugins/notify/ikachan_spec.rb
161
+ - spec/plugins/publish/console_spec.rb
162
+ - spec/plugins/publish/google_calendar_spec.rb
163
+ - spec/plugins/publish/hatena_bookmark_spec.rb
164
+ - spec/plugins/store/full_text_spec.rb
165
+ - spec/plugins/store/permalink_spec.rb
166
+ - spec/plugins/store/target_link_spec.rb
167
+ - spec/plugins/subscription/feed_spec.rb
168
+ - spec/spec_helper.rb
169
+ - test/integration/test_activerecord.yml
170
+ - test/integration/test_fulltext.yml
171
+ - test/integration/test_hatenabookmark.yml
172
+ - test/integration/test_ignore.yml
173
+ - test/integration/test_ignore2.yml
174
+ - test/integration/test_image2local.yml
175
+ - test/integration/test_svnlog.yml
176
+ - test/integration/test_tumblr2local.yml
177
+ - utils/auto_discovery.rb
178
+ - utils/opml_parser.rb
179
+ - vendor/.gitkeep
180
+ homepage: http://github.com/id774/automaticruby
181
+ licenses:
182
+ - GPL
183
+ post_install_message:
184
+ rdoc_options: []
185
+ require_paths:
186
+ - lib
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ none: false
189
+ requirements:
190
+ - - ! '>='
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ required_rubygems_version: !ruby/object:Gem::Requirement
194
+ none: false
195
+ requirements:
196
+ - - ! '>='
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ requirements: []
200
+ rubyforge_project:
201
+ rubygems_version: 1.8.17
202
+ signing_key:
203
+ specification_version: 3
204
+ summary: Automatic Ruby
205
+ test_files: []