komicless 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/bin/komicless +12 -6
- data/lib/komicless/server.rb +14 -0
- data/lib/komicless/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ac86593ab60fff6839423930dd834b70c81304c
|
4
|
+
data.tar.gz: a6db122a747f1a5dcd49e0b6bf5e1d66abb06b33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efcee235a45d9cb8bb6d227cc85b484dd9de00bcc8b86596d65cacfaff6066a6df633c50bda03c93708b529695fe7226d17f2aec961aef0115c3052b541f96a1
|
7
|
+
data.tar.gz: fd62b69957cec3f92d0b1ab0cc1ce37d294cabe3ebf3cb1f1996a69d6abcec363188a30b4470b371f9696504aa5f2bc24f81bbb2691528a9c09550ffc58c8263
|
data/README.md
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
Komicless is an (alternative) server for [ComicGlass](http://comicglass.net/).
|
4
4
|
They already provides a Win server, a Mac server, and a PHP version.
|
5
5
|
|
6
|
-
This work should work with recent Ruby, without requiring root privilege and
|
6
|
+
This work should work with recent Ruby, without requiring root privilege and a standalone web server.
|
7
7
|
|
8
8
|
# Limitations
|
9
9
|
|
10
|
-
- Unlike offical servers, Komicless only hosts one directory (not really a problem
|
10
|
+
- Unlike offical servers, Komicless only hosts one directory (not really a problem as it handles symlink of dirs).
|
11
11
|
- uPnP is not supported yet.
|
12
12
|
|
13
13
|
## Installation
|
data/bin/komicless
CHANGED
@@ -10,18 +10,24 @@ require 'rack'
|
|
10
10
|
# --port (optional)
|
11
11
|
# --extension ?
|
12
12
|
|
13
|
-
handler_options = {}
|
14
|
-
root
|
13
|
+
handler_options = { :Port => 10080 }
|
14
|
+
app_options = { :root => "." }
|
15
|
+
|
15
16
|
OptionParser.new do |parser|
|
16
17
|
parser.on "-p", "--port PORT" do |port|
|
17
18
|
handler_options[ :Port ] = port.to_i
|
18
19
|
end
|
19
20
|
parser.on "-r", "--root ROOT_DIR" do |root_dir|
|
20
|
-
root = root_dir
|
21
|
+
app_options[ :root ] = root_dir
|
21
22
|
end
|
22
23
|
end.parse!
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
puts "Server port:\t#{handler_options[:Port]}"
|
26
|
+
Komicless.each_nic do |count,ipaddr|
|
27
|
+
puts "Server IP (#{count}):\t#{ipaddr}"
|
28
|
+
end
|
29
|
+
puts "Root directory:\t#{File.absolute_path app_options[:root] }"
|
26
30
|
|
27
|
-
|
31
|
+
app = Komicless::Server.create app_options
|
32
|
+
handler = Rack::Handler.pick %w/ thin webrick /
|
33
|
+
handler.run app, handler_options
|
data/lib/komicless/server.rb
CHANGED
@@ -1,13 +1,27 @@
|
|
1
1
|
require 'rack'
|
2
2
|
require 'erb'
|
3
|
+
require 'socket'
|
3
4
|
|
4
5
|
module Komicless
|
5
6
|
|
6
7
|
INDEX_ERB = open( File.expand_path "index.html.erb", File.dirname(__FILE__) ).read.freeze
|
7
8
|
INDEX = ::ERB.new INDEX_ERB
|
8
9
|
|
10
|
+
def self.each_nic
|
11
|
+
# enumerate IPaddr of NICs
|
12
|
+
count = 0
|
13
|
+
Socket::getaddrinfo(Socket.gethostname,"http", nil, :STREAM).each do |family, port, hostname, ip, *_|
|
14
|
+
count+=1
|
15
|
+
yield count, ip[/^[^%]*/]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
9
19
|
class Server < ::Rack::Directory
|
10
20
|
|
21
|
+
def self.create app_options
|
22
|
+
self.new( app_options[:root] )
|
23
|
+
end
|
24
|
+
|
11
25
|
# remove first entry
|
12
26
|
def list_directory
|
13
27
|
ret = super
|
data/lib/komicless/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: komicless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wang Guan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|