staticky 0.1.0 → 0.1.1
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/CHANGELOG.md +7 -1
- data/README.md +13 -0
- data/lib/staticky/phlex/view_helpers.rb +2 -1
- data/lib/staticky/router.rb +3 -0
- data/lib/staticky/server.rb +2 -2
- data/lib/staticky/version.rb +1 -1
- data/site_template/Dockerfile +3 -3
- data/site_template/README.md +4 -0
- data/site_template/app/views/layouts/site.rb +2 -1
- data/site_template/app/views/ui/navbar.rb +1 -1
- data/site_template/config/boot.rb +2 -0
- data/site_template/config/staticky.rb +4 -0
- data/site_template/nginx.conf +6 -4
- data/site_template/public/site.webmanifest.erb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 601e3b52395f847f7f7f57909a0063f83063dc0cf5bd02ef21e865d972f3322f
|
4
|
+
data.tar.gz: 7d8ecdd8e166359930743d01e2c955dc521a4f9d1b231d239d35aa45858cc003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1b21ab89e9d6429b3cd3407ae84802c1739e68aa39c969f10c0d82e28ad3cdf187cd1bedcf98a22805fbe9de64c3be96d711f4f554c5addf55c744bcd11b9a6
|
7
|
+
data.tar.gz: 3695cab76d925bec1ba6e02852ac63a088c88cd2d2fb9e3942c5e33f0ef8aefb19d6c643c6e2ade7d63b438dba6d954a351efaba86939ac4ac5e56be73652343
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.1.
|
3
|
+
## [0.1.1] - 2024-08-18
|
4
|
+
|
5
|
+
- Fixes nginx and Dockerfile configs for default dokku deployments
|
6
|
+
- Improvements to site template files
|
7
|
+
- Adds ability for `link_to` helpers to take absolute paths
|
8
|
+
|
9
|
+
## [0.1.0] - 2024-08-18
|
4
10
|
|
5
11
|
- Initial release
|
data/README.md
CHANGED
@@ -70,6 +70,8 @@ module Posts
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def view_template
|
73
|
+
link_to "Home", "/"
|
74
|
+
|
73
75
|
render Posts::Header.new(@post)
|
74
76
|
render Posts::Outline.new(@post, class: css[:outline])
|
75
77
|
render Posts::Markdown.new(@post, class: css[:post])
|
@@ -96,6 +98,9 @@ module Posts
|
|
96
98
|
end
|
97
99
|
```
|
98
100
|
|
101
|
+
We get `link_to` from the `Staticky::Phlex::ViewHelpers` which resolves either
|
102
|
+
a URL or a phlex class from your router.
|
103
|
+
|
99
104
|
When you are developing your site you run `bin/dev` to start your development
|
100
105
|
server on http://localhost:9292. This will automatically reload after a short
|
101
106
|
period when you make changes.
|
@@ -127,6 +132,14 @@ end
|
|
127
132
|
|
128
133
|
This will output your site to `./build` by default.
|
129
134
|
|
135
|
+
During building, each definition in the router is compiled and handed a special
|
136
|
+
view context which holds information about the resource being rendered such as
|
137
|
+
the `current_path`.
|
138
|
+
|
139
|
+
These are available in your Phlex components under `helpers` (if you are using
|
140
|
+
the site template). This matches what you might expect when using Phlex in
|
141
|
+
Rails with `phlex-rails`.
|
142
|
+
|
130
143
|
## Configuration
|
131
144
|
|
132
145
|
We can override the configuration according to the settings defined on the main
|
@@ -5,7 +5,8 @@ module Staticky
|
|
5
5
|
module ViewHelpers
|
6
6
|
def link_to(text, href, **, &block) # rubocop:disable Metrics/ParameterLists
|
7
7
|
block ||= proc { text }
|
8
|
-
href = Staticky.router.resolve(href)
|
8
|
+
href = Staticky.router.resolve(href)
|
9
|
+
href = href.url unless href.is_a?(String)
|
9
10
|
|
10
11
|
a(href:, **, &block)
|
11
12
|
end
|
data/lib/staticky/router.rb
CHANGED
data/lib/staticky/server.rb
CHANGED
@@ -14,6 +14,7 @@ module Staticky
|
|
14
14
|
|
15
15
|
plugin :common_logger, Staticky.server_logger, method: :debug
|
16
16
|
plugin :render, engine: "html"
|
17
|
+
plugin :public
|
17
18
|
|
18
19
|
plugin :not_found do
|
19
20
|
raise NotFound if Staticky.env.test?
|
@@ -41,8 +42,7 @@ module Staticky
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
44
|
-
|
45
|
-
nil
|
45
|
+
r.public
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/lib/staticky/version.rb
CHANGED
data/site_template/Dockerfile
CHANGED
@@ -40,8 +40,8 @@ COPY nginx.conf /etc/nginx/nginx.conf
|
|
40
40
|
# Copy the static site files to the Nginx HTML directory
|
41
41
|
COPY --from=builder /app/build /usr/share/nginx/html/
|
42
42
|
|
43
|
-
# Expose port
|
44
|
-
EXPOSE
|
43
|
+
# Expose port to the Docker host (default is 5000 for dokku)
|
44
|
+
EXPOSE 5000
|
45
45
|
|
46
46
|
# Start Nginx when the container launches
|
47
|
-
CMD ["nginx", "-
|
47
|
+
CMD ["nginx", "-c", "/etc/nginx/nginx.conf"]
|
data/site_template/README.md
CHANGED
@@ -96,3 +96,7 @@ The router is your definition for how to build your static site.
|
|
96
96
|
|
97
97
|
Deployment is done through a simple Dockerfile. This setup is optimized for
|
98
98
|
deploying onto Dokku servers.
|
99
|
+
|
100
|
+
By default Dokku expects the app to be exposed on port 5000 which we do through
|
101
|
+
our Dockerfile. Dokku will scan the Dockerfile for an `EXPOSE` directive and
|
102
|
+
automatically setup the port routing for you.
|
data/site_template/nginx.conf
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
worker_processes 1;
|
2
2
|
error_log stderr;
|
3
3
|
pid nginx.pid;
|
4
|
+
daemon off;
|
4
5
|
|
5
6
|
events {
|
6
7
|
worker_connections 768;
|
@@ -17,17 +18,18 @@ http {
|
|
17
18
|
gzip_proxied any;
|
18
19
|
gzip_vary on;
|
19
20
|
|
21
|
+
error_page 404 /404.html;
|
22
|
+
|
20
23
|
server {
|
21
|
-
listen
|
22
|
-
listen [::]:80 default_server;
|
24
|
+
listen 5000;
|
23
25
|
server_name _;
|
24
26
|
root /usr/share/nginx/html;
|
25
|
-
index index.html
|
27
|
+
index index.html;
|
26
28
|
port_in_redirect off;
|
27
29
|
add_header X-Content-Type-Options "nosniff";
|
28
30
|
|
29
31
|
location / {
|
30
|
-
try_files $uri $uri
|
32
|
+
try_files $uri $uri/ =404;
|
31
33
|
expires 1h;
|
32
34
|
}
|
33
35
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: staticky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nolan J Tait
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- site_template/config/boot.rb
|
210
210
|
- site_template/config/routes.rb
|
211
211
|
- site_template/config/site.erb
|
212
|
+
- site_template/config/staticky.rb
|
212
213
|
- site_template/config/vite.json
|
213
214
|
- site_template/content/.keep
|
214
215
|
- site_template/content/demo.md
|