narou 2.9.4 → 2.9.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of narou might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cab2bc24aafaa7a416a597099547ac6d6af34bb6
4
- data.tar.gz: d0b2b121bbed6f1fc8e5d70d139fd6776fb05de1
3
+ metadata.gz: aec577773e278bf063bc2d4312e5b0756b6fed17
4
+ data.tar.gz: 2dd3643848b6f6c62c17a184d0eab3069f8aa9d1
5
5
  SHA512:
6
- metadata.gz: baf5ca6a8c3b0639ee1131808fa4648cc376186dce6470b8409c8a732b8afdff597b08266b77f6b92cc4e3dd130510ea03be896b79f4d5584c2379f37f3546b2
7
- data.tar.gz: 408194d4974caf9836e6956c603b04ebf326fddd060b40e6b36fbfbd973fe04bdb4438bac1606a467d2675ae60ac75e1adf778061d968e08713a3aaa5c797035
6
+ metadata.gz: 564a5a1adda1be0b07e3cc80caca7d71479098c7d4ae6e85c85fce047421b57341d82746b8cdc7e43beeeae3bf6749ac68c802223fdc00bed10ffaa03dcb4691
7
+ data.tar.gz: 52d40b770819b24b2564bce2567c28b487e2b27d3eefce6c9857b8c69b21078d8b4456cff8cf74cd769011655ba704e5695120b8f23f2d52a83d079e31ab0411
data/.gitignore CHANGED
@@ -26,6 +26,7 @@ log/
26
26
  misc/
27
27
  hotentry/
28
28
  replace.txt
29
+ tags
29
30
 
30
31
  \#*\#
31
32
 
data/.rubocop.yml CHANGED
@@ -1,419 +1,210 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2014-09-08 11:40:33 +0900 using RuboCop version 0.26.0.
3
- # The point is for the user to remove these configuration records
4
- # one by one as the offenses are removed from the code base.
5
- # Note that changes in the inspected code, or installation of new
6
- # versions of RuboCop, may require this file to be generated again.
7
-
8
- # Offense count: 2
9
- Lint/AmbiguousOperator:
10
- Enabled: false
11
-
12
- # Offense count: 6
13
- # Configuration parameters: AllowSafeAssignment.
14
- Lint/AssignmentInCondition:
15
- Enabled: false
16
-
17
- # Offense count: 2
18
- # Cop supports --auto-correct.
19
- Lint/BlockAlignment:
20
- Enabled: true
21
-
22
- # Offense count: 43
23
- # Cop supports --auto-correct.
24
- Lint/DeprecatedClassMethods:
25
- Enabled: true
26
-
27
- # Offense count: 2
28
- Lint/Eval:
29
- Enabled: false
30
-
31
- # Offense count: 2
32
- Lint/HandleExceptions:
33
- Enabled: false
34
-
35
- # Offense count: 2
36
- Lint/LiteralInCondition:
37
- Enabled: true
38
-
39
- # Offense count: 4
40
- Lint/ParenthesesAsGroupedExpression:
41
- Enabled: true
42
-
43
- # Offense count: 1
44
- # Cop supports --auto-correct.
45
- Lint/RescueException:
46
- Enabled: false
1
+ # 参考:
2
+ # https://gist.github.com/linyows/ace586b118f87291ed3e
47
3
 
48
- # Offense count: 5
49
- Lint/UnderscorePrefixedVariableName:
50
- Enabled: false
4
+ AllCops:
5
+ Exclude:
6
+ - "小説データ/**/*"
7
+ - "trash/**/*"
8
+ DisplayCopNames: true
51
9
 
52
- # Offense count: 5
53
- # Cop supports --auto-correct.
54
- Lint/UnusedBlockArgument:
55
- Enabled: true
10
+ Metrics/ClassLength:
11
+ CountComments: false
12
+ Max: 300
56
13
 
57
- # Offense count: 20
58
- # Cop supports --auto-correct.
59
- Lint/UnusedMethodArgument:
60
- Enabled: false
14
+ Metrics/ModuleLength:
15
+ CountComments: false
16
+ Max: 300
61
17
 
62
- # Offense count: 15
63
- Lint/UselessAssignment:
64
- Enabled: true
18
+ Metrics/AbcSize:
19
+ Max: 30
65
20
 
66
- # Offense count: 8
67
21
  Metrics/BlockNesting:
68
- Max: 4
69
-
70
- # Offense count: 16
71
- # Configuration parameters: CountComments.
72
- Metrics/ClassLength:
73
- Max: 863
22
+ Max: 3
74
23
 
75
- # Offense count: 50
76
24
  Metrics/CyclomaticComplexity:
77
- Max: 34
25
+ Max: 10
78
26
 
79
- # Offense count: 181
80
- # Configuration parameters: AllowURI.
81
27
  Metrics/LineLength:
82
- Max: 138
28
+ Max: 140
29
+ AllowURI: true
30
+ URISchemes:
31
+ - http
32
+ - https
33
+
34
+ Style/GuardClause:
35
+ MinBodyLength: 5
83
36
 
84
- # Offense count: 158
85
- # Configuration parameters: CountComments.
86
37
  Metrics/MethodLength:
87
- Max: 80
38
+ Max: 50
88
39
 
89
- # Offense count: 42
90
40
  Metrics/PerceivedComplexity:
91
- Max: 38
41
+ Max: 11
92
42
 
93
- # Offense count: 29
94
43
  Style/AccessorMethodName:
95
- Enabled: false
96
-
97
- # Offense count: 19
98
- # Cop supports --auto-correct.
99
- # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
100
- Style/AlignHash:
101
- Enabled: false
44
+ Enabled: true
102
45
 
