yapra 0.1.3 → 0.2.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/legacy_plugins/Download/nicovideo.rb +1 -1
- data/legacy_plugins/Filter/Translations/yahoo.rb +7 -7
- data/legacy_plugins/Publish/delicious.rb +1 -1
- data/legacy_plugins/Publish/hatena_diary_writer.rb +1 -1
- data/legacy_plugins/Publish/mixi_diary_writer.rb +1 -1
- data/legacy_plugins/Publish/scuttle.rb +1 -1
- data/legacy_plugins/plagger.rb +2 -2
- data/lib/yapra/legacy_plugin/base.rb +1 -1
- data/lib/yapra/plugin/mechanize_base.rb +1 -1
- data/lib/yapra/version.rb +2 -2
- data/lib-plugins/yapra/plugin/publish/mail.rb +3 -2
- metadata +27 -9
@@ -13,7 +13,7 @@ require 'cgi'
|
|
13
13
|
|
14
14
|
def nicovideo(config,data)
|
15
15
|
auth = YAML.load( File.read( config['authfile'] ) )
|
16
|
-
agent = WWW::Mechanize.new
|
16
|
+
agent = defined?(Mechanize) ? Mechanize.new : WWW::Mechanize.new
|
17
17
|
|
18
18
|
page = agent.post("https://secure.nicovideo.jp/secure/login?site=niconico",
|
19
19
|
{"mail"=>auth["mail"],"password"=>auth["password"]})
|
@@ -11,19 +11,19 @@ def yahoo(config, data)
|
|
11
11
|
config = (config || { "translation" => "en=>ja" })
|
12
12
|
|
13
13
|
trans = case config["translation"]
|
14
|
-
when "en=>ja"
|
15
|
-
when "kr=>ja"
|
16
|
-
when "cn=>ja"
|
17
|
-
when "ja=>en"
|
18
|
-
when "ja=>kr"
|
19
|
-
when "ja=>cn"
|
14
|
+
when "en=>ja" then "EJ"
|
15
|
+
when "kr=>ja" then "KJ"
|
16
|
+
when "cn=>ja" then "CJ"
|
17
|
+
when "ja=>en" then "JE"
|
18
|
+
when "ja=>kr" then "JK"
|
19
|
+
when "ja=>cn" then "JC"
|
20
20
|
else
|
21
21
|
return data
|
22
22
|
end
|
23
23
|
|
24
24
|
data.collect {|d|
|
25
25
|
if d && d =~ /\S/
|
26
|
-
agent = WWW::Mechanize.new
|
26
|
+
agent = defined?(Mechanize) ? Mechanize.new : WWW::Mechanize.new
|
27
27
|
start = agent.get("http://honyaku.yahoo.co.jp/")
|
28
28
|
form = start.forms.last
|
29
29
|
|
@@ -16,7 +16,7 @@ class Delicious
|
|
16
16
|
def initialize username, password, proxy=nil
|
17
17
|
@username = username
|
18
18
|
@password = password
|
19
|
-
@agent = WWW::Mechanize.new
|
19
|
+
@agent = defined?(Mechanize) ? Mechanize.new : WWW::Mechanize.new
|
20
20
|
@agent.basic_auth(@username, @password)
|
21
21
|
if proxy && proxy.is_a?(Hash) && proxy['proxy_addr'] && proxy['proxy_port']
|
22
22
|
@agent.set_proxy(proxy['proxy_addr'], proxy['proxy_port'],
|
@@ -13,7 +13,7 @@ class HatenaDiaryWriter
|
|
13
13
|
def initialize(id,password)
|
14
14
|
@id = id
|
15
15
|
@password = password
|
16
|
-
@agent = WWW::Mechanize.new
|
16
|
+
@agent = defined?(Mechanize) ? Mechanize.new : WWW::Mechanize.new
|
17
17
|
if proxy = ENV['HTTP_PROXY']
|
18
18
|
proxy = URI.parse(proxy)
|
19
19
|
@agent.set_proxy(proxy.host, proxy.port)
|
@@ -19,7 +19,7 @@ class Scuttle
|
|
19
19
|
@post_url = url + 'api/posts/add?'
|
20
20
|
@username = username
|
21
21
|
@password = password
|
22
|
-
@agent = WWW::Mechanize.new
|
22
|
+
@agent = defined?(Mechanize) ? Mechanize.new : WWW::Mechanize.new
|
23
23
|
@agent.basic_auth(@username, @password)
|
24
24
|
if proxy && proxy.is_a?(Hash) && proxy['proxy_addr'] && proxy['proxy_port']
|
25
25
|
@agent.set_proxy(proxy['proxy_addr'], proxy['proxy_port'],
|
data/legacy_plugins/plagger.rb
CHANGED
@@ -10,7 +10,7 @@ class Yapra::LegacyPlugin::Base
|
|
10
10
|
def initialize(pipeline, plugin_path)
|
11
11
|
@_yapra_pipeline = pipeline
|
12
12
|
@_yapra_run_method = File.basename(plugin_path, '.*')
|
13
|
-
instance_eval( @source = File.read(plugin_path).toutf8, plugin_path, 1)
|
13
|
+
instance_eval( @source = File.read(plugin_path).toutf8, plugin_path.to_s, 1)
|
14
14
|
end
|
15
15
|
|
16
16
|
def logger
|
@@ -4,7 +4,7 @@ require 'yapra/plugin/base'
|
|
4
4
|
|
5
5
|
class Yapra::Plugin::MechanizeBase < Yapra::Plugin::Base
|
6
6
|
def agent
|
7
|
-
pipeline.context['mechanize_agent'] ||= WWW::Mechanize.new
|
7
|
+
pipeline.context['mechanize_agent'] ||= (defined?(Mechanize) ? Mechanize.new : WWW::Mechanize.new)
|
8
8
|
pipeline.context['mechanize_agent']
|
9
9
|
end
|
10
10
|
|
data/lib/yapra/version.rb
CHANGED
@@ -61,15 +61,16 @@ module Yapra::Plugin::Publish
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def create_attachments item, config
|
64
|
+
mechanize_file_type = defined?(Mechanize) ? Mechanize::File : WWW::Mechanize::File
|
64
65
|
attachments = []
|
65
66
|
attachment_attributes = config['mail']['attachments']
|
66
67
|
if attachment_attributes.kind_of?(String)
|
67
68
|
file = item.__send__(attachment_attributes)
|
68
|
-
attachments << file if file.kind_of?(
|
69
|
+
attachments << file if file.kind_of?(mechanize_file_type)
|
69
70
|
elsif attachment_attributes.kind_of?(Array)
|
70
71
|
attachment_attributes.each do |atc|
|
71
72
|
file = item.__send__(atc)
|
72
|
-
attachments << file if file.kind_of?(
|
73
|
+
attachments << file if file.kind_of?(mechanize_file_type)
|
73
74
|
end
|
74
75
|
end
|
75
76
|
attachments
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yapra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- yuanying
|
@@ -9,19 +15,25 @@ autorequire: ""
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2011-02-09 00:00:00 +09:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: mechanize
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 7
|
33
|
+
- 6
|
23
34
|
version: 0.7.6
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
description: Yet another pragger implementation.
|
26
38
|
email: yuanying at fraction dot jp
|
27
39
|
executables:
|
@@ -169,21 +181,27 @@ require_paths:
|
|
169
181
|
- lib
|
170
182
|
- lib-plugins
|
171
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
none: false
|
172
185
|
requirements:
|
173
186
|
- - ">="
|
174
187
|
- !ruby/object:Gem::Version
|
188
|
+
hash: 3
|
189
|
+
segments:
|
190
|
+
- 0
|
175
191
|
version: "0"
|
176
|
-
version:
|
177
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
178
194
|
requirements:
|
179
195
|
- - ">="
|
180
196
|
- !ruby/object:Gem::Version
|
197
|
+
hash: 3
|
198
|
+
segments:
|
199
|
+
- 0
|
181
200
|
version: "0"
|
182
|
-
version:
|
183
201
|
requirements: []
|
184
202
|
|
185
203
|
rubyforge_project: yapra
|
186
|
-
rubygems_version: 1.3.
|
204
|
+
rubygems_version: 1.3.7
|
187
205
|
signing_key:
|
188
206
|
specification_version: 3
|
189
207
|
summary: Yet another pragger implementation.
|