servel 0.7.0 → 0.8.0
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/.gitignore +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/servel.rb +0 -0
- data/lib/servel/app.rb +2 -0
- data/lib/servel/cli.rb +0 -0
- data/lib/servel/haml_context.rb +0 -0
- data/lib/servel/home_app.rb +0 -0
- data/lib/servel/locals.rb +1 -1
- data/lib/servel/path.rb +37 -37
- data/lib/servel/path_builder.rb +73 -73
- data/lib/servel/templates/_gallery.haml +0 -0
- data/lib/servel/templates/_listing.haml +0 -0
- data/lib/servel/templates/common.css +0 -0
- data/lib/servel/templates/gallery.css +0 -0
- data/lib/servel/templates/gallery.js +1 -1
- data/lib/servel/templates/home.css +0 -0
- data/lib/servel/templates/home.haml +0 -0
- data/lib/servel/templates/index.css +0 -0
- data/lib/servel/templates/index.haml +0 -0
- data/lib/servel/templates/listing.css +0 -0
- data/lib/servel/templates/normalize.css +0 -0
- data/lib/servel/version.rb +1 -1
- data/servel.gemspec +0 -0
- 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: 110f9b74c9c900dfe2febfde8eb58d671831b549
|
4
|
+
data.tar.gz: 0e2acd5f66b547f9ccfb53d52896ba3c3ce4184b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1d8a384505b7b707e484adbb3e5238ebce1eca1c0e451839a6ad99751521799216e4b65e8ba5bfbf5a12c883a8e9b30e6c66366251eacfe39ae1f3fbe2ac554
|
7
|
+
data.tar.gz: 95a5fb8d8ae8e43642a70291bba5b2c2c9e231c81c1cc4e044857efb8333fafabbb59e5b84e7e47d4417452c27770938f749e9c2d408a6723b572d143d1a8cc6
|
data/.gitignore
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/lib/servel.rb
CHANGED
File without changes
|
data/lib/servel/app.rb
CHANGED
data/lib/servel/cli.rb
CHANGED
File without changes
|
data/lib/servel/haml_context.rb
CHANGED
File without changes
|
data/lib/servel/home_app.rb
CHANGED
File without changes
|
data/lib/servel/locals.rb
CHANGED
data/lib/servel/path.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
class Servel::Path
|
2
|
-
attr_reader :type, :media_type, :listing_classes, :icon, :href, :name, :size, :mtime
|
3
|
-
|
4
|
-
def initialize(type:, media_type: nil, listing_classes:, icon:, href:, name:, size: nil, mtime: nil)
|
5
|
-
@type = type
|
6
|
-
@media_type = media_type
|
7
|
-
@listing_classes = listing_classes
|
8
|
-
@icon = icon
|
9
|
-
@href = href
|
10
|
-
@name = name
|
11
|
-
@size = size
|
12
|
-
@mtime = mtime
|
13
|
-
end
|
14
|
-
|
15
|
-
def media?
|
16
|
-
!@media_type.nil?
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.top(href)
|
20
|
-
Servel::Path.new(
|
21
|
-
type: "Dir",
|
22
|
-
listing_classes: "top directory",
|
23
|
-
icon: "🔝",
|
24
|
-
href: href,
|
25
|
-
name: "Top Directory"
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.parent(href)
|
30
|
-
Servel::Path.new(
|
31
|
-
type: "Dir",
|
32
|
-
listing_classes: "parent directory",
|
33
|
-
icon: "⬆️",
|
34
|
-
href: href,
|
35
|
-
name: "Parent Directory"
|
36
|
-
)
|
37
|
-
end
|
1
|
+
class Servel::Path
|
2
|
+
attr_reader :type, :media_type, :listing_classes, :icon, :href, :name, :size, :mtime
|
3
|
+
|
4
|
+
def initialize(type:, media_type: nil, listing_classes:, icon:, href:, name:, size: nil, mtime: nil)
|
5
|
+
@type = type
|
6
|
+
@media_type = media_type
|
7
|
+
@listing_classes = listing_classes
|
8
|
+
@icon = icon
|
9
|
+
@href = href
|
10
|
+
@name = name
|
11
|
+
@size = size
|
12
|
+
@mtime = mtime
|
13
|
+
end
|
14
|
+
|
15
|
+
def media?
|
16
|
+
!@media_type.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.top(href)
|
20
|
+
Servel::Path.new(
|
21
|
+
type: "Dir",
|
22
|
+
listing_classes: "top directory",
|
23
|
+
icon: "🔝",
|
24
|
+
href: href,
|
25
|
+
name: "Top Directory"
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.parent(href)
|
30
|
+
Servel::Path.new(
|
31
|
+
type: "Dir",
|
32
|
+
listing_classes: "parent directory",
|
33
|
+
icon: "⬆️",
|
34
|
+
href: href,
|
35
|
+
name: "Parent Directory"
|
36
|
+
)
|
37
|
+
end
|
38
38
|
end
|
data/lib/servel/path_builder.rb
CHANGED
@@ -1,74 +1,74 @@
|
|
1
|
-
class Servel::PathBuilder
|
2
|
-
IMAGE_EXTS = %w(.jpg .jpeg .png .gif)
|
3
|
-
VIDEO_EXTS = %w(.webm .mp4)
|
4
|
-
AUDIO_EXTS = %w(.mp3 .m4a .wav)
|
5
|
-
|
6
|
-
def initialize(path)
|
7
|
-
@path = Pathname.new(path)
|
8
|
-
end
|
9
|
-
|
10
|
-
def build
|
11
|
-
Servel::Path.new(
|
12
|
-
type: type,
|
13
|
-
media_type: media_type,
|
14
|
-
listing_classes: listing_classes,
|
15
|
-
icon: icon,
|
16
|
-
href: @path.basename,
|
17
|
-
name: @path.basename,
|
18
|
-
size: size,
|
19
|
-
mtime: @path.mtime
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
def type
|
24
|
-
if @path.directory?
|
25
|
-
"Dir"
|
26
|
-
elsif @path.file?
|
27
|
-
@path.extname.sub(/^\./, "")
|
28
|
-
else
|
29
|
-
""
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def media_type
|
34
|
-
return nil unless @path.file? && @path.extname
|
35
|
-
|
36
|
-
case @path.extname.downcase
|
37
|
-
when *IMAGE_EXTS
|
38
|
-
:image
|
39
|
-
when *VIDEO_EXTS
|
40
|
-
:video
|
41
|
-
when *AUDIO_EXTS
|
42
|
-
:audio
|
43
|
-
else
|
44
|
-
nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def listing_classes
|
49
|
-
klasses = []
|
50
|
-
klasses << "file" if @path.file?
|
51
|
-
klasses << "directory" if @path.directory?
|
52
|
-
klasses << "media" if media_type
|
53
|
-
klasses << media_type if media_type
|
54
|
-
klasses.join(" ")
|
55
|
-
end
|
56
|
-
|
57
|
-
def icon
|
58
|
-
return "📁" if @path.directory?
|
59
|
-
case media_type
|
60
|
-
when :video
|
61
|
-
"🎞️"
|
62
|
-
when :image
|
63
|
-
"🖼️"
|
64
|
-
when :audio
|
65
|
-
"🔊"
|
66
|
-
else
|
67
|
-
"📝"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def size
|
72
|
-
@path.directory? ? nil : @path.size
|
73
|
-
end
|
1
|
+
class Servel::PathBuilder
|
2
|
+
IMAGE_EXTS = %w(.jpg .jpeg .png .gif)
|
3
|
+
VIDEO_EXTS = %w(.webm .mp4)
|
4
|
+
AUDIO_EXTS = %w(.mp3 .m4a .wav)
|
5
|
+
|
6
|
+
def initialize(path)
|
7
|
+
@path = Pathname.new(path)
|
8
|
+
end
|
9
|
+
|
10
|
+
def build
|
11
|
+
Servel::Path.new(
|
12
|
+
type: type,
|
13
|
+
media_type: media_type,
|
14
|
+
listing_classes: listing_classes,
|
15
|
+
icon: icon,
|
16
|
+
href: @path.basename,
|
17
|
+
name: @path.basename,
|
18
|
+
size: size,
|
19
|
+
mtime: @path.mtime
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def type
|
24
|
+
if @path.directory?
|
25
|
+
"Dir"
|
26
|
+
elsif @path.file?
|
27
|
+
@path.extname.sub(/^\./, "")
|
28
|
+
else
|
29
|
+
""
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def media_type
|
34
|
+
return nil unless @path.file? && @path.extname
|
35
|
+
|
36
|
+
case @path.extname.downcase
|
37
|
+
when *IMAGE_EXTS
|
38
|
+
:image
|
39
|
+
when *VIDEO_EXTS
|
40
|
+
:video
|
41
|
+
when *AUDIO_EXTS
|
42
|
+
:audio
|
43
|
+
else
|
44
|
+
nil
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def listing_classes
|
49
|
+
klasses = []
|
50
|
+
klasses << "file" if @path.file?
|
51
|
+
klasses << "directory" if @path.directory?
|
52
|
+
klasses << "media" if media_type
|
53
|
+
klasses << media_type if media_type
|
54
|
+
klasses.join(" ")
|
55
|
+
end
|
56
|
+
|
57
|
+
def icon
|
58
|
+
return "📁" if @path.directory?
|
59
|
+
case media_type
|
60
|
+
when :video
|
61
|
+
"🎞️"
|
62
|
+
when :image
|
63
|
+
"🖼️"
|
64
|
+
when :audio
|
65
|
+
"🔊"
|
66
|
+
else
|
67
|
+
"📝"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def size
|
72
|
+
@path.directory? ? nil : @path.size
|
73
|
+
end
|
74
74
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/servel/version.rb
CHANGED
data/servel.gemspec
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brenton "B-Train" Fletcher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|