103
- # Offense count: 16
104
- # Cop supports --auto-correct.
105
- # Configuration parameters: EnforcedStyle, SupportedStyles.
46
+ # 条件式の時に使った時のみ警告を出す
106
47
  Style/AndOr:
107
- Enabled: false
108
-
109
- # Offense count: 741
110
- Style/AsciiComments:
111
- Enabled: false
48
+ EnforcedStyle: conditionals
112
49
 
113
- # Offense count: 2
114
- # Cop supports --auto-correct.
115
- Style/BlockComments:
50
+ Style/BlockDelimiters:
116
51
  Enabled: false
117
52
 
118
- # Offense count: 89
119
- # Cop supports --auto-correct.
120
- Style/Blocks:
121
- Enabled: false
122
-
123
- # Offense count: 5
124
- # Cop supports --auto-correct.
125
- # Configuration parameters: EnforcedStyle, SupportedStyles.
126
53
  Style/BracesAroundHashParameters:
127
54
  Enabled: false
128
55
 
129
- # Offense count: 9
130
- # Configuration parameters: EnforcedStyle, SupportedStyles.
131
- Style/ClassAndModuleChildren:
132
- Enabled: false
56
+ Style/CollectionMethods:
57
+ PreferredMethods:
58
+ detect: "detect"
59
+ find: "detect"
60
+ inject: "inject"
61
+ reduce: "inject"
133
62
 
134
- # Offense count: 6
135
- # Cop supports --auto-correct.
136
- # Configuration parameters: EnforcedStyle, SupportedStyles.
137
- Style/ClassCheck:
138
- Enabled: false
63
+ Style/Semicolon:
64
+ Exclude:
65
+ - "spec/**/*"
139
66
 
140
- # Offense count: 55
141
- Style/ClassVars:
142
- Enabled: false
143
-
144
- # Offense count: 1
145
- # Cop supports --auto-correct.
146
- # Configuration parameters: PreferredMethods.
147
- Style/CollectionMethods:
67
+ Style/AsciiComments:
148
68
  Enabled: false
149
69
 
150
- # Offense count: 1
151
- # Cop supports --auto-correct.
152
- Style/ColonMethodCall:
153
- Enabled: true
154
-
155
- # Offense count: 1
156
- # Cop supports --auto-correct.
157
- Style/CommentIndentation:
70
+ Style/BlockComments:
158
71
  Enabled: false
159
72
 
160
- # Offense count: 1
161
- Style/ConstantName:
73
+ Style/ClassVars:
162
74
  Enabled: false
163
75
 
164
- # Offense count: 60
165
76
  Style/Documentation:
166
77
  Enabled: false
167
78
 
168
- # Offense count: 5
169
79
  Style/DoubleNegation:
170
80
  Enabled: false
171
81
 
172
- # Offense count: 1
173
- # Cop supports --auto-correct.
174
- Style/EmptyLines:
175
- Enabled: true
82
+ Style/FormatString:
83
+ EnforcedStyle: percent
176
84
 
177
- # Offense count: 2
178
- Style/EndOfLine:
85
+ # 後置 if/unless を使わないほうがわかりやすい場合もある
86
+ Style/IfUnlessModifier:
179
87
  Enabled: false
180
88
 
181
- # Offense count: 4
182
- # Configuration parameters: EnforcedStyle, SupportedStyles.
183
- Style/FormatString:
184
- Enabled: false
89
+ Style/HashSyntax:
90
+ Exclude:
91
+ - "**/*.rake"
92
+ - "Rakefile"
185
93
 
186
- # Offense count: 41
187
- # Configuration parameters: AllowedVariables.
188
- Style/GlobalVars:
94
+ Style/Lambda:
189
95
  Enabled: false
190
96
 
191
- # Offense count: 17
192
- # Configuration parameters: MinBodyLength.
193
- Style/GuardClause:
97
+ Style/RescueModifier:
194
98
  Enabled: false
99
+
100
+ # 1_000_000 と区切り文字が 2 個以上必要になる場合のみ _ 区切りを必須にする
101
+ Style/NumericLiterals:
102
+ MinDigits: 7
195
103
 
196
- # Offense count: 12
197
- # Cop supports --auto-correct.
198
- # Configuration parameters: EnforcedStyle, SupportedStyles.
199
- Style/HashSyntax:
200
- Enabled: false
104
+ # has_ から始まるメソッドは許可する
105
+ Style/PredicateName:
106
+ NamePrefixBlacklist:
107
+ - "is_"
108
+ - "have_"
109
+ NamePrefix:
110
+ - "is_"
111
+ - "have_"
201
112
 
202
- # Offense count: 81
203
- # Configuration parameters: MaxLineLength.
204
- Style/IfUnlessModifier:
113
+ Style/GlobalVars:
205
114
  Enabled: false
206
115
 
207
- # Offense count: 9
208
- # Cop supports --auto-correct.
209
- # Configuration parameters: EnforcedStyle, SupportedStyles.
210
116
  Style/IndentHash:
211
117
  Enabled: false
212
118
 
213
- # Offense count: 1
214
- # Cop supports --auto-correct.
215
- Style/IndentationWidth:
216
- Enabled: true
217
-
218
- # Offense count: 1
219
- Style/Lambda:
220
- Enabled: true
221
-
222
- # Offense count: 9
223
- # Cop supports --auto-correct.
224
119
  Style/LeadingCommentSpace:
225
- Enabled: false
120
+ Enabled: true
226
121
 
