leanweb 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/bin/leanweb +1 -2
- data/lib/leanweb/app.rb +2 -2
- data/lib/leanweb/controller.rb +4 -4
- data/lib/leanweb/route.rb +4 -4
- data/lib/leanweb.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7ba1cbcbf7acd94daf2e421edfbd0d83c465b1508f73b9a0bffe50d59d1881d
|
4
|
+
data.tar.gz: f1aecd91b4297314b08c0d34d985a5cd5a628041aaccfbcec1d9133f7a0a71eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a980f164e5e79bcd14591244d7b8d3d13c803546e132f0d26708b14dbd87ccc70978eea685287ea8692634aa0a8b1ccbac47eaf3885176e63139e1247a95c9f
|
7
|
+
data.tar.gz: 0b9f6f88cfdcea7561c9945428c85137c5df8346d93498dd85e024fbb9d87d7af2a7e607141c0058b3b88edac7ea96a0386f458e19ba11fb53dffdf15d999d8a
|
data/bin/leanweb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# Copyright 2022 Felix Freeman <libsys@hacktivista.org>
|
4
5
|
#
|
@@ -7,8 +8,6 @@
|
|
7
8
|
# should have received a copy of this license along with the software. If not,
|
8
9
|
# see <https://hacktivista.org/licenses/>.
|
9
10
|
|
10
|
-
# frozen_string_literal: true
|
11
|
-
|
12
11
|
require 'fileutils'
|
13
12
|
require 'leanweb'
|
14
13
|
|
data/lib/leanweb/app.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2022 Felix Freeman <libsys@hacktivista.org>
|
2
4
|
#
|
3
5
|
# This file is part of "LeanWeb" and licensed under the terms of the Hacktivista
|
@@ -5,8 +7,6 @@
|
|
5
7
|
# should have received a copy of this license along with the software. If not,
|
6
8
|
# see <https://hacktivista.org/licenses/>.
|
7
9
|
|
8
|
-
# frozen_string_literal: true
|
9
|
-
|
10
10
|
require 'rack'
|
11
11
|
|
12
12
|
module LeanWeb
|
data/lib/leanweb/controller.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2022 Felix Freeman <libsys@hacktivista.org>
|
2
4
|
#
|
3
5
|
# This file is part of "LeanWeb" and licensed under the terms of the Hacktivista
|
@@ -5,8 +7,6 @@
|
|
5
7
|
# should have received a copy of this license along with the software. If not,
|
6
8
|
# see <https://hacktivista.org/licenses/>.
|
7
9
|
|
8
|
-
# frozen_string_literal: true
|
9
|
-
|
10
10
|
require 'rack'
|
11
11
|
|
12
12
|
module LeanWeb
|
@@ -28,7 +28,7 @@ module LeanWeb
|
|
28
28
|
# Render magic. Supports dynamic (and static) Haml documents, other
|
29
29
|
# documents don't support dynamic data.
|
30
30
|
#
|
31
|
-
# Depending on {Route#path} and {
|
31
|
+
# Depending on {Route#path} and {render} `path` you will render different
|
32
32
|
# documents:
|
33
33
|
#
|
34
34
|
# - {Route#path} `/a/b/c` and `render('d')` will render `src/views/a/b/d`
|
@@ -41,7 +41,7 @@ module LeanWeb
|
|
41
41
|
# `@route.path`. You can also make it relative to {LeanWeb::VIEW_PATH} by
|
42
42
|
# prepending `~`.
|
43
43
|
# @param content_type [String] Defaults to the proper Content-Type for file
|
44
|
-
#
|
44
|
+
# extension, `text/plain` on unknown files.
|
45
45
|
#
|
46
46
|
# @return [Rack::Request#finish] A valid rack response.
|
47
47
|
def render(path, content_type = nil) # rubocop:disable Metrics/MethodLength
|
data/lib/leanweb/route.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2022 Felix Freeman <libsys@hacktivista.org>
|
2
4
|
#
|
3
5
|
# This file is part of "LeanWeb" and licensed under the terms of the Hacktivista
|
@@ -5,13 +7,11 @@
|
|
5
7
|
# should have received a copy of this license along with the software. If not,
|
6
8
|
# see <https://hacktivista.org/licenses/>.
|
7
9
|
|
8
|
-
# frozen_string_literal: true
|
9
|
-
|
10
10
|
module LeanWeb
|
11
11
|
# Action for {Route#action}.
|
12
12
|
Action = Struct.new(:file, :controller, :action, keyword_init: true)
|
13
13
|
|
14
|
-
# A single route which routes with the {
|
14
|
+
# A single route which routes with the {respond} method. It can also {build}
|
15
15
|
# an static file.
|
16
16
|
class Route
|
17
17
|
attr_reader :path, :method, :action, :static
|
@@ -103,7 +103,7 @@ module LeanWeb
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
# @param value [Hash, String, nil] Check {
|
106
|
+
# @param value [Hash, String, nil] Check {initialize} action param for
|
107
107
|
# valid input.
|
108
108
|
# @return [Hash] valid hash for {Action}.
|
109
109
|
def prepare_action_hash(value)
|
data/lib/leanweb.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright 2022 Felix Freeman <libsys@hacktivista.org>
|
2
4
|
#
|
3
5
|
# This file is part of "LeanWeb" and licensed under the terms of the Hacktivista
|
@@ -5,11 +7,9 @@
|
|
5
7
|
# should have received a copy of this license along with the software. If not,
|
6
8
|
# see <https://hacktivista.org/licenses/>.
|
7
9
|
|
8
|
-
# frozen_string_literal: true
|
9
|
-
|
10
10
|
# LeanWeb is a minimal hybrid static / dynamic web framework.
|
11
11
|
module LeanWeb
|
12
|
-
VERSION = '0.1.
|
12
|
+
VERSION = '0.1.2'
|
13
13
|
|
14
14
|
ROOT_PATH = ENV['LEANWEB_ROOT_PATH'] || Dir.pwd
|
15
15
|
CONTROLLER_PATH = "#{ROOT_PATH}/src/controllers"
|