my-lib 0.0.1.6 → 0.0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/TAGS +26 -26
- data/VERSION +1 -1
- data/lib/lib/job.rb +85 -73
- data/lib/lib/machine.rb +40 -68
- data/my-lib.gemspec +2 -2
- data/spec/my-lib_spec.rb +46 -5
- metadata +23 -23
data/TAGS
CHANGED
@@ -10,19 +10,19 @@ class MyJobAnisokuMyJobAnisoku18,554
|
|
10
10
|
def tokkakaritokkakari40,1167
|
11
11
|
def secondsecond61,1648
|
12
12
|
def kobetukobetu83,2229
|
13
|
-
def thirdthird117,
|
14
|
-
def fc2fc2
|
15
|
-
def videovideo
|
16
|
-
def runrun
|
17
|
-
class MyJobDojinMyJobDojin
|
18
|
-
def initialize(args = { })initialize
|
19
|
-
def runrun
|
20
|
-
def do_connectdo_connect
|
21
|
-
def save_content(content)save_content
|
22
|
-
def checkdircheckdir
|
23
|
-
def file_already_saved?file_already_saved?
|
24
|
-
class MyJobDojinEventMachine < MyJobDojinMyJobDojinEventMachine
|
25
|
-
def do_connectdo_connect
|
13
|
+
def thirdthird117,3588
|
14
|
+
def fc2fc2153,4589
|
15
|
+
def videovideo169,5061
|
16
|
+
def runrun197,5956
|
17
|
+
class MyJobDojinMyJobDojin219,6268
|
18
|
+
def initialize(args = { })initialize221,6286
|
19
|
+
def runrun244,7027
|
20
|
+
def do_connectdo_connect250,7072
|
21
|
+
def save_content(content)save_content279,7851
|
22
|
+
def checkdircheckdir287,8046
|
23
|
+
def file_already_saved?file_already_saved?295,8162
|
24
|
+
class MyJobDojinEventMachine < MyJobDojinMyJobDojinEventMachine303,8295
|
25
|
+
def do_connectdo_connect307,8353
|
26
26
|
|
27
27
|
,1352
|
28
28
|
module MyMachineMyMachine7,106
|
@@ -125,19 +125,19 @@ class MyJobAnisokuMyJobAnisoku18,554
|
|
125
125
|
def tokkakaritokkakari40,1167
|
126
126
|
def secondsecond61,1648
|
127
127
|
def kobetukobetu83,2229
|
128
|
-
def thirdthird117,
|
129
|
-
def fc2fc2
|
130
|
-
def videovideo
|
131
|
-
def runrun
|
132
|
-
class MyJobDojinMyJobDojin
|
133
|
-
def initialize(args = { })initialize
|
134
|
-
def runrun
|
135
|
-
def do_connectdo_connect
|
136
|
-
def save_content(content)save_content
|
137
|
-
def checkdircheckdir
|
138
|
-
def file_already_saved?file_already_saved?
|
139
|
-
class MyJobDojinEventMachine < MyJobDojinMyJobDojinEventMachine
|
140
|
-
def do_connectdo_connect
|
128
|
+
def thirdthird117,3588
|
129
|
+
def fc2fc2153,4589
|
130
|
+
def videovideo169,5061
|
131
|
+
def runrun197,5956
|
132
|
+
class MyJobDojinMyJobDojin219,6268
|
133
|
+
def initialize(args = { })initialize221,6286
|
134
|
+
def runrun244,7027
|
135
|
+
def do_connectdo_connect250,7072
|
136
|
+
def save_content(content)save_content279,7851
|
137
|
+
def checkdircheckdir287,8046
|
138
|
+
def file_already_saved?file_already_saved?295,8162
|
139
|
+
class MyJobDojinEventMachine < MyJobDojinMyJobDojinEventMachine303,8295
|
140
|
+
def do_connectdo_connect307,8353
|
141
141
|
|
142
142
|
,1352
|
143
143
|
module MyMachineMyMachine7,106
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.1.
|
1
|
+
0.0.1.7
|
data/lib/lib/job.rb
CHANGED
@@ -48,10 +48,10 @@ class MyJobAnisoku
|
|
48
48
|
targs.each_with_index do |link,i|
|
49
49
|
break if i >= @a[:recent]
|
50
50
|
job = MyJobAnisoku.new(
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
@a.merge({
|
52
|
+
:url => link,
|
53
|
+
:status => :second
|
54
|
+
}) )
|
55
55
|
@a[:machine].retry job
|
56
56
|
end
|
57
57
|
|
@@ -71,10 +71,10 @@ class MyJobAnisoku
|
|
71
71
|
# make job for each links_kobetu
|
72
72
|
links_kobetu.each do |link|
|
73
73
|
job = MyJobAnisoku.new(
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
@a.merge({
|
75
|
+
:url => link,
|
76
|
+
:status => :kobetu
|
77
|
+
} ))
|
78
78
|
@a[:machine].retry job
|
79
79
|
end
|
80
80
|
end
|
@@ -86,28 +86,28 @@ class MyJobAnisoku
|
|
86
86
|
title = @agent.page.title.gsub(' ★ You Tube アニ速 ★','')
|
87
87
|
# acume url
|
88
88
|
htmlA = @agent.page/"/html/body/table/tr[2]/td/table/tr/td[2]/div[4]/div[@class='kijisub']"
|
89
|
-
require 'pp'
|
89
|
+
require 'pp'
|
90
90
|
targsHTMLs = htmlA.inner_html.toutf8.split(/ランキング/)[0].split(/\n第/).reverse!
|
91
|
-
#http://posterous.com/getfile/files.posterous.com/temp-2011-08-21/eolunzlwwwFopCnhszaBwJlFEJEnHcloqkoyaFuhdezmdgipcyyiyzdpqcpG/cro08nyoutube.doc
|
91
|
+
#http://posterous.com/getfile/files.posterous.com/temp-2011-08-21/eolunzlwwwFopCnhszaBwJlFEJEnHcloqkoyaFuhdezmdgipcyyiyzdpqcpG/cro08nyoutube.doc
|
92
92
|
require 'digest'
|
93
93
|
targsHTMLs.each_with_index do |html,i|
|
94
94
|
break if i >= @a[:limit]
|
95
95
|
key = title + html.to_s
|
96
96
|
unless @a[:machine].episode_exists?( Digest::MD5.hexdigest(key) )
|
97
|
-
# puts "NOW 2 PROCEED FETCH".green.bold + html[0..20].yellow.bold
|
97
|
+
# puts "NOW 2 PROCEED FETCH".green.bold + html[0..20].yellow.bold
|
98
98
|
indi = Nokogiri::HTML.fragment(html).css("a")
|
99
99
|
indi.each do |va|
|
100
100
|
if va[:href] =~ /(http:\/\/say-move\.org\/comeplay\.php.*)/
|
101
101
|
job = MyJobAnisoku.new(
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
@a.merge({
|
103
|
+
:url => $1,
|
104
|
+
:title => title + '第' + html.split('<').first.gsub(' ','').gsub(' ',''),
|
105
|
+
:status => :third}))
|
106
106
|
@a[:machine].retry job
|
107
107
|
end
|
108
108
|
end
|
109
109
|
else
|
110
|
-
# puts "CANCELL FETCH".cyan.bold + html[0..20].yellow.bold
|
110
|
+
# puts "CANCELL FETCH".cyan.bold + html[0..20].yellow.bold
|
111
111
|
end
|
112
112
|
key = nil
|
113
113
|
end
|
@@ -130,12 +130,12 @@ require 'pp'
|
|
130
130
|
fc2 = set[0].value.split('&')[1].split('=')[1]
|
131
131
|
unless fc2.nil?
|
132
132
|
job = MyJobAnisoku.new(
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
133
|
+
@a.merge({
|
134
|
+
:url => sm[:url],
|
135
|
+
:fc2 => fc2,
|
136
|
+
:title => sm[:title],
|
137
|
+
:status => :fc2
|
138
|
+
}))
|
139
139
|
@a[:machine].retry job
|
140
140
|
return
|
141
141
|
else
|
@@ -143,12 +143,12 @@ require 'pp'
|
|
143
143
|
end
|
144
144
|
|
145
145
|
job = MyJobAnisoku.new(
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
146
|
+
@a.merge({
|
147
|
+
:url => sm[:videourl],
|
148
|
+
:title => sm[:title],
|
149
|
+
:status => :video
|
150
|
+
}))
|
151
|
+
@a[:machine].retry job
|
152
152
|
end
|
153
153
|
|
154
154
|
def fc2
|
@@ -159,11 +159,11 @@ require 'pp'
|
|
159
159
|
url = url.split('&')[0].split('=')[1] + '?' + url.split('&')[1]
|
160
160
|
puts url.red.bold
|
161
161
|
job = MyJobAnisoku.new(
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
162
|
+
@a.merge({
|
163
|
+
:url => url,
|
164
|
+
:status => :video
|
165
|
+
}))
|
166
|
+
@a[:machine].retry job
|
167
167
|
end
|
168
168
|
|
169
169
|
#fetch video
|
@@ -188,9 +188,9 @@ require 'pp'
|
|
188
188
|
uri = "http://#{@a[:url].host}#{@a[:url].path}"
|
189
189
|
uri += "?#{@a[:url].query}" if @a[:url].query
|
190
190
|
command = "curl -# -L -R -o '#{filename}' '#{uri}' "
|
191
|
-
# command += "&& growlnotify -t '#{filename}' -m '#{uri}' "
|
191
|
+
# command += "&& growlnotify -t '#{filename}' -m '#{uri}' "
|
192
192
|
|
193
|
-
# puts command
|
193
|
+
# puts command
|
194
194
|
system command
|
195
195
|
end
|
196
196
|
|
@@ -213,19 +213,20 @@ require 'pp'
|
|
213
213
|
end
|
214
214
|
end
|
215
215
|
end
|
216
|
-
|
217
216
|
end
|
218
217
|
|
219
218
|
|
220
219
|
class MyJobDojin
|
221
220
|
|
221
|
+
attr_accessor :args
|
222
|
+
|
222
223
|
def initialize(args = { })
|
223
224
|
require 'net/http'
|
224
225
|
@args = args
|
225
226
|
|
226
227
|
#sample http://1patu.net/data/20591/preview/000.jpg
|
227
228
|
@args[:path] = "/data/#{@args[:book].to_s}/preview/" +
|
228
|
-
|
229
|
+
sprintf("%0#{3}d", @args[:page]) + ".jpg"
|
229
230
|
@args[:cookie] ||= { 'Cookie' => '1patu_view=1'}
|
230
231
|
@args[:status] = :new
|
231
232
|
@args[:try] = 0
|
@@ -234,18 +235,20 @@ class MyJobDojin
|
|
234
235
|
@args[:savebookdir] = "#{@args[:savedir].to_s}/#{@args[:book].to_s}"
|
235
236
|
checkdir
|
236
237
|
@args[:savepath] = "#{@args[:savebookdir]}/" +
|
237
|
-
|
238
|
+
sprintf("%0#{3}d", @args[:page]) + ".jpg"
|
238
239
|
@machine = @args[:machine]
|
239
240
|
|
240
241
|
#debug
|
241
242
|
@args[:debug] ||= false
|
242
|
-
@args[:savepath] = '/dev/null' if @args[:
|
243
|
+
@args[:savepath] = '/dev/null' if @args[:dryrun]
|
243
244
|
end
|
244
245
|
|
245
246
|
def run
|
246
247
|
do_connect
|
247
248
|
end
|
248
249
|
|
250
|
+
|
251
|
+
|
249
252
|
private
|
250
253
|
|
251
254
|
def do_connect
|
@@ -282,6 +285,7 @@ class MyJobDojin
|
|
282
285
|
io.write(content)
|
283
286
|
end
|
284
287
|
print "fetched:".green.bold + @args[:path]
|
288
|
+
@machine.savecontent(@args[:savepath])
|
285
289
|
end
|
286
290
|
|
287
291
|
# ダウンロード保存先を作る
|
@@ -289,7 +293,7 @@ class MyJobDojin
|
|
289
293
|
begin
|
290
294
|
Dir::mkdir(@args[:savebookdir], 0777)
|
291
295
|
rescue => ex
|
292
|
-
# warn ex
|
296
|
+
# warn ex
|
293
297
|
end
|
294
298
|
end
|
295
299
|
|
@@ -306,42 +310,50 @@ class MyJobDojinEventMachine < MyJobDojin
|
|
306
310
|
private
|
307
311
|
|
308
312
|
def do_connect
|
309
|
-
|
310
|
-
return if file_already_saved?
|
313
|
+
return if file_already_saved?
|
311
314
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
315
|
+
# if @machine.connection_exceed? #コネクション限界を超えていないか?
|
316
|
+
# @machine.retry(self)
|
317
|
+
# print "E".red.bold
|
318
|
+
# return
|
319
|
+
# end
|
316
320
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
321
|
+
@http = EventMachine::Protocols::HttpClient.
|
322
|
+
request(
|
323
|
+
:host => @args[:server],
|
324
|
+
:port => @args[:port],
|
325
|
+
:request => @args[:path],
|
326
|
+
:cookie => @args[:cookie]['Cookie']
|
327
|
+
)
|
328
|
+
@machine.connection_count!
|
329
|
+
@http.errback{
|
330
|
+
begin
|
331
|
+
ensure
|
332
|
+
@machine.connection_end!
|
333
|
+
end
|
334
|
+
}
|
325
335
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
336
|
+
@http.callback {|response|
|
337
|
+
begin
|
338
|
+
if response[:status] == 200
|
339
|
+
# 200 はレスポンスの中身を保存する
|
340
|
+
save_content(response[:content])
|
341
|
+
elsif response[:status] == 503 ||
|
342
|
+
response[:status] == 500 ||
|
343
|
+
response[:status] == 403
|
344
|
+
# 503/500/403はリトライする
|
345
|
+
@args[:try] += 1
|
346
|
+
@machine.retry(self) if @args[:try] < 6
|
347
|
+
elsif response[:status] == 404
|
348
|
+
# 404は終了する
|
349
|
+
else
|
350
|
+
puts response[:status].to_s.red.bold
|
351
|
+
puts response[:headers].to_s.red.bold
|
352
|
+
end
|
353
|
+
ensure
|
354
|
+
@machine.connection_end!
|
355
|
+
end
|
356
|
+
}
|
345
357
|
end
|
346
358
|
end
|
347
359
|
|
data/lib/lib/machine.rb
CHANGED
@@ -6,10 +6,6 @@
|
|
6
6
|
# this class has queue of jobs.controll jobs and run jobs
|
7
7
|
module MyMachine
|
8
8
|
|
9
|
-
Version = "0.0.1"
|
10
|
-
|
11
|
-
attr_accessor :queue
|
12
|
-
|
13
9
|
def initialize
|
14
10
|
require 'thread'
|
15
11
|
@queue = Queue.new
|
@@ -21,7 +17,7 @@ module MyMachine
|
|
21
17
|
end
|
22
18
|
|
23
19
|
def go
|
24
|
-
|
20
|
+
raise "You need write the go method!"
|
25
21
|
end
|
26
22
|
|
27
23
|
def retry(job)
|
@@ -31,17 +27,16 @@ module MyMachine
|
|
31
27
|
private
|
32
28
|
|
33
29
|
def setupjobs
|
34
|
-
puts "
|
30
|
+
puts "iF need, write the setupjobs method!"
|
35
31
|
end
|
36
32
|
|
37
33
|
def setupmachine
|
38
|
-
puts "
|
34
|
+
puts "if need, write the setupmachine method!"
|
39
35
|
end
|
40
36
|
|
41
37
|
end
|
42
38
|
|
43
|
-
|
44
|
-
module MyMachineDojin
|
39
|
+
class MyEventMachineDojin
|
45
40
|
include MyMachine
|
46
41
|
|
47
42
|
def initialize(args={ })
|
@@ -52,83 +47,62 @@ module MyMachineDojin
|
|
52
47
|
@args[:concurrency] ||= 10
|
53
48
|
@args[:savedir] ||= "#{ENV['HOME']}/Downloads/jpg"
|
54
49
|
@endbooks = []
|
55
|
-
end
|
56
|
-
|
57
|
-
def bookend(booknum)
|
58
|
-
@endbooks << booknum
|
59
|
-
end
|
60
|
-
|
61
|
-
def bookended?(booknum)
|
62
|
-
@endbooks.index(booknum)
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def setupjobs
|
68
|
-
(0..100).each do |p|
|
69
|
-
(@args[:start]..@args[:stop]).each do |b|
|
70
|
-
job = MyDojinJob.new(
|
71
|
-
:server => '1patu.net',
|
72
|
-
:book => b,
|
73
|
-
:page => p,
|
74
|
-
:machine => self,
|
75
|
-
:debug => @args[:debug] ||= false
|
76
|
-
)
|
77
|
-
@queue.push job
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
|
84
|
-
class MyEventMachineDojin
|
85
|
-
include MyMachineDojin
|
86
|
-
|
87
|
-
def initialize(args={ })
|
88
|
-
super args
|
89
|
-
# queをEventMachineで再定義
|
90
50
|
require 'rubygems'
|
91
51
|
require 'eventmachine'
|
92
52
|
@connection_count = 0
|
53
|
+
require 'thread'
|
54
|
+
@connection_que = Queue.new
|
55
|
+
@list = []
|
56
|
+
@gaman = 0
|
93
57
|
end
|
94
58
|
|
95
59
|
# EventMachine用の定義
|
96
60
|
def go
|
97
|
-
@a=1;@b=0;@c=0;@d=0;
|
98
61
|
EM.run do
|
99
62
|
EM.add_periodic_timer(0.00001) do
|
100
|
-
|
101
|
-
print 1>@a? "l".green: "l".yellow
|
102
|
-
print 1>@b? "o".red: "o".white
|
103
|
-
print 1>@c? "o".cyan: "o".green
|
104
|
-
print 1>@d? "o".red: "o".green
|
63
|
+
print "."
|
105
64
|
EM.stop if should_stop_machine?
|
106
65
|
if !connection_exceed?
|
107
|
-
|
66
|
+
unless @queue.empty?
|
67
|
+
job = @queue.pop
|
68
|
+
job.run if job
|
69
|
+
end
|
108
70
|
end
|
109
71
|
end
|
110
72
|
end
|
111
|
-
p @endbooks
|
112
|
-
@endbooks = []
|
73
|
+
# p @endbooks.uniq!.sort
|
113
74
|
puts "End of fetch".green.bold
|
114
75
|
end
|
115
76
|
|
116
77
|
def connection_exceed?
|
117
|
-
@args[:concurrency] <= @connection_count
|
78
|
+
# @args[:concurrency] <= @connection_count
|
79
|
+
@args[:concurrency] <= @connection_que.size
|
118
80
|
end
|
119
81
|
|
120
82
|
def connection_count!
|
121
|
-
@connection_count += 1
|
122
|
-
|
83
|
+
# @connection_count += 1
|
84
|
+
@connection_que.push(:t)
|
123
85
|
end
|
124
86
|
|
125
87
|
def connection_end!
|
126
|
-
@
|
88
|
+
@connection_que.pop
|
89
|
+
# @connection_count -= 1
|
90
|
+
end
|
91
|
+
|
92
|
+
def savecontent(path)
|
93
|
+
@list << path
|
127
94
|
end
|
128
95
|
|
96
|
+
def write
|
97
|
+
open("#{@args[:savedir]}/emit.txt" ,"w") do |io|
|
98
|
+
io.write('["')
|
99
|
+
io.write(@list.sort.join('","'))
|
100
|
+
io.write('"]')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
129
104
|
private
|
130
105
|
|
131
|
-
# EventMachine用に再定義
|
132
106
|
def setupjobs
|
133
107
|
(0..100).each do |p|
|
134
108
|
(@args[:start]..@args[:stop]).each do |b|
|
@@ -145,14 +119,13 @@ class MyEventMachineDojin
|
|
145
119
|
end
|
146
120
|
end
|
147
121
|
|
148
|
-
# 何もしない
|
149
|
-
def setupmachine
|
150
|
-
end
|
151
|
-
|
152
122
|
# Machineは終了すべきか?
|
153
123
|
def should_stop_machine?
|
154
|
-
|
155
|
-
|
124
|
+
@gaman += 1 if @queue.size < 10
|
125
|
+
if @gaman > 200
|
126
|
+
write if @queue.size == 0
|
127
|
+
return true
|
128
|
+
end
|
156
129
|
end
|
157
130
|
|
158
131
|
end
|
@@ -168,8 +141,6 @@ end
|
|
168
141
|
class MyMachineAnisoku
|
169
142
|
include MyMachine
|
170
143
|
|
171
|
-
Version = "0.0.1"
|
172
|
-
|
173
144
|
# directory of save video files default "#{ENV['HOME']}/Desktop/video"
|
174
145
|
attr_accessor :savedir
|
175
146
|
|
@@ -271,12 +242,13 @@ class MyMachineAnisoku
|
|
271
242
|
puts "End of fetch".green.bold
|
272
243
|
end
|
273
244
|
|
274
|
-
|
275
245
|
# delete tiny fail files
|
276
246
|
def finalize_files
|
277
247
|
del_small_files
|
278
248
|
command = "find #{@savedir} -size -1000k -type f -print0| xargs -0 rm -v "
|
279
|
-
exec
|
249
|
+
exec command
|
250
|
+
command = "find /Users/seijiro/Desktop/video -type f > ~/Desktop/video.m3u && open ~/Desktop/video.m3u "
|
251
|
+
exec command
|
280
252
|
end
|
281
253
|
|
282
254
|
private
|
data/my-lib.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{my-lib}
|
8
|
-
s.version = "0.0.1.
|
8
|
+
s.version = "0.0.1.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{modeverv}]
|
12
|
-
s.date = %q{2011-09-
|
12
|
+
s.date = %q{2011-09-12}
|
13
13
|
s.description = %q{longer description of your gem}
|
14
14
|
s.email = %q{modeverv@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/my-lib_spec.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
+
# -*- coding:utf-8 -*-
|
1
2
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
3
|
|
3
4
|
describe "MyLib" do
|
4
5
|
it "fails" do
|
5
|
-
#
|
6
|
+
# fail "hey buddy, you should probably rename this file and start specing for real"
|
6
7
|
end
|
7
8
|
|
8
9
|
it "success" do
|
9
10
|
####################################################
|
10
11
|
machine = MyMachineAnisoku.new(:savepath => "/Users/seijiro/Desktop/video")
|
11
12
|
machine.setup
|
12
|
-
# machine.go
|
13
|
+
# machine.go
|
13
14
|
end
|
14
15
|
|
15
16
|
it "success get syslog" do
|
@@ -35,9 +36,49 @@ describe "MyConfig" do
|
|
35
36
|
|
36
37
|
it "set config file failue" do
|
37
38
|
proc {
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
MyConfig.dispose
|
40
|
+
MyConfig.set "aaaaaaaaaaa.yml"
|
41
|
+
p MyConfig.get
|
41
42
|
}.should raise_error
|
42
43
|
end
|
43
44
|
end
|
45
|
+
|
46
|
+
|
47
|
+
describe "MyJobAnisoku" do
|
48
|
+
|
49
|
+
before(:each) do
|
50
|
+
@machine = MyMachineAnisoku.new
|
51
|
+
@machine.setup
|
52
|
+
@job = MyJobAnisoku.new(:machine => @machine)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "check new" do
|
56
|
+
# fail
|
57
|
+
a = @job.a
|
58
|
+
fail unless a[:url]
|
59
|
+
fail unless a[:status]
|
60
|
+
fail unless a[:recent]
|
61
|
+
fail unless a[:limit]
|
62
|
+
fail unless a[:fc2magick]
|
63
|
+
end
|
64
|
+
|
65
|
+
it "tokkakariを実行するとjobが増える" do
|
66
|
+
jobqsize = @machine.instance_eval("@queue.size")
|
67
|
+
p jobqsize
|
68
|
+
@machine.instance_eval("@queue.pop.tokkakari")
|
69
|
+
jobqsize2 = @machine.instance_eval("@queue.size")
|
70
|
+
p jobqsize2
|
71
|
+
fail unless jobqsize < jobqsize2
|
72
|
+
end
|
73
|
+
|
74
|
+
it "tokkakariを実行するとjobが増える" do
|
75
|
+
jobqsize = @machine.instance_eval("@queue.size")
|
76
|
+
p jobqsize
|
77
|
+
@machine.instance_eval("@queue.pop.tokkakari")
|
78
|
+
jobqsize2 = @machine.instance_eval("@queue.size")
|
79
|
+
p jobqsize2
|
80
|
+
fail unless jobqsize < jobqsize2
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: my-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-12 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
16
|
-
requirement: &
|
16
|
+
requirement: &2151817660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2151817660
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: eventmachine
|
27
|
-
requirement: &
|
27
|
+
requirement: &2151816280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2151816280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mechanize
|
38
|
-
requirement: &
|
38
|
+
requirement: &2151812380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2151812380
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &2151810780 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>'
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.3.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2151810780
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: yard
|
60
|
-
requirement: &
|
60
|
+
requirement: &2151808960 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>'
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.6.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2151808960
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
|
-
requirement: &
|
71
|
+
requirement: &2151807120 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>'
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.0.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2151807120
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: jeweler
|
82
|
-
requirement: &
|
82
|
+
requirement: &2151805840 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2151805840
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rcov
|
93
|
-
requirement: &
|
93
|
+
requirement: &2151804200 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2151804200
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: guard
|
104
|
-
requirement: &
|
104
|
+
requirement: &2151803220 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2151803220
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: guard-spork
|
115
|
-
requirement: &
|
115
|
+
requirement: &2151801740 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,7 +120,7 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *2151801740
|
124
124
|
description: longer description of your gem
|
125
125
|
email: modeverv@gmail.com
|
126
126
|
executables: []
|
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
segments:
|
170
170
|
- 0
|
171
|
-
hash:
|
171
|
+
hash: -1576979100048753674
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
none: false
|
174
174
|
requirements:
|