227
- # Offense count: 16
228
- # Cop supports --auto-correct.
229
122
  Style/LineEndConcatenation:
230
- Enabled: false
231
-
232
- # Offense count: 1
233
- # Configuration parameters: EnforcedStyle, SupportedStyles.
234
- Style/MethodName:
235
- Enabled: false
236
-
237
- # Offense count: 3
238
- Style/ModuleFunction:
239
- Enabled: false
123
+ Enabled: true
240
124
 
241
- # Offense count: 5
242
125
  Style/MultilineBlockChain:
243
- Enabled: false
126
+ Enabled: true
244
127
 
245
- # Offense count: 2
246
128
  Style/MultilineTernaryOperator:
247
- Enabled: false
129
+ Enabled: true
248
130
 
249
- # Offense count: 2
250
- # Cop supports --auto-correct.
251
131
  Style/NegatedIf:
252
132
  Enabled: true
253
133
 
254
- # Offense count: 1
255
- Style/NestedTernaryOperator:
256
- Enabled: false
257
-
258
- # Offense count: 5
259
- # Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
260
- Style/Next:
261
- Enabled: false
262
-
263
- # Offense count: 2
264
- # Cop supports --auto-correct.
265
134
  Style/Not:
266
135
  Enabled: true
267
136
 
268
- # Offense count: 2
269
- # Cop supports --auto-correct.
270
- Style/NumericLiterals:
271
- MinDigits: 6
272
-
273
- # Offense count: 22
274
- # Cop supports --auto-correct.
275
- # Configuration parameters: PreferredDelimiters.
276
- Style/PercentLiteralDelimiters:
277
- Enabled: false
137
+ PercentLiteralDelimiters:
138
+ PreferredDelimiters:
139
+ "%": "!!"
140
+ "%i": "()"
141
+ "%q": "!!"
142
+ "%Q": "!!"
143
+ "%r": "!!"
144
+ "%s": "()"
145
+ "%w": "()"
146
+ "%W": "()"
147
+ "%x": "()"
278
148
 
279
- # Offense count: 72
280
- # Cop supports --auto-correct.
281
149
  Style/PerlBackrefs:
282
150
  Enabled: false
283
151
 
284
- # Offense count: 7
285
- # Configuration parameters: NamePrefix, NamePrefixBlacklist.
286
- Style/PredicateName:
287
- Enabled: false
288
-
289
- # Offense count: 14
290
- # Cop supports --auto-correct.
291
- # Configuration parameters: AllowMultipleReturnValues.
292
152
  Style/RedundantReturn:
293
- Enabled: false
153
+ AllowMultipleReturnValues: true
294
154
 
295
- # Offense count: 8
296
- # Cop supports --auto-correct.
297
155
  Style/RedundantSelf:
298
156
  Enabled: false
299
157
 
300
- # Offense count: 3
301
- # Configuration parameters: MaxSlashes.
302
- Style/RegexpLiteral:
303
- Enabled: false
304
-
305
- # Offense count: 7
306
- Style/RescueModifier:
307
- Enabled: false
308
-
309
- # Offense count: 2
310
- Style/SelfAssignment:
311
- Enabled: false
312
-
313
- # Offense count: 28
314
- # Cop supports --auto-correct.
315
- # Configuration parameters: EnforcedStyle, SupportedStyles.
316
- Style/SignalException:
317
- Enabled: false
158
+ SignalException:
159
+ EnforcedStyle: only_raise
318
160
 
319
- # Offense count: 11
320
- # Cop supports --auto-correct.
321
161
  Style/SpaceAfterComma:
322
- Enabled: false
162
+ Enabled: true
323
163
 
324
- # Offense count: 74
325
- # Cop supports --auto-correct.
326
164
  Style/SpaceAroundOperators:
327
- Enabled: false
328
-
329
- # Offense count: 3
330
- # Cop supports --auto-correct.
331
- # Configuration parameters: EnforcedStyle, SupportedStyles.
332
- Style/SpaceBeforeBlockBraces:
333
- Enabled: false
334
-
335
- # Offense count: 3
336
- # Cop supports --auto-correct.
337
- Style/SpaceBeforeComma:
338
- Enabled: false
339
-
340
- # Offense count: 2
341
- # Cop supports --auto-correct.
342
- # Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
343
- Style/SpaceInsideBlockBraces:
344
- Enabled: false
345
-
346
- # Offense count: 2
347
- # Cop supports --auto-correct.
348
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
349
- Style/SpaceInsideHashLiteralBraces:
350
- Enabled: false
165
+ Enabled: true
351
166
 
352
- # Offense count: 15
353
- # Cop supports --auto-correct.
354
167
  Style/SpaceInsideRangeLiteral:
355
- Enabled: false
168
+ Enabled: true
356
169
 
357
- # Offense count: 12
358
- # Cop supports --auto-correct.
359
170
  Style/SpecialGlobalVars:
360
171
  Enabled: false
361
172
 
362
- # Offense count: 3278
363
- # Cop supports --auto-correct.
364
- # Configuration parameters: EnforcedStyle, SupportedStyles.
365
173
  Style/StringLiterals:
366
- Enabled: false
174
+ EnforcedStyle: double_quotes
367
175
 
368
- # Offense count: 2
369
- # Cop supports --auto-correct.
370
- # Configuration parameters: IgnoredMethods.
371
176
  Style/SymbolProc:
372
- Enabled: false
177
+ Enabled: true
373
178
 
374
- # Offense count: 48
375
- # Cop supports --auto-correct.
376
179
  Style/Tab:
377
- Enabled: false
180
+ Enabled: true
378
181
 
