annyong 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/assets/css/annyong.css +36 -8
- data/bin/annyong +2 -0
- data/lib/annyong.rb +1 -1
- data/lib/annyong/directory.rb +21 -5
- metadata +37 -58
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a9f216f6d92c3fe1ff12e41767018d6ae2ed479a
|
4
|
+
data.tar.gz: 66fd2e87bf770c909cfe13938effc475e40cd94a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 996da1b0a268c5f47f29957231213c92cbb073da467d1d2e14910481670d7face86a2a983f5389414dc940c2df53bfee4e6d57931a5166069d5769a9c1ec5a40
|
7
|
+
data.tar.gz: 8462df3036e33212feab7fdce62303b99aad383c7636c76d33472d6849b6b156459c6fe9150438efd4120aba4230b04338f3ac3950fe2b29438aca9ccefd4c54
|
data/assets/css/annyong.css
CHANGED
@@ -4,7 +4,9 @@ table { width:100%; }
|
|
4
4
|
.type { width:11em; }
|
5
5
|
.mtime { width:15em; }
|
6
6
|
|
7
|
-
|
7
|
+
/*===============================================================
|
8
|
+
Basic
|
9
|
+
===============================================================*/
|
8
10
|
|
9
11
|
* {
|
10
12
|
padding: 0;
|
@@ -37,9 +39,9 @@ h1 {
|
|
37
39
|
font-size: 150%;
|
38
40
|
}
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
42
|
+
/*===============================================================
|
43
|
+
Tables
|
44
|
+
===============================================================*/
|
43
45
|
|
44
46
|
table {
|
45
47
|
border-collapse: collapse;
|
@@ -71,6 +73,15 @@ table th {
|
|
71
73
|
color: #888;
|
72
74
|
}
|
73
75
|
|
76
|
+
table td.name {
|
77
|
+
padding: 0;
|
78
|
+
}
|
79
|
+
|
80
|
+
table td.name a {
|
81
|
+
display: block;
|
82
|
+
padding: 6px 8px;
|
83
|
+
}
|
84
|
+
|
74
85
|
table tr:hover {
|
75
86
|
background: rgba(255,255,0,0.1);
|
76
87
|
}
|
@@ -78,9 +89,9 @@ table tr:hover {
|
|
78
89
|
table td.name {
|
79
90
|
}
|
80
91
|
|
81
|
-
|
82
|
-
|
83
|
-
|
92
|
+
/*===============================================================
|
93
|
+
Footer
|
94
|
+
===============================================================*/
|
84
95
|
|
85
96
|
footer {
|
86
97
|
padding: 16px 2px 6px;
|
@@ -93,4 +104,21 @@ footer a {
|
|
93
104
|
color: #aaa;
|
94
105
|
}
|
95
106
|
|
96
|
-
|
107
|
+
/*===============================================================
|
108
|
+
Mobile
|
109
|
+
===============================================================*/
|
110
|
+
|
111
|
+
@media only screen and (max-width : 520px) {
|
112
|
+
body {
|
113
|
+
padding: 15px;
|
114
|
+
font-size: 165%;
|
115
|
+
}
|
116
|
+
|
117
|
+
table td.name a {
|
118
|
+
padding: 10px 12px;
|
119
|
+
}
|
120
|
+
|
121
|
+
table td.type, table th.type, table td.size, table th.size, table td.mtime, table th.mtime {
|
122
|
+
display: none;
|
123
|
+
}
|
124
|
+
}
|
data/bin/annyong
CHANGED
@@ -32,6 +32,8 @@ Options:
|
|
32
32
|
end
|
33
33
|
opts.parse!
|
34
34
|
|
35
|
+
STDOUT.puts "Now serving files in #{FileUtils.pwd.chomp} on http://#{options[:host]}:#{options[:port]}. Annyong!"
|
36
|
+
|
35
37
|
Rack::Server.start({
|
36
38
|
:config => File.join(File.dirname(__FILE__), "../assets/rack/config.ru"),
|
37
39
|
:Port => options[:port],
|
data/lib/annyong.rb
CHANGED
data/lib/annyong/directory.rb
CHANGED
@@ -6,6 +6,7 @@ module Annyong
|
|
6
6
|
<html><head>
|
7
7
|
<title>%s</title>
|
8
8
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
9
|
+
<meta name="viewport" content="width=device-width" />
|
9
10
|
<style type="text/css">
|
10
11
|
#{File.read(File.join(File.dirname(__FILE__), "../../assets/css/annyong.css")).gsub(/%/, "%%")}
|
11
12
|
</style>
|
@@ -20,16 +21,31 @@ module Annyong
|
|
20
21
|
</tr>
|
21
22
|
%s
|
22
23
|
</table>
|
23
|
-
<footer><code>#{FileUtils.pwd.chomp}</code>, <a target='_blank' title='Powered by annyong' href='https://github.com/remiprev/annyong'>annyong</a>!</footer
|
24
|
+
<footer><code>#{FileUtils.pwd.chomp}</code>, <a target='_blank' title='Powered by annyong' href='https://github.com/remiprev/annyong'>annyong</a>!</footer>
|
24
25
|
</body></html>
|
25
26
|
PAGE
|
26
27
|
|
27
28
|
def each
|
28
|
-
|
29
|
-
|
30
|
-
page = DIR_PAGE % [ show_path, show_path , files ]
|
31
|
-
page.each_line{|l| yield l }
|
29
|
+
page = DIR_PAGE % [html_title, page_title, files]
|
30
|
+
page.each_line { |content| yield content }
|
32
31
|
end
|
33
32
|
|
33
|
+
private
|
34
|
+
|
35
|
+
def html_title
|
36
|
+
path = @path.sub(/^#{@root}/,'').gsub(/\/$/, '')
|
37
|
+
File.basename(FileUtils.pwd) + path
|
38
|
+
end
|
39
|
+
|
40
|
+
def page_title
|
41
|
+
parts = html_title.split('/')
|
42
|
+
parts.each_with_index.map do |item, index|
|
43
|
+
"<a href='#{'../' * (parts.length - index - 1)}'>#{item}</a>"
|
44
|
+
end.join(' / ')
|
45
|
+
end
|
46
|
+
|
47
|
+
def files
|
48
|
+
@files.map { |file| DIR_FILE % file } * "\n"
|
49
|
+
end
|
34
50
|
end
|
35
51
|
end
|
metadata
CHANGED
@@ -1,47 +1,37 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: annyong
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
version: "0.3"
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.4'
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
-
|
6
|
+
authors:
|
7
|
+
- Rémi Prévost
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-10-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: rack
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 19
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 1
|
32
|
-
- 0
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
33
19
|
version: 1.1.0
|
34
20
|
type: :runtime
|
35
|
-
|
36
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.0
|
27
|
+
description: Annyong starts a public static Web server in the current directory, allowing
|
28
|
+
people in your local network to browse your files.
|
37
29
|
email: remi@exomel.com
|
38
|
-
executables:
|
30
|
+
executables:
|
39
31
|
- annyong
|
40
32
|
extensions: []
|
41
|
-
|
42
33
|
extra_rdoc_files: []
|
43
|
-
|
44
|
-
files:
|
34
|
+
files:
|
45
35
|
- lib/annyong/directory.rb
|
46
36
|
- lib/annyong.rb
|
47
37
|
- README.mkd
|
@@ -49,39 +39,28 @@ files:
|
|
49
39
|
- bin/annyong
|
50
40
|
- assets/css/annyong.css
|
51
41
|
- assets/rack/config.ru
|
52
|
-
has_rdoc: true
|
53
42
|
homepage: http://github.com/remiprev/annyong
|
54
43
|
licenses: []
|
55
|
-
|
44
|
+
metadata: {}
|
56
45
|
post_install_message:
|
57
46
|
rdoc_options: []
|
58
|
-
|
59
|
-
require_paths:
|
47
|
+
require_paths:
|
60
48
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
none: false
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
hash: 3
|
76
|
-
segments:
|
77
|
-
- 0
|
78
|
-
version: "0"
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
79
59
|
requirements: []
|
80
|
-
|
81
60
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 2.1.0
|
83
62
|
signing_key:
|
84
|
-
specification_version:
|
63
|
+
specification_version: 4
|
85
64
|
summary: Start a public static Web server in the current directory.
|
86
65
|
test_files: []
|
87
|
-
|
66
|
+
has_rdoc:
|