yapra 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/LICENCE +22 -0
- data/License.txt +22 -0
- data/Manifest.txt +103 -0
- data/PostInstall.txt +7 -0
- data/README.txt +66 -0
- data/Rakefile +13 -0
- data/bin/yapra +52 -0
- data/config/hoe.rb +75 -0
- data/config/requirements.rb +15 -0
- data/legacy_plugins/Download/nicovideo.rb +45 -0
- data/legacy_plugins/Feed/custom_feed.rb +87 -0
- data/legacy_plugins/Feed/google_calendar.rb +51 -0
- data/legacy_plugins/Feed/google_search_history.rb +45 -0
- data/legacy_plugins/Feed/hatena_graph.rb +37 -0
- data/legacy_plugins/Feed/lirs.rb +36 -0
- data/legacy_plugins/Filter/Translations/yahoo.rb +40 -0
- data/legacy_plugins/Filter/apply_text_html.rb +26 -0
- data/legacy_plugins/Filter/average.rb +6 -0
- data/legacy_plugins/Filter/deduped.rb +51 -0
- data/legacy_plugins/Filter/find_num.rb +8 -0
- data/legacy_plugins/Filter/find_regex.rb +9 -0
- data/legacy_plugins/Filter/fresh.rb +9 -0
- data/legacy_plugins/Filter/get_html.rb +11 -0
- data/legacy_plugins/Filter/grep.rb +16 -0
- data/legacy_plugins/Filter/invert.rb +14 -0
- data/legacy_plugins/Filter/sort.rb +10 -0
- data/legacy_plugins/Filter/subs.rb +6 -0
- data/legacy_plugins/Filter/to_integer.rb +4 -0
- data/legacy_plugins/Publish/delicious.rb +91 -0
- data/legacy_plugins/Publish/google_calendar.rb +58 -0
- data/legacy_plugins/Publish/hatena_bookmark.rb +47 -0
- data/legacy_plugins/Publish/hatena_diary_writer.rb +53 -0
- data/legacy_plugins/Publish/hatena_graph.rb +39 -0
- data/legacy_plugins/Publish/lingr.rb +110 -0
- data/legacy_plugins/Publish/mixi_diary_writer.rb +104 -0
- data/legacy_plugins/Publish/scuttle.rb +92 -0
- data/legacy_plugins/Publish/twitter.rb +35 -0
- data/legacy_plugins/RSS/load.rb +38 -0
- data/legacy_plugins/RSS/save.rb +41 -0
- data/legacy_plugins/Yaml/load.rb +5 -0
- data/legacy_plugins/Yaml/save.rb +9 -0
- data/legacy_plugins/argv.rb +5 -0
- data/legacy_plugins/concat.rb +18 -0
- data/legacy_plugins/const_list.rb +15 -0
- data/legacy_plugins/first.rb +11 -0
- data/legacy_plugins/head.rb +14 -0
- data/legacy_plugins/load_path.rb +21 -0
- data/legacy_plugins/plagger.rb +94 -0
- data/legacy_plugins/plugin_from_uri.rb +31 -0
- data/legacy_plugins/pluginbase.rb +4 -0
- data/legacy_plugins/print.rb +15 -0
- data/legacy_plugins/reverse.rb +10 -0
- data/legacy_plugins/send_msg.rb +18 -0
- data/legacy_plugins/stdin.rb +6 -0
- data/legacy_plugins/stdout.rb +6 -0
- data/lib/yapra/config.rb +103 -0
- data/lib/yapra/inflector.rb +55 -0
- data/lib/yapra/legacy_plugin/advance_mode_registry.rb +38 -0
- data/lib/yapra/legacy_plugin/base.rb +26 -0
- data/lib/yapra/legacy_plugin/compatible_mode_registry.rb +34 -0
- data/lib/yapra/legacy_plugin/registry_factory.rb +21 -0
- data/lib/yapra/legacy_plugin.rb +5 -0
- data/lib/yapra/pipeline.rb +74 -0
- data/lib/yapra/plugin/base.rb +14 -0
- data/lib/yapra/plugin/context_aware.rb +14 -0
- data/lib/yapra/plugin/erb_applier.rb +15 -0
- data/lib/yapra/plugin/feed_item_operator.rb +21 -0
- data/lib/yapra/plugin/mechanize_base.rb +26 -0
- data/lib/yapra/plugin.rb +5 -0
- data/lib/yapra/runtime.rb +36 -0
- data/lib/yapra/version.rb +9 -0
- data/lib/yapra.rb +44 -0
- data/lib-plugins/yapra/plugin/config/agent.rb +34 -0
- data/lib-plugins/yapra/plugin/config/basic_auth.rb +19 -0
- data/lib-plugins/yapra/plugin/config/web_post.rb +21 -0
- data/lib-plugins/yapra/plugin/feed/custom.rb +41 -0
- data/lib-plugins/yapra/plugin/feed/load.rb +29 -0
- data/lib-plugins/yapra/plugin/filter/entry_full_text.rb +59 -0
- data/lib-plugins/yapra/plugin/publish/file_download.rb +109 -0
- data/lib-plugins/yapra/plugin/publish/gmail.rb +27 -0
- data/lib-plugins/yapra/plugin/publish/imap.rb +82 -0
- data/lib-plugins/yapra/plugin/test/append_entry.rb +25 -0
- data/plugins/Filter/deduped.rb +57 -0
- data/plugins/Filter/sort.rb +28 -0
- data/plugins/Filter/subs.rb +16 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/yapra_spec.rb +11 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +17 -0
- data/website/index.html +115 -0
- data/website/index.txt +57 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.html.erb +48 -0
- metadata +170 -0
data/History.txt
ADDED
data/LICENCE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2008 fraction.jp. Some rights reserved.
|
|
2
|
+
|
|
3
|
+
Original from 2008-06-12 http://pragger.ikejisoft.com/
|
|
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/License.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2008 fraction.jp. Some rights reserved.
|
|
2
|
+
|
|
3
|
+
Original from 2008-06-12 http://pragger.ikejisoft.com/
|
|
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/Manifest.txt
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
History.txt
|
|
2
|
+
LICENCE
|
|
3
|
+
License.txt
|
|
4
|
+
Manifest.txt
|
|
5
|
+
PostInstall.txt
|
|
6
|
+
README.txt
|
|
7
|
+
Rakefile
|
|
8
|
+
config/hoe.rb
|
|
9
|
+
config/requirements.rb
|
|
10
|
+
legacy_plugins/Download/nicovideo.rb
|
|
11
|
+
legacy_plugins/Feed/custom_feed.rb
|
|
12
|
+
legacy_plugins/Feed/google_calendar.rb
|
|
13
|
+
legacy_plugins/Feed/google_search_history.rb
|
|
14
|
+
legacy_plugins/Feed/hatena_graph.rb
|
|
15
|
+
legacy_plugins/Feed/lirs.rb
|
|
16
|
+
legacy_plugins/Filter/Translations/yahoo.rb
|
|
17
|
+
legacy_plugins/Filter/apply_text_html.rb
|
|
18
|
+
legacy_plugins/Filter/average.rb
|
|
19
|
+
legacy_plugins/Filter/deduped.rb
|
|
20
|
+
legacy_plugins/Filter/find_num.rb
|
|
21
|
+
legacy_plugins/Filter/find_regex.rb
|
|
22
|
+
legacy_plugins/Filter/fresh.rb
|
|
23
|
+
legacy_plugins/Filter/get_html.rb
|
|
24
|
+
legacy_plugins/Filter/grep.rb
|
|
25
|
+
legacy_plugins/Filter/invert.rb
|
|
26
|
+
legacy_plugins/Filter/sort.rb
|
|
27
|
+
legacy_plugins/Filter/subs.rb
|
|
28
|
+
legacy_plugins/Filter/to_integer.rb
|
|
29
|
+
legacy_plugins/Publish/delicious.rb
|
|
30
|
+
legacy_plugins/Publish/google_calendar.rb
|
|
31
|
+
legacy_plugins/Publish/hatena_bookmark.rb
|
|
32
|
+
legacy_plugins/Publish/hatena_diary_writer.rb
|
|
33
|
+
legacy_plugins/Publish/hatena_graph.rb
|
|
34
|
+
legacy_plugins/Publish/lingr.rb
|
|
35
|
+
legacy_plugins/Publish/mixi_diary_writer.rb
|
|
36
|
+
legacy_plugins/Publish/scuttle.rb
|
|
37
|
+
legacy_plugins/Publish/twitter.rb
|
|
38
|
+
legacy_plugins/RSS/load.rb
|
|
39
|
+
legacy_plugins/RSS/save.rb
|
|
40
|
+
legacy_plugins/Yaml/load.rb
|
|
41
|
+
legacy_plugins/Yaml/save.rb
|
|
42
|
+
legacy_plugins/argv.rb
|
|
43
|
+
legacy_plugins/concat.rb
|
|
44
|
+
legacy_plugins/const_list.rb
|
|
45
|
+
legacy_plugins/first.rb
|
|
46
|
+
legacy_plugins/head.rb
|
|
47
|
+
legacy_plugins/load_path.rb
|
|
48
|
+
legacy_plugins/plagger.rb
|
|
49
|
+
legacy_plugins/plugin_from_uri.rb
|
|
50
|
+
legacy_plugins/pluginbase.rb
|
|
51
|
+
legacy_plugins/print.rb
|
|
52
|
+
legacy_plugins/reverse.rb
|
|
53
|
+
legacy_plugins/send_msg.rb
|
|
54
|
+
legacy_plugins/stdin.rb
|
|
55
|
+
legacy_plugins/stdout.rb
|
|
56
|
+
lib-plugins/yapra/plugin/config/agent.rb
|
|
57
|
+
lib-plugins/yapra/plugin/config/basic_auth.rb
|
|
58
|
+
lib-plugins/yapra/plugin/config/web_post.rb
|
|
59
|
+
lib-plugins/yapra/plugin/feed/custom.rb
|
|
60
|
+
lib-plugins/yapra/plugin/feed/load.rb
|
|
61
|
+
lib-plugins/yapra/plugin/filter/entry_full_text.rb
|
|
62
|
+
lib-plugins/yapra/plugin/publish/file_download.rb
|
|
63
|
+
lib-plugins/yapra/plugin/publish/gmail.rb
|
|
64
|
+
lib-plugins/yapra/plugin/publish/imap.rb
|
|
65
|
+
lib-plugins/yapra/plugin/test/append_entry.rb
|
|
66
|
+
lib/yapra.rb
|
|
67
|
+
lib/yapra/config.rb
|
|
68
|
+
lib/yapra/inflector.rb
|
|
69
|
+
lib/yapra/legacy_plugin.rb
|
|
70
|
+
lib/yapra/legacy_plugin/advance_mode_registry.rb
|
|
71
|
+
lib/yapra/legacy_plugin/base.rb
|
|
72
|
+
lib/yapra/legacy_plugin/compatible_mode_registry.rb
|
|
73
|
+
lib/yapra/legacy_plugin/registry_factory.rb
|
|
74
|
+
lib/yapra/pipeline.rb
|
|
75
|
+
lib/yapra/plugin.rb
|
|
76
|
+
lib/yapra/plugin/base.rb
|
|
77
|
+
lib/yapra/plugin/context_aware.rb
|
|
78
|
+
lib/yapra/plugin/erb_applier.rb
|
|
79
|
+
lib/yapra/plugin/feed_item_operator.rb
|
|
80
|
+
lib/yapra/plugin/mechanize_base.rb
|
|
81
|
+
lib/yapra/runtime.rb
|
|
82
|
+
lib/yapra/version.rb
|
|
83
|
+
plugins/Filter/deduped.rb
|
|
84
|
+
plugins/Filter/sort.rb
|
|
85
|
+
plugins/Filter/subs.rb
|
|
86
|
+
bin/yapra
|
|
87
|
+
script/console
|
|
88
|
+
script/destroy
|
|
89
|
+
script/generate
|
|
90
|
+
script/txt2html
|
|
91
|
+
setup.rb
|
|
92
|
+
spec/spec.opts
|
|
93
|
+
spec/spec_helper.rb
|
|
94
|
+
spec/yapra_spec.rb
|
|
95
|
+
tasks/deployment.rake
|
|
96
|
+
tasks/environment.rake
|
|
97
|
+
tasks/rspec.rake
|
|
98
|
+
tasks/website.rake
|
|
99
|
+
website/index.html
|
|
100
|
+
website/index.txt
|
|
101
|
+
website/javascripts/rounded_corners_lite.inc.js
|
|
102
|
+
website/stylesheets/screen.css
|
|
103
|
+
website/template.html.erb
|
data/PostInstall.txt
ADDED
data/README.txt
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
= yapra
|
|
2
|
+
|
|
3
|
+
* http://www.fraction.jp/trac/rana2/wiki/Yapra
|
|
4
|
+
|
|
5
|
+
== DESCRIPTION:
|
|
6
|
+
|
|
7
|
+
Yet Another Pragger(http://pragger.ikejisoft.com/) implementation.
|
|
8
|
+
|
|
9
|
+
== FEATURES/PROBLEMS:
|
|
10
|
+
|
|
11
|
+
* 99% compatible of Pragger.
|
|
12
|
+
* Class-based plugin support.
|
|
13
|
+
* Loadpass based plugin loading strategy. (also support pragger's plugin in advance mode.)
|
|
14
|
+
* Support Python habu like config file.
|
|
15
|
+
|
|
16
|
+
== SYNOPSIS:
|
|
17
|
+
|
|
18
|
+
=== Use at command
|
|
19
|
+
|
|
20
|
+
$ yapra -c config_file.yml
|
|
21
|
+
|
|
22
|
+
=== Use in your application
|
|
23
|
+
|
|
24
|
+
require 'yapra/runtime'
|
|
25
|
+
require 'yapra/config'
|
|
26
|
+
|
|
27
|
+
config = YAML.load(config_file)
|
|
28
|
+
config = Yapra::Config.new(config)
|
|
29
|
+
|
|
30
|
+
Yapra::Runtime.logger = Logger.new(STDOUT)
|
|
31
|
+
|
|
32
|
+
yapra = Yapra::Runtime.new(config.env)
|
|
33
|
+
yapra.execute(config.pipeline_commands)
|
|
34
|
+
|
|
35
|
+
== REQUIREMENTS:
|
|
36
|
+
|
|
37
|
+
* mechanize (>= 0.7.6)
|
|
38
|
+
|
|
39
|
+
== INSTALL:
|
|
40
|
+
|
|
41
|
+
* sudo gem install yapra
|
|
42
|
+
|
|
43
|
+
== LICENSE:
|
|
44
|
+
|
|
45
|
+
(The MIT License)
|
|
46
|
+
|
|
47
|
+
Copyright (c) 2008 Yuanying Ohtsuka
|
|
48
|
+
|
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
50
|
+
a copy of this software and associated documentation files (the
|
|
51
|
+
'Software'), to deal in the Software without restriction, including
|
|
52
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
53
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
54
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
55
|
+
the following conditions:
|
|
56
|
+
|
|
57
|
+
The above copyright notice and this permission notice shall be
|
|
58
|
+
included in all copies or substantial portions of the Software.
|
|
59
|
+
|
|
60
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
61
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
62
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
63
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
64
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
65
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
66
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'config/requirements'
|
|
2
|
+
require 'config/hoe' # setup Hoe + all gem configuration
|
|
3
|
+
|
|
4
|
+
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
|
5
|
+
|
|
6
|
+
##############################################################################
|
|
7
|
+
# SVN
|
|
8
|
+
##############################################################################
|
|
9
|
+
|
|
10
|
+
desc "Add new files to subversion"
|
|
11
|
+
task :svn_add do
|
|
12
|
+
system "svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add"
|
|
13
|
+
end
|
data/bin/yapra
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env ruby -wKU
|
|
2
|
+
$KCODE='u'
|
|
3
|
+
require 'yaml'
|
|
4
|
+
require 'optparse'
|
|
5
|
+
require 'kconv'
|
|
6
|
+
require 'pathname'
|
|
7
|
+
require 'base64'
|
|
8
|
+
|
|
9
|
+
YAPRA_ROOT = File.join(File.dirname(__FILE__), '..')
|
|
10
|
+
|
|
11
|
+
$:.insert(0, *[
|
|
12
|
+
File.join(YAPRA_ROOT, 'lib-plugins'),
|
|
13
|
+
File.join(YAPRA_ROOT, 'lib')
|
|
14
|
+
])
|
|
15
|
+
|
|
16
|
+
legacy_plugin_directory_paths = [
|
|
17
|
+
Pathname.new(YAPRA_ROOT) + 'legacy_plugins',
|
|
18
|
+
Pathname.new(YAPRA_ROOT) + 'plugins'
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
require 'yapra/runtime'
|
|
22
|
+
require 'yapra/config'
|
|
23
|
+
require 'yapra/legacy_plugin/registry_factory'
|
|
24
|
+
|
|
25
|
+
Version = '0.1.0'
|
|
26
|
+
mode = 'compatible'
|
|
27
|
+
config_file = "config.yaml"
|
|
28
|
+
loglebel = nil
|
|
29
|
+
opt = OptionParser.new
|
|
30
|
+
opt.on("-c", "--configfile CONFIGFILE") {|v| config_file = v }
|
|
31
|
+
opt.on("-p", "--plugindir PLUGINDIR") {|v| legacy_plugin_directory_paths << Pathname.new(v) }
|
|
32
|
+
opt.on("-m", "--mode MODE", 'compatible / advance') { |v| mode = v }
|
|
33
|
+
opt.on("--log-level LOGLEVEL", 'fatal / error / warn / info / debug') { |v| loglebel = v }
|
|
34
|
+
# opt.on("-u", "--pluginusage PLUGINNAME") {|v| $plugins[v].source.gsub(/^## ?(.*)/){ puts $1 }; exit }
|
|
35
|
+
# opt.on("-l", "--listplugin") { $plugins.keys.sort.each{|k| puts k }; exit }
|
|
36
|
+
# opt.on("-w", "--where") { puts(Pathname.new(__FILE__).parent + "plugin"); exit }
|
|
37
|
+
opt.parse!
|
|
38
|
+
|
|
39
|
+
legacy_plugin_registry_factory = Yapra::LegacyPlugin::RegistryFactory.new(legacy_plugin_directory_paths, mode)
|
|
40
|
+
config = YAML.load(File.read(config_file).toutf8.gsub(/base64::([\w+\/]+=*)/){ Base64.decode64($1) })
|
|
41
|
+
config = Yapra::Config.new(config)
|
|
42
|
+
config.env.update({
|
|
43
|
+
'log' => {
|
|
44
|
+
'level' => loglebel
|
|
45
|
+
}
|
|
46
|
+
}) if loglebel
|
|
47
|
+
Yapra::Runtime.logger = config.create_logger
|
|
48
|
+
yapra = Yapra::Runtime.new(
|
|
49
|
+
config.env,
|
|
50
|
+
legacy_plugin_registry_factory
|
|
51
|
+
)
|
|
52
|
+
yapra.execute(config.pipeline_commands)
|
data/config/hoe.rb
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
require 'yapra/version'
|
|
2
|
+
|
|
3
|
+
AUTHOR = 'Yuanying' # can also be an array of Authors
|
|
4
|
+
EMAIL = "yuanying at fraction dot jp"
|
|
5
|
+
DESCRIPTION = "Yet another pragger implementation."
|
|
6
|
+
GEM_NAME = 'yapra' # what ppl will type to install your gem
|
|
7
|
+
RUBYFORGE_PROJECT = 'yapra' # The unix name for your project
|
|
8
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
|
9
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
|
10
|
+
EXTRA_DEPENDENCIES = [
|
|
11
|
+
['mechanize', '>= 0.7.6']
|
|
12
|
+
] # An array of rubygem dependencies [name, version]
|
|
13
|
+
|
|
14
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
|
15
|
+
@config = nil
|
|
16
|
+
RUBYFORGE_USERNAME = "unknown"
|
|
17
|
+
def rubyforge_username
|
|
18
|
+
unless @config
|
|
19
|
+
begin
|
|
20
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
|
21
|
+
rescue
|
|
22
|
+
puts <<-EOS
|
|
23
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
|
24
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
|
25
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
|
26
|
+
EOS
|
|
27
|
+
exit
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
REV = nil
|
|
35
|
+
# UNCOMMENT IF REQUIRED:
|
|
36
|
+
# REV = YAML.load(`svn info`)['Revision']
|
|
37
|
+
VERS = Yapra::VERSION::STRING + (REV ? ".#{REV}" : "")
|
|
38
|
+
RDOC_OPTS = ['--quiet', '--title', 'yapra documentation',
|
|
39
|
+
"--opname", "index.html",
|
|
40
|
+
"--line-numbers",
|
|
41
|
+
"--main", "README",
|
|
42
|
+
"--inline-source"]
|
|
43
|
+
|
|
44
|
+
class Hoe
|
|
45
|
+
def extra_deps
|
|
46
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
|
47
|
+
@extra_deps
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Generate all the Rake tasks
|
|
52
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
|
53
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
54
|
+
p.developer(AUTHOR, EMAIL)
|
|
55
|
+
p.description = DESCRIPTION
|
|
56
|
+
p.summary = DESCRIPTION
|
|
57
|
+
p.url = HOMEPATH
|
|
58
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
|
59
|
+
p.test_globs = ["test/**/test_*.rb"]
|
|
60
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
|
61
|
+
|
|
62
|
+
# == Optional
|
|
63
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
|
64
|
+
#p.extra_deps = EXTRA_DEPENDENCIES
|
|
65
|
+
|
|
66
|
+
p.spec_extras = {
|
|
67
|
+
'require_paths' => ['lib', 'lib-plugins']
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
|
72
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
|
73
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
|
74
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
|
75
|
+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
include FileUtils
|
|
3
|
+
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
%w[rake hoe newgem rubigen].each do |req_gem|
|
|
6
|
+
begin
|
|
7
|
+
require req_gem
|
|
8
|
+
rescue LoadError
|
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
|
11
|
+
exit
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## Download Nicovideo FLV -- IKeJI
|
|
2
|
+
##
|
|
3
|
+
## Download from Nicovideo to file
|
|
4
|
+
##
|
|
5
|
+
## - module: Download::nicovideo
|
|
6
|
+
## config:
|
|
7
|
+
## authfile: nicovideo_auth.yaml
|
|
8
|
+
## dir: ./nicovideo
|
|
9
|
+
|
|
10
|
+
require 'rubygems'
|
|
11
|
+
require 'mechanize'
|
|
12
|
+
require 'cgi'
|
|
13
|
+
|
|
14
|
+
def nicovideo(config,data)
|
|
15
|
+
auth = YAML.load( File.read( config['authfile'] ) )
|
|
16
|
+
agent = WWW::Mechanize.new
|
|
17
|
+
|
|
18
|
+
page = agent.post("https://secure.nicovideo.jp/secure/login?site=niconico",
|
|
19
|
+
{"mail"=>auth["mail"],"password"=>auth["password"]})
|
|
20
|
+
sleep 3
|
|
21
|
+
data.each do|dat|
|
|
22
|
+
link = dat.link
|
|
23
|
+
next unless link =~ /www\.nicovideo\.jp\/watch\/(.*)/
|
|
24
|
+
id = $1
|
|
25
|
+
next if File.exist?("#{config['dir']}/#{id}.flv")
|
|
26
|
+
begin
|
|
27
|
+
page = agent.get("http://www.nicovideo.jp/api/getflv?v=#{id}")
|
|
28
|
+
sleep 3
|
|
29
|
+
list = CGI.parse(page.body)
|
|
30
|
+
flv = agent.get(link)
|
|
31
|
+
sleep 3
|
|
32
|
+
flv = agent.get(list['url'])
|
|
33
|
+
sleep 3
|
|
34
|
+
File.open("#{config['dir']}/#{id}.flv","w")do |w|
|
|
35
|
+
w.write flv.body
|
|
36
|
+
end
|
|
37
|
+
File.open("#{config['dir']}/list.html","a")do |w|
|
|
38
|
+
w.puts "<h3><a href='#{id}.flv'>#{dat.title}</a></h3><p><a href='#{dat.link}'>#{dat.description}</a>"
|
|
39
|
+
end
|
|
40
|
+
rescue
|
|
41
|
+
STDERR.puts "an error occurred in downloadng FLV #{id}"
|
|
42
|
+
end
|
|
43
|
+
sleep 3
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
## Read data and convert to feed -- IKeJI
|
|
2
|
+
##
|
|
3
|
+
## Read data and convert to feed.
|
|
4
|
+
##
|
|
5
|
+
## Example
|
|
6
|
+
## - module: Feed::custom_feed
|
|
7
|
+
## config:
|
|
8
|
+
## url: addr of data -- optional
|
|
9
|
+
## capture: regex for content -- optional
|
|
10
|
+
## split: regex for item
|
|
11
|
+
## title: regex for title
|
|
12
|
+
## date: regex for date
|
|
13
|
+
## link: regex for link
|
|
14
|
+
##
|
|
15
|
+
|
|
16
|
+
require 'open-uri'
|
|
17
|
+
require 'kconv'
|
|
18
|
+
|
|
19
|
+
def custom_feed(config,data)
|
|
20
|
+
open(config['url']){|r| data = [r.read.toutf8] } if(config['url'])
|
|
21
|
+
items = []
|
|
22
|
+
data.each do |input|
|
|
23
|
+
body = ""
|
|
24
|
+
if(config['capture'])
|
|
25
|
+
if input =~ Regexp.new(config['capture'],Regexp::MULTILINE)
|
|
26
|
+
body = $1
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
body = input
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
if(config['split'])
|
|
33
|
+
body.gsub(Regexp.new(config['split'],Regexp::MULTILINE)) do
|
|
34
|
+
items.push $1
|
|
35
|
+
end
|
|
36
|
+
else
|
|
37
|
+
items.push body
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
if(config['title'])
|
|
42
|
+
title = Regexp.new(config['title'])
|
|
43
|
+
items.each do|i|
|
|
44
|
+
if i =~ title
|
|
45
|
+
mytitle = $1
|
|
46
|
+
i.instance_eval do
|
|
47
|
+
@title = mytitle
|
|
48
|
+
def title
|
|
49
|
+
@title
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
if(config['date'])
|
|
57
|
+
date = Regexp.new(config['date'])
|
|
58
|
+
items.each do|i|
|
|
59
|
+
if i =~ date
|
|
60
|
+
mydate = Time.parse($1)
|
|
61
|
+
i.instance_eval do
|
|
62
|
+
@date = mydate
|
|
63
|
+
def date
|
|
64
|
+
@date
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if config['link']
|
|
72
|
+
link = Regexp.new(config['link'])
|
|
73
|
+
items.each do|i|
|
|
74
|
+
if i =~ link
|
|
75
|
+
mylink = config['url'] ? (config['url'] + '#' + $1) : $1
|
|
76
|
+
i.instance_eval do
|
|
77
|
+
@link = mylink
|
|
78
|
+
def link
|
|
79
|
+
@link
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
return items
|
|
87
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
## Read Google Calendar Events -- Soutaro Matsumoto
|
|
2
|
+
##
|
|
3
|
+
## Read Events from calendars.
|
|
4
|
+
## The output will be an array of GooleCalendar::Event.
|
|
5
|
+
##
|
|
6
|
+
## - module: feed::google_calendar
|
|
7
|
+
## config:
|
|
8
|
+
## mail: your gmail address
|
|
9
|
+
## pass: your password
|
|
10
|
+
## calendars:
|
|
11
|
+
## - the names of
|
|
12
|
+
## - your calendars
|
|
13
|
+
## max: 200
|
|
14
|
+
|
|
15
|
+
begin
|
|
16
|
+
require 'rubygems'
|
|
17
|
+
rescue LoadError
|
|
18
|
+
end
|
|
19
|
+
require 'gcalapi'
|
|
20
|
+
require 'date'
|
|
21
|
+
|
|
22
|
+
def google_calendar(config, data)
|
|
23
|
+
today = Date.today
|
|
24
|
+
|
|
25
|
+
pass = config['pass']
|
|
26
|
+
mail = config['mail']
|
|
27
|
+
calendar_pattern = Regexp.union(*config['calendars'].map{|ptn| /#{ptn}/})
|
|
28
|
+
max = config['max'] || 200
|
|
29
|
+
|
|
30
|
+
start_day = today - 30
|
|
31
|
+
end_day = today + 31
|
|
32
|
+
|
|
33
|
+
start_time = Time.mktime(start_day.year, start_day.month, start_day.day)
|
|
34
|
+
end_time = Time.mktime(end_day.year, end_day.month, end_day.day)
|
|
35
|
+
|
|
36
|
+
srv = GoogleCalendar::Service.new(mail, pass)
|
|
37
|
+
cal_list = GoogleCalendar::Calendar.calendars(srv)
|
|
38
|
+
|
|
39
|
+
cal_list.values.select {|cal|
|
|
40
|
+
calendar_pattern =~ cal.title
|
|
41
|
+
}.each {|cal|
|
|
42
|
+
cal.events(:'max-results'=>max,
|
|
43
|
+
:'start-min'=>start_time,
|
|
44
|
+
:'start-max'=>end_time).each {|ev|
|
|
45
|
+
data << ev if ev.st && ev.en && start_time <= ev.st && ev.en <= end_time
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
data
|
|
50
|
+
end
|
|
51
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## get Google search history -- IKeJI
|
|
2
|
+
##
|
|
3
|
+
## for example you can get your search keyword 'harahetta'
|
|
4
|
+
##
|
|
5
|
+
## -module: Feed::google_search_history
|
|
6
|
+
## config:
|
|
7
|
+
## user: hoge
|
|
8
|
+
## pass: fuga
|
|
9
|
+
##
|
|
10
|
+
|
|
11
|
+
require 'net/https'
|
|
12
|
+
require 'rss/1.0'
|
|
13
|
+
require 'rss/2.0'
|
|
14
|
+
require 'rss/maker'
|
|
15
|
+
|
|
16
|
+
def google_search_history(config,data)
|
|
17
|
+
Net::HTTP.version_1_2
|
|
18
|
+
req = Net::HTTP::Get.new('/searchhistory/?output=rss')
|
|
19
|
+
req["Accept-Language"] = "ja"
|
|
20
|
+
req["Accept-Charset"] = "utf-8"
|
|
21
|
+
req.basic_auth config['user'],config['pass']
|
|
22
|
+
ht = Net::HTTP.new("www.google.com",443)
|
|
23
|
+
ht.use_ssl = true
|
|
24
|
+
ht.start do |http|
|
|
25
|
+
while(true)
|
|
26
|
+
response = http.request(req)
|
|
27
|
+
if(response.kind_of? Net::HTTPRedirection )
|
|
28
|
+
req = Net::HTTP::Get.new(response['location'])
|
|
29
|
+
req["Accept-Language"] = "ja"
|
|
30
|
+
req["Accept-Charset"] = "utf-8"
|
|
31
|
+
req.basic_auth config['user'],config['pass']
|
|
32
|
+
else
|
|
33
|
+
break
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
rss = nil
|
|
37
|
+
begin
|
|
38
|
+
rss = RSS::Parser.parse(response.body)
|
|
39
|
+
rescue RSS::InvalidRSSError
|
|
40
|
+
rss = RSS::Parser.parse(response.body, false)
|
|
41
|
+
end
|
|
42
|
+
return rss.items rescue []
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
## Get Hatena Graph data
|
|
2
|
+
##
|
|
3
|
+
## hatenaapigraph 0.2.2 is required.
|
|
4
|
+
##
|
|
5
|
+
## - module: Feed::hatena_graph
|
|
6
|
+
## config:
|
|
7
|
+
## user_id: your-hatena-user-id
|
|
8
|
+
## password: your-password
|
|
9
|
+
## graph_name: the-name-of-graph
|
|
10
|
+
## proxy_host: proxy-host-name (optional)
|
|
11
|
+
## proxy_port: proxy-port (optional)
|
|
12
|
+
## proxy_user: proxy-user (optional)
|
|
13
|
+
## proxy_pass: proxy-password (optional)
|
|
14
|
+
|
|
15
|
+
begin
|
|
16
|
+
require 'rubygems'
|
|
17
|
+
gem 'hatenaapigraph', '>=0.2.2'
|
|
18
|
+
rescue Exception
|
|
19
|
+
end
|
|
20
|
+
require 'hatena/api/graph'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
GraphData = Struct.new(:date, :value)
|
|
24
|
+
|
|
25
|
+
def hatena_graph(config, data)
|
|
26
|
+
graph = Hatena::API::Graph.new(config['user_id'], config['password'])
|
|
27
|
+
if config['proxy_host']
|
|
28
|
+
proxy_host = config['proxy_host']
|
|
29
|
+
proxy_port = config['proxy_port']
|
|
30
|
+
proxy_user = config['proxy_user']
|
|
31
|
+
proxy_pass = config['proxy_pass']
|
|
32
|
+
graph.proxy = ::Net::HTTP.Proxy(proxy_host, proxy_port, proxy_user, proxy_pass)
|
|
33
|
+
end
|
|
34
|
+
graph_data = graph.get_data(config['graph_name'])
|
|
35
|
+
graph_data.map{|k,v| GraphData.new(k, v)}.sort{|a,b| a.date<=>b.date}
|
|
36
|
+
end
|
|
37
|
+
|