379
- # Offense count: 4
380
- # Cop supports --auto-correct.
381
- # Configuration parameters: EnforcedStyle, SupportedStyles.
382
182
  Style/TrailingBlankLines:
383
183
  Enabled: false
384
184
 
385
- # Offense count: 14
386
- # Cop supports --auto-correct.
387
- # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
388
185
  Style/TrailingCommaInLiteral:
389
186
  Enabled: false
390
187
 
391
- # Offense count: 15
392
- # Cop supports --auto-correct.
393
- Style/TrailingWhitespace:
394
- Enabled: false
395
-
396
- # Offense count: 9
397
- # Cop supports --auto-correct.
398
- # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
399
188
  Style/TrivialAccessors:
400
- Enabled: false
189
+ Enabled: true
401
190
 
402
- # Offense count: 1
403
191
  Style/UnlessElse:
192
+ Enabled: true
193
+
194
+ VariableName:
195
+ EnforcedStyle: snake_case
196
+
197
+ Style/WordArray:
198
+ MinSize: 3
199
+
200
+ Style/StringLiteralsInInterpolation:
404
201
  Enabled: false
405
202
 
406
- # Offense count: 2
407
- # Cop supports --auto-correct.
408
- Style/UnneededPercentQ:
203
+ Style/MutableConstant:
409
204
  Enabled: false
410
205
 
411
- # Offense count: 2
412
- # Configuration parameters: EnforcedStyle, SupportedStyles.
413
- Style/VariableName:
206
+ Lint/UnderscorePrefixedVariableName:
414
207
  Enabled: false
415
208
 
416
- # Offense count: 3
417
- # Cop supports --auto-correct.
418
- Style/WordArray:
419
- MinSize: 3
209
+ Style/EmptyLinesAroundClassBody:
210
+ Enabled: false
data/ChangeLog.md CHANGED
@@ -2,6 +2,18 @@
2
2
  更新履歴 - ChangeLog
3
3
  ====================
4
4
 
5
+ 2.9.5 : 2016/07/01
6
+ ------------------
7
+ #### 仕様変更
8
+ - WEB UI の Eject ボタンを押した際に、即時取り出しではなく一旦キューに積む様に
9
+ 変更しました。これにより変換が終了したら取り外すということが可能になります
10
+ + すぐに取り外したい場合は Eject ボタン横のドロップダウンメニューから可能です
11
+ - Windows でも Eject ボタンに対応しました
12
+
13
+ #### 修正内容
14
+ - Windows 環境において、kindlegen を実行時に何も実行されず mobi ファイルが作成
15
+ 出来ない場合がある
16
+
5
17
  2.9.4 : 2016/06/16
6
18
  ------------------
7
19
  #### 仕様変更
