servel 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 61283059635d7f385d05267c238bc0594697e227
4
+ data.tar.gz: d48cdd82439abf2a4f0d9377b0e1c76b438c9a67
5
+ SHA512:
6
+ metadata.gz: '08f68881ff271c9f5a2af6a78d3105f2bcacdd33e616547e6809deb3ccc661c061e6551a95e6c9f31054d10ca5f54be47ac81fd0f89ef01e9814ba4642a129b8'
7
+ data.tar.gz: 80bd1ff843f20e00958765c8669b8ce3ff9f46dc96668b98f6eb17faffa9e732e01b1b4fd3b0bfbf5b8585a8d894f78900b1101db28afa541582b15d4ec4c498
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in servel.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Brenton "B-Train" Fletcher
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Servel
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/servel`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'servel'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install servel
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/servel.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "servel"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/servel ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "servel"
4
+
5
+ servel = Servel::Servel.new(Pathname.new(ARGV.first).realpath)
6
+ servel.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/servel.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rack'
2
+ require 'rack/handler/puma'
3
+ require 'haml'
4
+ require 'naturalsorter'
5
+
6
+ require 'json'
7
+ require 'pathname'
8
+
9
+ module Servel
10
+ end
11
+
12
+ require "servel/version"
13
+ require "servel/core_ext/pathname"
14
+ require "servel/haml_context"
15
+ require "servel/index_view"
16
+ require "servel/gallery_view"
17
+ require "servel/middleware"
18
+ require "servel/servel"
@@ -0,0 +1,5 @@
1
+ class Pathname
2
+ def image?
3
+ file? && extname && %w(.jpg .jpeg .png .gif).include?(extname.downcase)
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ class Servel::GalleryView
2
+ def initialize(url_path, fs_path)
3
+ @url_path = url_path
4
+ @fs_path = fs_path
5
+ end
6
+
7
+ def render(haml_context)
8
+ haml_context.render('gallery.haml', locals)
9
+ end
10
+
11
+ def locals
12
+ image_paths = @fs_path.children.select { |child| child.image? }
13
+
14
+ {
15
+ url_path: @url_path,
16
+ fs_path: @fs_path,
17
+ image_paths: sort_paths(image_paths)
18
+ }
19
+ end
20
+
21
+ def sort_paths(paths)
22
+ Naturalsorter::Sorter.sort(paths.map(&:to_s), true).map { |path| Pathname.new(path) }
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ class Servel::HamlContext
2
+ ENGINE_OPTIONS = { remove_whitespace: true, escape_html: true, ugly: true }
3
+
4
+ def initialize()
5
+ @build_path = Pathname.new(__FILE__).dirname.realpath + 'templates'
6
+ @haml_engine_cache = {}
7
+ end
8
+
9
+ def render(template, locals = {})
10
+ haml_engine(template).render(self, locals)
11
+ end
12
+
13
+ def partial(name, locals = {})
14
+ render("_#{name}.haml", locals)
15
+ end
16
+
17
+ def include(path)
18
+ (@build_path + path).read
19
+ end
20
+
21
+ def haml_engine(path)
22
+ unless @haml_engine_cache.key?(path)
23
+ @haml_engine_cache[path] = Haml::Engine.new(include(path), ENGINE_OPTIONS.merge(filename: path))
24
+ end
25
+ @haml_engine_cache[path]
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ class Servel::IndexView
2
+ def initialize(url_path, fs_path)
3
+ @url_path = url_path
4
+ @fs_path = fs_path
5
+ end
6
+
7
+ def render(haml_context)
8
+ haml_context.render('index.haml', locals)
9
+ end
10
+
11
+ def locals
12
+ directories, files = @fs_path.children.partition { |child| child.directory? }
13
+
14
+ {
15
+ url_path: @url_path,
16
+ fs_path: @fs_path,
17
+ directories: sort_paths(directories),
18
+ files: sort_paths(files),
19
+ show_gallery: files.any? { |file| file.image? }
20
+ }
21
+ end
22
+
23
+ def sort_paths(paths)
24
+ Naturalsorter::Sorter.sort(paths.map(&:to_s), true).map { |path| Pathname.new(path) }
25
+ end
26
+ end
@@ -0,0 +1,38 @@
1
+ class Servel::Middleware
2
+ def initialize(app, options = {})
3
+ @app = app
4
+ @root = Pathname.new(options[:root])
5
+ @haml_context = Servel::HamlContext.new
6
+ end
7
+
8
+ def call(env)
9
+ path = env["PATH_INFO"]
10
+ url_path = url_path_for(path)
11
+ fs_path = @root + url_path[1..-1]
12
+
13
+ unless fs_path.directory?
14
+ return @app.call(env)
15
+ end
16
+
17
+ if path != "" && !path.end_with?("/")
18
+ return [302, { "Location" => "#{url_path}/" }, []]
19
+ end
20
+
21
+ url_path << "/" if url_path != "" && !url_path.end_with?("/")
22
+
23
+ klass = if env['QUERY_STRING'] == "gallery"
24
+ Servel::GalleryView
25
+ else
26
+ Servel::IndexView
27
+ end
28
+
29
+ [200, {}, StringIO.new(klass.new(url_path, fs_path).render(@haml_context))]
30
+ end
31
+
32
+ def url_path_for(url_path)
33
+ url_path = Rack::Utils.unescape_path(url_path)
34
+ raise unless Rack::Utils.valid_path?(url_path)
35
+
36
+ Rack::Utils.clean_path_info(url_path)
37
+ end
38
+ end
@@ -0,0 +1,22 @@
1
+ class Servel::Servel
2
+ def initialize(server_root)
3
+ @server_root = server_root
4
+ end
5
+
6
+ def start
7
+ Rack::Handler::Puma.run(build_app)
8
+ end
9
+
10
+ def build_app
11
+ server_root = @server_root
12
+
13
+ Rack::Builder.new do
14
+ use(Servel::Middleware, root: server_root)
15
+ use Rack::Static, urls: [""], root: server_root.to_s
16
+
17
+ run ->(env) do
18
+ [404, {}, []]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ body {
6
+ padding: 0;
7
+
8
+ -webkit-user-select: none;
9
+ -moz-user-select: none;
10
+ -khtml-user-select: none;
11
+ -ms-user-select: none;
12
+ user-select: none;
13
+ }
@@ -0,0 +1,86 @@
1
+ html, body {
2
+ height: 100%;
3
+ }
4
+
5
+ body {
6
+ background-color: #333333;
7
+ }
8
+
9
+ #image {
10
+ display: block;
11
+ max-width: 100%;
12
+ margin: 0 auto 0 auto;
13
+ }
14
+
15
+ @media (min-width: 992px) {
16
+ #image {
17
+ max-height: 100%;
18
+ }
19
+ }
20
+
21
+ .paginator {
22
+ position: fixed;
23
+ width: 100px;
24
+ z-index: 10000;
25
+
26
+ opacity: 0;
27
+ font-size: 20px;
28
+ font-weight: bold;
29
+ text-align: center;
30
+ color: #ffffff;
31
+
32
+ /* Internet Explorer 10 */
33
+ display: -ms-flexbox;
34
+ -ms-flex-pack: center;
35
+ -ms-flex-align: center;
36
+
37
+ /* Firefox */
38
+ display: -moz-box;
39
+ -moz-box-pack: center;
40
+ -moz-box-align: center;
41
+
42
+ /* Safari, Opera, and Chrome */
43
+ display: -webkit-box;
44
+ -webkit-box-pack: center;
45
+ -webkit-box-align: center;
46
+
47
+ /* W3C */
48
+ display: box;
49
+ box-pack: center;
50
+ box-align: center;
51
+ }
52
+
53
+ .paginator:active {
54
+ background-color: #000000;
55
+ opacity: 0.4;
56
+ }
57
+
58
+ .paginator:hover {
59
+ cursor: pointer;
60
+ }
61
+
62
+ #page-back {
63
+ top: 0;
64
+ bottom: 0;
65
+ left: 0;
66
+ }
67
+
68
+ #page-next {
69
+ top: 0;
70
+ bottom: 0;
71
+ right: 0;
72
+ }
73
+
74
+ #page-back-10 {
75
+ bottom: 0;
76
+ left: 0;
77
+ height: 100px;
78
+ z-index: 10001;
79
+ }
80
+
81
+ #page-next-10 {
82
+ bottom: 0;
83
+ right: 0;
84
+ height: 100px;
85
+ z-index: 10001;
86
+ }
@@ -0,0 +1,21 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{charset: 'utf-8'}
5
+ %title Gallery for #{url_path}
6
+ :css
7
+ #{include('normalize.css')}
8
+ #{include('common.css')}
9
+ #{include('gallery.css')}
10
+
11
+ :javascript
12
+ var imagePaths = #{image_paths.map { |file| file.relative_path_from(fs_path).to_s }.to_json};
13
+ #{include('gallery.js')}
14
+
15
+ %body
16
+ #container
17
+ %img#image
18
+ #page-back.paginator ◀
19
+ #page-next.paginator ▶
20
+ #page-back-10.paginator ◀◀
21
+ #page-next-10.paginator ▶▶
@@ -0,0 +1,63 @@
1
+ var currentPage = 1;
2
+
3
+ function page(index) {
4
+ if(arguments.length == 1) {
5
+ if(isNaN(index) || index < 1) index = 1;
6
+ if(index > imagePaths.length) index = imagePaths.length;
7
+
8
+ currentPage = index;
9
+ showCurrentPage();
10
+ }
11
+ else {
12
+ var index = currentPage;
13
+ if(isNaN(index) || index < 1) index = 1;
14
+ return index;
15
+ }
16
+ }
17
+
18
+ function atBottom() {
19
+ return (window.scrollY + window.innerHeight) == document.body.scrollHeight;
20
+ }
21
+
22
+ function initPaginator() {
23
+ document.querySelector("#page-back").addEventListener("click", function(e) {
24
+ e.stopPropagation();
25
+ page(page() - 1);
26
+ });
27
+ document.querySelector("#page-back-10").addEventListener("click", function(e) {
28
+ e.stopPropagation();
29
+ page(page() - 10);
30
+ });
31
+ document.querySelector("#page-next").addEventListener("click", function(e) {
32
+ e.stopPropagation();
33
+ page(page() + 1);
34
+ });
35
+ document.querySelector("#page-next-10").addEventListener("click", function(e) {
36
+ e.stopPropagation();
37
+ page(page() + 10);
38
+ });
39
+
40
+ window.addEventListener("keydown", function(event) {
41
+ if(event.keyCode == 39 || ((event.keyCode == 32 || event.keyCode == 13) && atBottom())) {
42
+ event.preventDefault();
43
+ page(page() + 1);
44
+ }
45
+ else if(event.keyCode == 8 || event.keyCode == 37) {
46
+ event.preventDefault();
47
+ page(page() - 1);
48
+ }
49
+ });
50
+ }
51
+
52
+ function showCurrentPage() {
53
+ window.scrollTo(0, 0);
54
+ document.querySelector("#image").src = imagePaths[currentPage - 1];
55
+ if(currentPage < imagePaths.length) (new Image()).src = imagePaths[currentPage];
56
+ }
57
+
58
+ function init() {
59
+ initPaginator();
60
+ showCurrentPage();
61
+ }
62
+
63
+ window.addEventListener("DOMContentLoaded", init);
@@ -0,0 +1,3 @@
1
+ #container {
2
+ padding: 20px;
3
+ }
@@ -0,0 +1,26 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{charset: 'utf-8'}
5
+ %title Directory Listing of #{url_path}
6
+ :css
7
+ #{include('normalize.css')}
8
+ #{include('common.css')}
9
+ #{include('index.css')}
10
+ %body
11
+ #container
12
+ %h1 Directory Listing of #{url_path}
13
+ %ul
14
+ - if show_gallery
15
+ %li
16
+ %a{href: "#{url_path}?gallery"} Gallery
17
+ - unless url_path == "/"
18
+ %li
19
+ %a{href: "../"} ../
20
+ - (directories + files).each do |file|
21
+ - relative_path = file.relative_path_from(fs_path).to_s
22
+ %li
23
+ - if file.directory?
24
+ (Dir)&nbsp;
25
+ %a{href: relative_path}
26
+ = relative_path
@@ -0,0 +1,447 @@
1
+ /*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
2
+
3
+ /* Document
4
+ ========================================================================== */
5
+
6
+ /**
7
+ * 1. Correct the line height in all browsers.
8
+ * 2. Prevent adjustments of font size after orientation changes in
9
+ * IE on Windows Phone and in iOS.
10
+ */
11
+
12
+ html {
13
+ line-height: 1.15; /* 1 */
14
+ -ms-text-size-adjust: 100%; /* 2 */
15
+ -webkit-text-size-adjust: 100%; /* 2 */
16
+ }
17
+
18
+ /* Sections
19
+ ========================================================================== */
20
+
21
+ /**
22
+ * Remove the margin in all browsers (opinionated).
23
+ */
24
+
25
+ body {
26
+ margin: 0;
27
+ }
28
+
29
+ /**
30
+ * Add the correct display in IE 9-.
31
+ */
32
+
33
+ article,
34
+ aside,
35
+ footer,
36
+ header,
37
+ nav,
38
+ section {
39
+ display: block;
40
+ }
41
+
42
+ /**
43
+ * Correct the font size and margin on `h1` elements within `section` and
44
+ * `article` contexts in Chrome, Firefox, and Safari.
45
+ */
46
+
47
+ h1 {
48
+ font-size: 2em;
49
+ margin: 0.67em 0;
50
+ }
51
+
52
+ /* Grouping content
53
+ ========================================================================== */
54
+
55
+ /**
56
+ * Add the correct display in IE 9-.
57
+ * 1. Add the correct display in IE.
58
+ */
59
+
60
+ figcaption,
61
+ figure,
62
+ main { /* 1 */
63
+ display: block;
64
+ }
65
+
66
+ /**
67
+ * Add the correct margin in IE 8.
68
+ */
69
+
70
+ figure {
71
+ margin: 1em 40px;
72
+ }
73
+
74
+ /**
75
+ * 1. Add the correct box sizing in Firefox.
76
+ * 2. Show the overflow in Edge and IE.
77
+ */
78
+
79
+ hr {
80
+ box-sizing: content-box; /* 1 */
81
+ height: 0; /* 1 */
82
+ overflow: visible; /* 2 */
83
+ }
84
+
85
+ /**
86
+ * 1. Correct the inheritance and scaling of font size in all browsers.
87
+ * 2. Correct the odd `em` font sizing in all browsers.
88
+ */
89
+
90
+ pre {
91
+ font-family: monospace, monospace; /* 1 */
92
+ font-size: 1em; /* 2 */
93
+ }
94
+
95
+ /* Text-level semantics
96
+ ========================================================================== */
97
+
98
+ /**
99
+ * 1. Remove the gray background on active links in IE 10.
100
+ * 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
101
+ */
102
+
103
+ a {
104
+ background-color: transparent; /* 1 */
105
+ -webkit-text-decoration-skip: objects; /* 2 */
106
+ }
107
+
108
+ /**
109
+ * 1. Remove the bottom border in Chrome 57- and Firefox 39-.
110
+ * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
111
+ */
112
+
113
+ abbr[title] {
114
+ border-bottom: none; /* 1 */
115
+ text-decoration: underline; /* 2 */
116
+ text-decoration: underline dotted; /* 2 */
117
+ }
118
+
119
+ /**
120
+ * Prevent the duplicate application of `bolder` by the next rule in Safari 6.
121
+ */
122
+
123
+ b,
124
+ strong {
125
+ font-weight: inherit;
126
+ }
127
+
128
+ /**
129
+ * Add the correct font weight in Chrome, Edge, and Safari.
130
+ */
131
+
132
+ b,
133
+ strong {
134
+ font-weight: bolder;
135
+ }
136
+
137
+ /**
138
+ * 1. Correct the inheritance and scaling of font size in all browsers.
139
+ * 2. Correct the odd `em` font sizing in all browsers.
140
+ */
141
+
142
+ code,
143
+ kbd,
144
+ samp {
145
+ font-family: monospace, monospace; /* 1 */
146
+ font-size: 1em; /* 2 */
147
+ }
148
+
149
+ /**
150
+ * Add the correct font style in Android 4.3-.
151
+ */
152
+
153
+ dfn {
154
+ font-style: italic;
155
+ }
156
+
157
+ /**
158
+ * Add the correct background and color in IE 9-.
159
+ */
160
+
161
+ mark {
162
+ background-color: #ff0;
163
+ color: #000;
164
+ }
165
+
166
+ /**
167
+ * Add the correct font size in all browsers.
168
+ */
169
+
170
+ small {
171
+ font-size: 80%;
172
+ }
173
+
174
+ /**
175
+ * Prevent `sub` and `sup` elements from affecting the line height in
176
+ * all browsers.
177
+ */
178
+
179
+ sub,
180
+ sup {
181
+ font-size: 75%;
182
+ line-height: 0;
183
+ position: relative;
184
+ vertical-align: baseline;
185
+ }
186
+
187
+ sub {
188
+ bottom: -0.25em;
189
+ }
190
+
191
+ sup {
192
+ top: -0.5em;
193
+ }
194
+
195
+ /* Embedded content
196
+ ========================================================================== */
197
+
198
+ /**
199
+ * Add the correct display in IE 9-.
200
+ */
201
+
202
+ audio,
203
+ video {
204
+ display: inline-block;
205
+ }
206
+
207
+ /**
208
+ * Add the correct display in iOS 4-7.
209
+ */
210
+
211
+ audio:not([controls]) {
212
+ display: none;
213
+ height: 0;
214
+ }
215
+
216
+ /**
217
+ * Remove the border on images inside links in IE 10-.
218
+ */
219
+
220
+ img {
221
+ border-style: none;
222
+ }
223
+
224
+ /**
225
+ * Hide the overflow in IE.
226
+ */
227
+
228
+ svg:not(:root) {
229
+ overflow: hidden;
230
+ }
231
+
232
+ /* Forms
233
+ ========================================================================== */
234
+
235
+ /**
236
+ * 1. Change the font styles in all browsers (opinionated).
237
+ * 2. Remove the margin in Firefox and Safari.
238
+ */
239
+
240
+ button,
241
+ input,
242
+ optgroup,
243
+ select,
244
+ textarea {
245
+ font-family: sans-serif; /* 1 */
246
+ font-size: 100%; /* 1 */
247
+ line-height: 1.15; /* 1 */
248
+ margin: 0; /* 2 */
249
+ }
250
+
251
+ /**
252
+ * Show the overflow in IE.
253
+ * 1. Show the overflow in Edge.
254
+ */
255
+
256
+ button,
257
+ input { /* 1 */
258
+ overflow: visible;
259
+ }
260
+
261
+ /**
262
+ * Remove the inheritance of text transform in Edge, Firefox, and IE.
263
+ * 1. Remove the inheritance of text transform in Firefox.
264
+ */
265
+
266
+ button,
267
+ select { /* 1 */
268
+ text-transform: none;
269
+ }
270
+
271
+ /**
272
+ * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
273
+ * controls in Android 4.
274
+ * 2. Correct the inability to style clickable types in iOS and Safari.
275
+ */
276
+
277
+ button,
278
+ html [type="button"], /* 1 */
279
+ [type="reset"],
280
+ [type="submit"] {
281
+ -webkit-appearance: button; /* 2 */
282
+ }
283
+
284
+ /**
285
+ * Remove the inner border and padding in Firefox.
286
+ */
287
+
288
+ button::-moz-focus-inner,
289
+ [type="button"]::-moz-focus-inner,
290
+ [type="reset"]::-moz-focus-inner,
291
+ [type="submit"]::-moz-focus-inner {
292
+ border-style: none;
293
+ padding: 0;
294
+ }
295
+
296
+ /**
297
+ * Restore the focus styles unset by the previous rule.
298
+ */
299
+
300
+ button:-moz-focusring,
301
+ [type="button"]:-moz-focusring,
302
+ [type="reset"]:-moz-focusring,
303
+ [type="submit"]:-moz-focusring {
304
+ outline: 1px dotted ButtonText;
305
+ }
306
+
307
+ /**
308
+ * Correct the padding in Firefox.
309
+ */
310
+
311
+ fieldset {
312
+ padding: 0.35em 0.75em 0.625em;
313
+ }
314
+
315
+ /**
316
+ * 1. Correct the text wrapping in Edge and IE.
317
+ * 2. Correct the color inheritance from `fieldset` elements in IE.
318
+ * 3. Remove the padding so developers are not caught out when they zero out
319
+ * `fieldset` elements in all browsers.
320
+ */
321
+
322
+ legend {
323
+ box-sizing: border-box; /* 1 */
324
+ color: inherit; /* 2 */
325
+ display: table; /* 1 */
326
+ max-width: 100%; /* 1 */
327
+ padding: 0; /* 3 */
328
+ white-space: normal; /* 1 */
329
+ }
330
+
331
+ /**
332
+ * 1. Add the correct display in IE 9-.
333
+ * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
334
+ */
335
+
336
+ progress {
337
+ display: inline-block; /* 1 */
338
+ vertical-align: baseline; /* 2 */
339
+ }
340
+
341
+ /**
342
+ * Remove the default vertical scrollbar in IE.
343
+ */
344
+
345
+ textarea {
346
+ overflow: auto;
347
+ }
348
+
349
+ /**
350
+ * 1. Add the correct box sizing in IE 10-.
351
+ * 2. Remove the padding in IE 10-.
352
+ */
353
+
354
+ [type="checkbox"],
355
+ [type="radio"] {
356
+ box-sizing: border-box; /* 1 */
357
+ padding: 0; /* 2 */
358
+ }
359
+
360
+ /**
361
+ * Correct the cursor style of increment and decrement buttons in Chrome.
362
+ */
363
+
364
+ [type="number"]::-webkit-inner-spin-button,
365
+ [type="number"]::-webkit-outer-spin-button {
366
+ height: auto;
367
+ }
368
+
369
+ /**
370
+ * 1. Correct the odd appearance in Chrome and Safari.
371
+ * 2. Correct the outline style in Safari.
372
+ */
373
+
374
+ [type="search"] {
375
+ -webkit-appearance: textfield; /* 1 */
376
+ outline-offset: -2px; /* 2 */
377
+ }
378
+
379
+ /**
380
+ * Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
381
+ */
382
+
383
+ [type="search"]::-webkit-search-cancel-button,
384
+ [type="search"]::-webkit-search-decoration {
385
+ -webkit-appearance: none;
386
+ }
387
+
388
+ /**
389
+ * 1. Correct the inability to style clickable types in iOS and Safari.
390
+ * 2. Change font properties to `inherit` in Safari.
391
+ */
392
+
393
+ ::-webkit-file-upload-button {
394
+ -webkit-appearance: button; /* 1 */
395
+ font: inherit; /* 2 */
396
+ }
397
+
398
+ /* Interactive
399
+ ========================================================================== */
400
+
401
+ /*
402
+ * Add the correct display in IE 9-.
403
+ * 1. Add the correct display in Edge, IE, and Firefox.
404
+ */
405
+
406
+ details, /* 1 */
407
+ menu {
408
+ display: block;
409
+ }
410
+
411
+ /*
412
+ * Add the correct display in all browsers.
413
+ */
414
+
415
+ summary {
416
+ display: list-item;
417
+ }
418
+
419
+ /* Scripting
420
+ ========================================================================== */
421
+
422
+ /**
423
+ * Add the correct display in IE 9-.
424
+ */
425
+
426
+ canvas {
427
+ display: inline-block;
428
+ }
429
+
430
+ /**
431
+ * Add the correct display in IE.
432
+ */
433
+
434
+ template {
435
+ display: none;
436
+ }
437
+
438
+ /* Hidden
439
+ ========================================================================== */
440
+
441
+ /**
442
+ * Add the correct display in IE 10-.
443
+ */
444
+
445
+ [hidden] {
446
+ display: none;
447
+ }
@@ -0,0 +1,3 @@
1
+ module Servel
2
+ VERSION = "0.1.0"
3
+ end
data/servel.gemspec ADDED
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "servel/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "servel"
8
+ spec.version = Servel::VERSION
9
+ spec.authors = ["Brenton \"B-Train\" Fletcher"]
10
+ spec.email = ["i@bloople.net"]
11
+
12
+ spec.summary = %q{Serves files and directories over HTTP.}
13
+ spec.description = %q{Serves files and directories over HTTP.}
14
+ spec.homepage = "http://bloople.net/"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "bin"
21
+ spec.executables = "servel"
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.16"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_dependency "rack"
27
+ spec.add_dependency "puma"
28
+ spec.add_dependency "naturalsorter"
29
+ spec.add_dependency "haml", "~> 4"
30
+ end
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: servel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brenton "B-Train" Fletcher
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: puma
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: naturalsorter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: haml
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4'
97
+ description: Serves files and directories over HTTP.
98
+ email:
99
+ - i@bloople.net
100
+ executables:
101
+ - servel
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - Gemfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - bin/console
111
+ - bin/servel
112
+ - bin/setup
113
+ - lib/servel.rb
114
+ - lib/servel/core_ext/pathname.rb
115
+ - lib/servel/gallery_view.rb
116
+ - lib/servel/haml_context.rb
117
+ - lib/servel/index_view.rb
118
+ - lib/servel/middleware.rb
119
+ - lib/servel/servel.rb
120
+ - lib/servel/templates/common.css
121
+ - lib/servel/templates/gallery.css
122
+ - lib/servel/templates/gallery.haml
123
+ - lib/servel/templates/gallery.js
124
+ - lib/servel/templates/index.css
125
+ - lib/servel/templates/index.haml
126
+ - lib/servel/templates/normalize.css
127
+ - lib/servel/version.rb
128
+ - servel.gemspec
129
+ homepage: http://bloople.net/
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.6.13
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Serves files and directories over HTTP.
153
+ test_files: []