w3m-autopagerize 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/w3m-autopagerize-server +44 -0
- data/{bin → lib}/w3m-autopagerize-server.rb +1 -46
- data/readme.html +1 -1
- data/test/test-w3m-autopagerize.rb +1 -1
- metadata +7 -5
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/local/bin/ruby19
|
2
|
+
# -*- mode: ruby;coding: utf-8 -*-
|
3
|
+
require 'w3m-autopagerize-server'
|
4
|
+
require 'optparse'
|
5
|
+
require 'drb'
|
6
|
+
conf = Struct.new(:log_file, :siteinfo_url, :config_file).new
|
7
|
+
conf.config_file = File.expand_path "~/.w3m-autopagerize.rb"
|
8
|
+
ARGV.options {|o|
|
9
|
+
o.on("-l", "--log LOGFILE",
|
10
|
+
"Use log file.") {|x| conf.log_file = File.expand_path(x, File.dirname(__FILE__)) }
|
11
|
+
o.on("-s", "--siteinfo URL",
|
12
|
+
"URL of JSON data (SITEINFO).") {|x| conf.siteinfo_url = x}
|
13
|
+
o.on("-c", "--config CONFIG", "Use config file.") {|x| conf.config_file = x }
|
14
|
+
o.on("-f", "Ignore config file.") {|x| conf.config_file = :ignore }
|
15
|
+
o.on("-r", "--restart", "--reload",
|
16
|
+
"Restart the server.") {|x|
|
17
|
+
DRbObject.new_with_uri(%q!druby://:9322!).restart rescue nil
|
18
|
+
puts "w3m-autopagerize-server restarted."
|
19
|
+
exit
|
20
|
+
}
|
21
|
+
o.parse!
|
22
|
+
}
|
23
|
+
|
24
|
+
srv = Server.new
|
25
|
+
srv.load_config_file(conf.config_file)
|
26
|
+
$LOG_FILE = conf.log_file || $LOG_FILE
|
27
|
+
$stderr.puts "startup: log file = #{$LOG_FILE.inspect}"
|
28
|
+
$logger = Logger.new($LOG_FILE)
|
29
|
+
$SITEINFO_IMPORT_URLS = [ conf.siteinfo_url ] if conf.siteinfo_url
|
30
|
+
$logger.info "$SITEINFO_IMPORT_URLS = #{$SITEINFO_IMPORT_URLS.inspect}"
|
31
|
+
|
32
|
+
srv.load_siteinfo
|
33
|
+
GC.start
|
34
|
+
SiteData.fallbacks.setup!
|
35
|
+
|
36
|
+
$stderr.puts "start w3m-autopagerize-server.rb (#{Time.now-$start_time} secs)"
|
37
|
+
|
38
|
+
Thread.start do
|
39
|
+
loop { sleep 300; GC.start }
|
40
|
+
end
|
41
|
+
|
42
|
+
DRb.start_service("druby://:9322", srv)
|
43
|
+
DRb.thread.join
|
44
|
+
|
@@ -1,8 +1,7 @@
|
|
1
|
-
#!/usr/local/bin/ruby19
|
2
1
|
# -*- coding: utf-8 -*-
|
3
2
|
# (executable-interpret "ruby19 /m/home/rubikitch/w3m/cgi-bin/w3m-autopagerize/test-w3m-autopagerize.rb --no-use-color ")
|
4
3
|
# (executable-interpret "rm -f /log/w3m-autopagerize.log; w3m-autopagerize-server.rb -r")
|
5
|
-
start_time = Time.now
|
4
|
+
$start_time = Time.now
|
6
5
|
#Encoding.default_internal = "UTF-8"
|
7
6
|
require 'kconv'
|
8
7
|
require 'uri'
|
@@ -443,47 +442,3 @@ src_encoding=#{Kconv.guess(src || $content_cache[url].first)}
|
|
443
442
|
$stderr.puts "load_config_file: error loading #{config_file}!"
|
444
443
|
end
|
445
444
|
end
|
446
|
-
|
447
|
-
|
448
|
-
if __FILE__==$0
|
449
|
-
require 'optparse'
|
450
|
-
require 'drb'
|
451
|
-
conf = Struct.new(:log_file, :siteinfo_url, :config_file).new
|
452
|
-
conf.config_file = File.expand_path "~/.w3m-autopagerize.rb"
|
453
|
-
ARGV.options {|o|
|
454
|
-
o.on("-l", "--log LOGFILE",
|
455
|
-
"Use log file.") {|x| conf.log_file = File.expand_path(x, File.dirname(__FILE__)) }
|
456
|
-
o.on("-s", "--siteinfo URL",
|
457
|
-
"URL of JSON data (SITEINFO).") {|x| conf.siteinfo_url = x}
|
458
|
-
o.on("-c", "--config CONFIG", "Use config file.") {|x| conf.config_file = x }
|
459
|
-
o.on("-f", "Ignore config file.") {|x| conf.config_file = :ignore }
|
460
|
-
o.on("-r", "--restart", "--reload",
|
461
|
-
"Restart the server.") {|x|
|
462
|
-
DRbObject.new_with_uri(%q!druby://:9322!).restart rescue nil
|
463
|
-
puts "w3m-autopagerize-server restarted."
|
464
|
-
exit
|
465
|
-
}
|
466
|
-
o.parse!
|
467
|
-
}
|
468
|
-
|
469
|
-
srv = Server.new
|
470
|
-
srv.load_config_file(conf.config_file)
|
471
|
-
$LOG_FILE = conf.log_file || $LOG_FILE
|
472
|
-
$stderr.puts "startup: log file = #{$LOG_FILE.inspect}"
|
473
|
-
$logger = Logger.new($LOG_FILE)
|
474
|
-
$SITEINFO_IMPORT_URLS = [ conf.siteinfo_url ] if conf.siteinfo_url
|
475
|
-
$logger.info "$SITEINFO_IMPORT_URLS = #{$SITEINFO_IMPORT_URLS.inspect}"
|
476
|
-
|
477
|
-
srv.load_siteinfo
|
478
|
-
GC.start
|
479
|
-
SiteData.fallbacks.setup!
|
480
|
-
|
481
|
-
$stderr.puts "start w3m-autopagerize-server.rb (#{Time.now-start_time} secs)"
|
482
|
-
|
483
|
-
Thread.start do
|
484
|
-
loop { sleep 300; GC.start }
|
485
|
-
end
|
486
|
-
|
487
|
-
DRb.start_service("druby://:9322", srv)
|
488
|
-
DRb.thread.join
|
489
|
-
end
|
data/readme.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
lang="en" xml:lang="en">
|
5
5
|
<head>
|
6
6
|
<title>AutoPagerize for w3m</title>
|
7
|
-
<meta http-equiv="Content-Type" content="text/html;charset=
|
7
|
+
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
8
8
|
<meta name="generator" content="Org-mode"/>
|
9
9
|
<meta name="generated" content="2009-01-30"/>
|
10
10
|
<meta name="author" content="rubikitch"/>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/local/bin/ruby19
|
2
2
|
# -*- coding: utf-8 -*-
|
3
|
-
# (executable-interpret "ruby19
|
3
|
+
# (executable-interpret "ruby19 -I../lib test-w3m-autopagerize.rb --no-use-color ")
|
4
4
|
require 'fileutils'
|
5
5
|
FileUtils.rm_f "test.log"
|
6
6
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: w3m-autopagerize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rubikitch
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
26
|
+
name: json_pure
|
27
27
|
type: :runtime
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -34,8 +34,9 @@ dependencies:
|
|
34
34
|
version:
|
35
35
|
description: AutoPagerize for w3m
|
36
36
|
email: rubikitch@ruby-lang.org
|
37
|
-
executables:
|
38
|
-
|
37
|
+
executables:
|
38
|
+
- w3m-autopagerize-server
|
39
|
+
- next.cgi
|
39
40
|
extensions: []
|
40
41
|
|
41
42
|
extra_rdoc_files: []
|
@@ -44,8 +45,9 @@ files:
|
|
44
45
|
- readme.org
|
45
46
|
- readme.html
|
46
47
|
- config.sample.rb
|
47
|
-
- bin/w3m-autopagerize-server
|
48
|
+
- bin/w3m-autopagerize-server
|
48
49
|
- bin/next.cgi
|
50
|
+
- lib/w3m-autopagerize-server.rb
|
49
51
|
- test/test-w3m-autopagerize.rb
|
50
52
|
has_rdoc: false
|
51
53
|
homepage: http://www.rubyist.net/~rubikitch/
|