data/README.md CHANGED
@@ -2,6 +2,7 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
2
2
  ============================================================
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/narou.svg)](http://badge.fury.io/rb/narou)
5
+ [![Join the chat at https://gitter.im/whiteleaf7/narou](https://badges.gitter.im/whiteleaf7/narou.svg)](https://gitter.im/whiteleaf7/narou?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
6
 
6
7
  概要 - Summary
7
8
  --------------
@@ -32,52 +33,17 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
32
33
  更新履歴 - ChangeLog
33
34
  --------------------
34
35
 
35
- 2.9.4 : 2016/06/16
36
+ 2.9.5 : 2016/07/01
36
37
  ------------------
37
38
  #### 仕様変更
38
- - `download.interval` のデフォルト値を0.7秒に変更しました(下限は0秒のまま)
39
-
40
- #### 修正
41
- - `update --gl` コマンド(最新話掲載日を更新)で update.interval が反映されて
42
- いなかったのを修正
43
-
44
-
45
- 2.9.3.1 : 2016/06/15
46
- --------------------
47
- #### 修正
48
- - 凍結済みでも待機時間が発生してしまっていたのを修正
49
-
50
-
51
- 2.9.3 : 2016/06/15
52
- ------------------
53
- #### WEB UI
54
- - 小説URLもFilterで検索出来るようにしました
55
- + NコードがURLに含まれている為、Nコード検索としても使えます
56
- - ダイジェスト化を検知した際にでる選択肢に、「8. 変換する」を追加しました
57
-
58
- #### 仕様変更
59
- - `enable_dakuten_font` を復活させました
60
- + AozoraEpub3の一文字濁点フォント機能を使った場合、端末でフォントを切り替えた
61
- 場合に濁点にならない問題があったため、切り替えた場合でも機能するNarou.rbの
62
- 濁点フォントを再び使えるようにしました
63
- + setting.ini で enable_dakuten_font = true とすることで有効になり、false の
64
- 場合は AozoraEPub3 の一文字濁点フォント機能を使用します。
65
- (デフォルトでは false で、 AozoraEpub3 の機能を使います)
66
- - 更新時に1作品ごとに待機時間が入るようになりました
67
- + `update.interval` で待機秒数を指定出来ます(ただし、最低2.5秒必要です)
68
- + 更新処理の時間も含まれるので、例えば更新処理に1秒かかった場合は待機時間は
69
- 1.5秒です。2.5秒以上更新や変換にかかった場合は待機時間は発生しません
70
-
71
- #### 修正
72
- - i文庫に変換時にカクヨムのサブチャプターが反映されていなかったのを修正
73
- - WEB UIのタグを編集ダイアログ内でタグをソートしていなかったのを修正
74
-
75
-
76
- 2.9.2 : 2016/04/08
77
- ------------------
78
- #### 修正
79
- - WEB UIの個別メニュー「差分を表示」が実行出来ない不具合を修正
80
-
39
+ - WEB UI の Eject ボタンを押した際に、即時取り出しではなく一旦キューに積む様に
40
+ 変更しました。これにより変換が終了したら取り外すということが可能になります
41
+ + すぐに取り外したい場合は Eject ボタン横のドロップダウンメニューから可能です
42
+ - Windows でも Eject ボタンに対応しました
43
+
44
+ #### 修正内容
45
+ - Windows 環境において、kindlegen を実行時に何も実行されず mobi ファイルが作成
46
+ 出来ない場合がある
81
47
 
82
48
  ----
83
49
 
data/circle.yml ADDED
@@ -0,0 +1,3 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.2.3
@@ -428,12 +428,12 @@ module Command
428
428
  tab: :general
429
429
  },
430
430
  "download.interval" => {
431
- type: :float, help: "各話DL時に指定した秒数待機する。デフォルト0",
431
+ type: :float, help: "各話DL時に指定秒数待機する。デフォルト#{Downloader::DEFAULT_INTERVAL_WAIT}秒",
432
432
  tab: :detail
433
433
  },
434
434
  "download.wait-steps" => {
435
435
  type: :integer,
436
- help: "この値で指定した話数ごとにウェイトを入れる\n" \
436
+ help: "指定した話数ごとに長めのウェイトが入る\n" \
437
437
  " ※注意:11以上を設定してもなろうの場合は10話ごとにウェイトが入ります",
438
438
  tab: :detail
439
439
  },
@@ -15,7 +15,8 @@ module Command
15
15
  extend Memoist
16
16
 
17
17
  class Interval
18
- MIN = 2.5 # 作品間ウェイトの最低秒数(処理時間含む)
18
+ MIN = 2.5 # 作品間ウェイトの最低秒数(処理時間含む)
19
+ FORCE_WAIT_TIME = 2.0 # 強制待機時間
19
20
 
20
21
  def initialize(interval)
21
22
  @time = Time.now - MIN
@@ -28,6 +29,10 @@ module Command
28
29
  sleep(@interval_time - wait_time) if wait_time < @interval_time
29
30
  @time = Time.now
30
31
  end
32
+
33
+ def force_wait
34
+ sleep(FORCE_WAIT_TIME)
35
+ end
31
36
  end
32
37
 
33
38
  LOG_DIR_NAME = "log"
@@ -191,6 +196,7 @@ module Command
191
196
  when :ok
192
197
  if @options["no-convert"] ||
193
198
  (@options["convert-only-new-arrival"] && !result.new_arrivals)
199
+ interval.force_wait
194
200
  next
195
201
  end
196
202
  when :failed
@@ -3,32 +3,37 @@
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
5
 
6
+ # rubocop:disable Style/VariableName
7
+
6
8
  require "win32ole"
7
9
  require_relative "../../extensions/windows"
10
+ require_relative "windows/eject"
8
11
 
9
- module Device::Library
10
- module Windows
11
- def get_device_root_dir(volume_name)
12
- @@FileSystemObject ||= WIN32OLE.new("Scripting.FileSystemObject")
13
- get_drives.each do |drive_letter|
14
- drive_info = @@FileSystemObject.GetDrive(drive_letter)
15
- vol = drive_info.VolumeName rescue ""
16
- if vol.downcase == volume_name.downcase
17
- return File.expand_path(drive_letter)
12
+ class Device
13
+ module Library
14
+ module Windows
15
+ def get_device_root_dir(volume_name)
16
+ @@FileSystemObject ||= WIN32OLE.new("Scripting.FileSystemObject")
17
+ drives.each do |drive_letter|
18
+ drive_info = @@FileSystemObject.GetDrive(drive_letter)
19
+ vol = drive_info.VolumeName rescue ""
20
+ if vol.casecmp(volume_name) == 0
21
+ return File.expand_path(drive_letter)
22
+ end
18
23
  end
24
+ nil
19
25
  end
20
- nil
21
- end
22
26
 
23
- def get_drives
24
- result = []
25
- bits = WinAPI.GetLogicalDrives
26
- 26.times do |i|
27
- if bits & (1 << i) != 0
28
- result << "#{(65 + i).chr}:\\"
27
+ def drives
28
+ result = []
29
+ bits = WinAPI.GetLogicalDrives
30
+ 26.times do |i|
31
+ if bits & (1 << i) != 0
32
+ result << "#{(65 + i).chr}:\\"
33
+ end
29
34
  end
35
+ result
30
36
  end
31
- result
32
37
  end
33
38
  end
34
39
  end
@@ -0,0 +1,166 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright 2013 whiteleaf. All rights reserved.
4
+ #
5
+ # rubocop:disable Style/MethodName
6
+ # rubocop:disable Style/VariableName
7
+
8
+ class Device
9
+ module Library
10
+ module Windows
11
+ def eject(volume_name)
12
+ device_root = get_device_root_dir(volume_name)
13
+ unless ejectVolume(device_root)
14
+ raise Device::CantEject, "端末を取り外せませんでした"
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ FSCTL_LOCK_VOLUME = 0x00090018
21
+ FSCTL_DISMOUNT_VOLUME = 0x00090020
22
+ IOCTL_STORAGE_MEDIA_REMOVAL = 0x002d4804
23
+ IOCTL_STORAGE_EJECT_MEDIA = 0x002d4808
24
+ FILE_SHARE_READ = 0x00000001
25
+ FILE_SHARE_WRITE = 0x00000002
26
+ OPEN_EXISTING = 3
27
+ INVALID_HANDLE_VALUE = -1
28
+ GENERIC_READ = 0x80000000
29
+ GENERIC_WRITE = 0x40000000
30
+ DRIVE_REMOVABLE = 2
31
+ DRIVE_CDROM = 5
32
+ NULL = 0
33
+ WIN_FALSE = 0
34
+ LOCK_TIMEOUT = 3.0 # Seconds
35
+ LOCK_RETRIES = 20
36
+
37
+ def openVolume(cDriveLetter)
38
+ szVolumeFormat = "\\\\.\\%s:"
39
+ szRootFormat = "%s:\\"
40
+
41
+ szRootName = szRootFormat % cDriveLetter
42
+
43
+ uDriveType = WinAPI.GetDriveType(szRootName)
44
+ case uDriveType
45
+ when DRIVE_REMOVABLE
46
+ dwAccessFlags = GENERIC_READ | GENERIC_WRITE
47
+ when DRIVE_CDROM
48
+ dwAccessFlags = GENERIC_READ
49
+ else
50
+ return INVALID_HANDLE_VALUE
51
+ end
52
+
53
+ szVolumeName = szVolumeFormat % cDriveLetter
54
+
55
+ hVolume = WinAPI.CreateFile(
56
+ szVolumeName,
57
+ dwAccessFlags,
58
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
59
+ NULL,
60
+ OPEN_EXISTING,
61
+ 0,
62
+ NULL
63
+ )
64
+ hVolume
65
+ end
66
+
67
+ def lockVolume(hVolume)
68
+ dwSleepAmount = LOCK_TIMEOUT / LOCK_RETRIES
69
+ dwBytesReturned = " ".dup
70
+
71
+ # Do this in a loop until a timeout period has expired
72
+ LOCK_RETRIES.times do
73
+ res = WinAPI.DeviceIoControl(
74
+ hVolume,
75
+ FSCTL_LOCK_VOLUME,
76
+ NULL, 0,
77
+ NULL, 0,
78
+ dwBytesReturned,
79
+ NULL
80
+ )
81
+ return true if res != 0
82
+ sleep(dwSleepAmount)
83
+ end
84
+ raise Device::CantEject, "端末が使用中なため取り外せませんでした"
85
+ end
86
+
87
+ def dismountVolume(hVolume)
88
+ dwBytesReturned = " ".dup
89
+ WinAPI.DeviceIoControl(
90
+ hVolume,
91
+ FSCTL_DISMOUNT_VOLUME,
92
+ NULL, 0,
93
+ NULL, 0,
94
+ dwBytesReturned,
95
+ NULL
96
+ ) != 0
97
+ end
98
+
99
+ def preventRemovalOfVolume(hVolume, fPreventRemoval)
100
+ dwBytesReturned = " ".dup
101
+ WinAPI.DeviceIoControl(
102
+ hVolume,
103
+ IOCTL_STORAGE_MEDIA_REMOVAL,
104
+ [fPreventRemoval.to_s].pack("b"), 1,
105
+ NULL, 0,
106
+ dwBytesReturned,
107
+ NULL
108
+ ) != 0
109
+ end
110
+
111
+ def autoEjectVolume(hVolume)
112
+ dwBytesReturned = " ".dup
113
+ WinAPI.DeviceIoControl(
114
+ hVolume,
115
+ IOCTL_STORAGE_EJECT_MEDIA,
116
+ NULL, 0,
117
+ NULL, 0,
118
+ dwBytesReturned,
119
+ NULL
120
+ ) != 0
121
+ end
122
+
123
+ def ejectVolume(cDriveLetter)
124
+ fRemoveSafely = false
125
+ fAutoEject = false
126
+ hVolume = INVALID_HANDLE_VALUE
127
+
128
+ cDriveLetter = cDriveLetter[0]
129
+ unless cDriveLetter
130
+ raise Device::CantEject, "need a drive letter"
131
+ end
132
+
133
+ # Open the volume.
134
+ hVolume = openVolume(cDriveLetter)
135
+ if hVolume == INVALID_HANDLE_VALUE
136
+ raise Device::CantEject, "Cannot eject. Drive type is incorrect."
137
+ end
138
+
139
+ # Lock and dismount the volume.
140
+ if lockVolume(hVolume) && dismountVolume(hVolume)
141
+ fRemoveSafely = true
142
+
143
+ # Set prevent removal to false and eject the volume.
144
+ if preventRemovalOfVolume(hVolume, WIN_FALSE) && autoEjectVolume(hVolume)
145
+ fAutoEject = true
146
+ end
147
+ end
148
+
149
+ if fAutoEject
150
+ # puts "Media in Drive %s has been ejected safely." % cDriveLetter
151
+ elsif fRemoveSafely
152
+ # puts "Media in Drive %s can be safely removed." % cDriveLetter
153
+ else
154
+ return false
155
+ end
156
+
157
+ true
158
+ ensure
159
+ if hVolume != INVALID_HANDLE_VALUE
160
+ # Close the volume so other processes can use the drive.
161
+ WinAPI.CloseHandle(hVolume)
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
@@ -24,6 +24,10 @@ module WinAPI
24
24
  extern "unsigned long GetStdHandle(unsigned long)"
25
25
  extern "long GetLastError()"
26
26
  extern "unsigned long _getch()"
27
+ extern "unsigned long GetDriveType(void*)"
28
+ extern "unsigned long DeviceIoControl(unsigned long, unsigned long, void*, unsigned long, void*, unsigned long, void*, void*)"
29
+ extern "unsigned long CreateFile(void*, unsigned long, unsigned long, void*, unsigned long, unsigned long, unsigned long)"
30
+ extern "unsigned long CloseHandle(unsigned long)"
27
31
  end
28
32
 
29
33
  require "tmpdir"
data/lib/narou.rb CHANGED
@@ -295,5 +295,11 @@ module Narou
295
295
  end
296
296
  memoize :commit_version
297
297
 
298
+ def kindlegen_path
299
+ postfix = Helper.os_windows? ? ".exe" : ""
300
+ File.join(File.dirname(Narou.get_aozoraepub3_path), "kindlegen#{postfix}")
301
+ end
302
+ memoize :kindlegen_path
303
+
298
304
  end
299
305
  end
@@ -230,8 +230,8 @@ class NovelConverter
230
230
  # 返り値:正常終了 :success、エラー終了 :error、中断終了 :abort
231
231
  #
232
232
  def self.epub_to_mobi(epub_path, verbose = false)
233
- kindlegen_path = File.join(File.dirname(Narou.get_aozoraepub3_path), "kindlegen")
234
- if Dir.glob(kindlegen_path + "*").empty?
233
+ kindlegen_path = Narou.kindlegen_path
234
+ unless File.exist?(kindlegen_path)
235
235
  error "kindlegenが見つかりませんでした。AozoraEpub3と同じディレクトリにインストールして下さい"
236
236
  return :error
237
237
  end
data/lib/version.rb CHANGED
@@ -3,4 +3,4 @@
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
5
 
6
- Version = "2.9.4"
6
+ Version = "2.9.5"
data/lib/web/appserver.rb CHANGED
@@ -797,8 +797,18 @@ class Narou::AppServer < Sinatra::Base
797
797
  end
798
798
 
799
799
  post "/api/eject" do
800
- device = Narou.get_device
801
- device.eject if device
800
+ do_eject = proc do
801
+ device = Narou.get_device
802
+ device.eject if device
803
+ puts "<bold><green>端末を取り外しました</green></bold>".termcolor
804
+ end
805
+ if params["enqueue"] == "true"
806
+ Narou::Worker.push do
807
+ do_eject.call
808
+ end
809
+ else
810
+ do_eject.call
811
+ end
802
812
  ""
803
813
  end
804
814
 
@@ -788,9 +788,12 @@ var Narou = (function() {
788
788
  },
789
789
 
790
790
  eject: function() {
791
- $.post("/api/eject");
791
+ $.post("/api/eject", { enqueue: true });
792
792
  },
793
793
 
794
+ ejectNow: function() {
795
+ $.post("/api/eject", { enqueue: false });
796
+ },
794
797
  });
795
798
 
796
799
  /*************************************************************************
@@ -456,9 +456,9 @@ $(document).ready(function() {
456
456
  */
457
457
  notification.on("device.ejectable", function(ejectable) {
458
458
  if (ejectable)
459
- $(".button-eject").removeClass("hide");
459
+ $(".eject-group").removeClass("hide");
460
460
  else
461
- $(".button-eject").addClass("hide");
461
+ $(".eject-group").addClass("hide");
462
462
  });
463
463
 
464
464
  /*************************************************************
@@ -1288,6 +1288,15 @@ $(document).ready(function() {
1288
1288
  action.eject();
1289
1289
  });
1290
1290
 
1291
+ /*
1292
+ * ボタン
1293
+ * Eject > 今すぐ端末を取り出す
1294
+ */
1295
+ $(".button-eject-now").on("click", function(e) {
1296
+ e.preventDefault();
1297
+ action.ejectNow();
1298
+ });
1299
+
1291
1300
  /*
1292
1301
  * アイコン
1293
1302
  * ○件表示の横のリロードアイコン
@@ -265,9 +265,15 @@
265
265
  %a.button-backup(href="#") 選択した小説のバックアップを作成
266
266
  %li
267
267
  %a.button-setting-burn(href="#") 選択した小説の設定の未設定項目に共通設定を焼付ける
268
- .btn-group
269
- %button.button-eject.hide.btn.btn-default(type="button" data-toggle="tooltip" title="端末を取り出す")
268
+ .btn-group.eject-group.hide
269
+ %button.button-eject.btn.btn-default(type="button" data-toggle="tooltip" title="端末を取り出す")
270
270
  Eject
271
+ %button.btn.btn-default.dropdown-toggle(type="button" data-toggle="dropdown")
272
+ %span.caret
273
+ %span.sr-only Toggle Dropdown
274
+ %ul.dropdown-menu(role="menu")
275
+ %li
276
+ %a.button-eject-now(href="#") 今すぐ端末を取り出す
271
277
 
272
278
  -# 小説の一覧テーブル
273
279
  %div
data/narou.gemspec CHANGED
@@ -32,45 +32,17 @@ Gem::Specification.new do |gem|
32
32
  install_message = <<-EOS
33
33
  #{"*" * 60}
34
34
 
35
- 2.9.4 : 2016/06/16
35
+ 2.9.5 : 2016/07/01
36
36
  ------------------
37
37
  #### 仕様変更
38
- - `download.interval` のデフォルト値を0.7秒に変更しました(下限は0秒のまま)
38
+ - WEB UI の Eject ボタンを押した際に、即時取り出しではなく一旦キューに積む様に
39
+ 変更しました。これにより変換が終了したら取り外すということが可能になります
40
+ + すぐに取り外したい場合は Eject ボタン横のドロップダウンメニューから可能です
41
+ - Windows でも Eject ボタンに対応しました
39
42
 
40
- #### 修正
41
- - `update --gl` コマンド(最新話掲載日を更新)で update.interval が反映されて
42
- いなかったのを修正
43
-
44
-
45
- 2.9.3.1 : 2016/06/15
46
- --------------------
47
- #### 修正
48
- - 凍結済みでも待機時間が発生してしまっていたのを修正
49
-
50
-
51
- 2.9.3 : 2016/06/15
52
- ------------------
53
- #### WEB UI
54
- - 小説URLもFilterで検索出来るようにしました
55
- + NコードがURLに含まれている為、Nコード検索としても使えます
56
- - ダイジェスト化を検知した際にでる選択肢に、「8. 変換する」を追加しました
57
-
58
- #### 仕様変更
59
- - `enable_dakuten_font` を復活させました
60
- + AozoraEpub3の一文字濁点フォント機能を使った場合、端末でフォントを切り替えた
61
- 場合に濁点にならない問題があったため、切り替えた場合でも機能するNarou.rbの
62
- 濁点フォントを再び使えるようにしました
63
- + setting.ini で enable_dakuten_font = true とすることで有効になり、false の
64
- 場合は AozoraEPub3 の一文字濁点フォント機能を使用します。
65
- (デフォルトでは false で、 AozoraEpub3 の機能を使います)
66
- - 更新時に1作品ごとに待機時間が入るようになりました
67
- + `update.interval` で待機秒数を指定出来ます(ただし、最低2.5秒必要です)
68
- + 更新処理の時間も含まれるので、例えば更新処理に1秒かかった場合は待機時間は
69
- 1.5秒です。2.5秒以上更新や変換にかかった場合は待機時間は発生しません
70
-
71
- #### 修正
72
- - i文庫に変換時にカクヨムのサブチャプターが反映されていなかったのを修正
73
- - WEB UIのタグを編集ダイアログ内でタグをソートしていなかったのを修正
43
+ #### 修正内容
44
+ - Windows 環境において、kindlegen を実行時に何も実行されず mobi ファイルが作成
45
+ 出来ない場合がある
74
46
 
75
47
  #{"*" * 60}
76
48
  EOS
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narou
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.4
4
+ version: 2.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - whiteleaf7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-16 00:00:00.000000000 Z
11
+ date: 2016-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: termcolorlight
@@ -283,6 +283,7 @@ files:
283
283
  - README.md
284
284
  - Rakefile
285
285
  - bin/narou
286
+ - circle.yml
286
287
  - commitversion
287
288
  - lib/color.rb
288
289
  - lib/command.rb
@@ -321,6 +322,7 @@ files:
321
322
  - lib/device/library/linux.rb
322
323
  - lib/device/library/mac.rb
323
324
  - lib/device/library/windows.rb
325
+ - lib/device/library/windows/eject.rb
324
326
  - lib/device/reader.rb
325
327
  - lib/diffviewer.rb
326
328
  - lib/downloader.rb
@@ -540,45 +542,17 @@ metadata: {}
540
542
  post_install_message: |
541
543
  ************************************************************
542
544
 
543
- 2.9.4 : 2016/06/16
545
+ 2.9.5 : 2016/07/01
544
546
  ------------------
545
547
  #### 仕様変更
546
- - `download.interval` のデフォルト値を0.7秒に変更しました(下限は0秒のまま)
548
+ - WEB UI の Eject ボタンを押した際に、即時取り出しではなく一旦キューに積む様に
549
+ 変更しました。これにより変換が終了したら取り外すということが可能になります
550
+ + すぐに取り外したい場合は Eject ボタン横のドロップダウンメニューから可能です
551
+ - Windows でも Eject ボタンに対応しました
547
552
 
548
- #### 修正
549
- - `update --gl` コマンド(最新話掲載日を更新)で update.interval が反映されて
550
- いなかったのを修正
551
-
552
-
553
- 2.9.3.1 : 2016/06/15
554
- --------------------
555
- #### 修正
556
- - 凍結済みでも待機時間が発生してしまっていたのを修正
557
-
558
-
559
- 2.9.3 : 2016/06/15
560
- ------------------
561
- #### WEB UI
562
- - 小説URLもFilterで検索出来るようにしました
563
- + NコードがURLに含まれている為、Nコード検索としても使えます
564
- - ダイジェスト化を検知した際にでる選択肢に、「8. 変換する」を追加しました
565
-
566
- #### 仕様変更
567
- - `enable_dakuten_font` を復活させました
568
- + AozoraEpub3の一文字濁点フォント機能を使った場合、端末でフォントを切り替えた
569
- 場合に濁点にならない問題があったため、切り替えた場合でも機能するNarou.rbの
570
- 濁点フォントを再び使えるようにしました
571
- + setting.ini で enable_dakuten_font = true とすることで有効になり、false の
572
- 場合は AozoraEPub3 の一文字濁点フォント機能を使用します。
573
- (デフォルトでは false で、 AozoraEpub3 の機能を使います)
574
- - 更新時に1作品ごとに待機時間が入るようになりました
575
- + `update.interval` で待機秒数を指定出来ます(ただし、最低2.5秒必要です)
576
- + 更新処理の時間も含まれるので、例えば更新処理に1秒かかった場合は待機時間は
577
- 1.5秒です。2.5秒以上更新や変換にかかった場合は待機時間は発生しません
578
-
579
- #### 修正
580
- - i文庫に変換時にカクヨムのサブチャプターが反映されていなかったのを修正
581
- - WEB UIのタグを編集ダイアログ内でタグをソートしていなかったのを修正
553
+ #### 修正内容
554
+ - Windows 環境において、kindlegen を実行時に何も実行されず mobi ファイルが作成
555
+ 出来ない場合がある
582
556
 
583
557
  ************************************************************
584
558
  rdoc_options: []