staticky 0.1.0 → 0.2.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/CHANGELOG.md +16 -1
- data/README.md +374 -14
- data/lib/staticky/application.rb +36 -0
- data/lib/staticky/builder.rb +1 -1
- data/lib/staticky/cli/commands/build.rb +13 -0
- data/lib/staticky/cli/commands/generate.rb +67 -0
- data/lib/staticky/cli/commands/version.rb +13 -0
- data/lib/staticky/cli/commands.rb +13 -0
- data/lib/staticky/cli.rb +0 -60
- data/lib/staticky/deps.rb +1 -1
- data/lib/staticky/filesystem.rb +0 -3
- data/lib/staticky/phlex/view_helpers.rb +7 -2
- data/lib/staticky/pluggable.rb +35 -0
- data/lib/staticky/resource.rb +14 -15
- data/lib/staticky/resources/plugins/phlex.rb +42 -0
- data/lib/staticky/resources/plugins/prelude.rb +74 -0
- data/lib/staticky/resources/plugins.rb +9 -0
- data/lib/staticky/router.rb +13 -15
- data/lib/staticky/routing/plugins/prelude.rb +97 -0
- data/lib/staticky/routing/plugins.rb +9 -0
- data/lib/staticky/server.rb +3 -3
- data/lib/staticky/version.rb +1 -1
- data/lib/staticky.rb +20 -10
- data/site_template/.gitignore +14 -0
- data/site_template/.ruby-version +1 -1
- data/site_template/Dockerfile +3 -3
- data/site_template/Gemfile +4 -3
- data/site_template/Procfile.dev +2 -2
- data/site_template/README.md +31 -7
- data/site_template/Rakefile +31 -2
- data/site_template/app/views/layouts/site.rb +4 -3
- data/site_template/app/views/ui/navbar.rb +1 -1
- data/site_template/bin/{lint → setup} +8 -2
- data/site_template/config/boot.rb +2 -0
- data/site_template/config/puma.rb +11 -0
- data/site_template/config/staticky.rb +6 -0
- data/site_template/lib/icon.rb +1 -1
- data/site_template/nginx.conf +6 -4
- data/site_template/package.json +1 -1
- data/site_template/public/site.webmanifest.erb +2 -2
- data/site_template/vite.config.ts +1 -1
- metadata +45 -7
- data/lib/staticky/container.rb +0 -26
- data/lib/staticky/router/definition.rb +0 -49
- data/lib/staticky/view_context.rb +0 -17
@@ -5,7 +5,8 @@ module Layouts
|
|
5
5
|
include Phlex::DeferredRender
|
6
6
|
|
7
7
|
def view_template
|
8
|
-
|
8
|
+
doctype
|
9
|
+
html lang: "en", data: { theme: "onedark" } do
|
9
10
|
render Layouts::Head.new(&head)
|
10
11
|
|
11
12
|
body do
|
@@ -27,11 +28,11 @@ module Layouts
|
|
27
28
|
private
|
28
29
|
|
29
30
|
def content
|
30
|
-
@content || proc {}
|
31
|
+
@content || proc { }
|
31
32
|
end
|
32
33
|
|
33
34
|
def head
|
34
|
-
@head || proc {}
|
35
|
+
@head || proc { }
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
@@ -13,6 +13,12 @@ FileUtils.chdir APP_ROOT do
|
|
13
13
|
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
14
|
# Add necessary setup steps to this file.
|
15
15
|
|
16
|
-
puts "==
|
17
|
-
system! "
|
16
|
+
puts "== Installing dependencies =="
|
17
|
+
system! "gem install bundler --conservative"
|
18
|
+
system("bundle check") || system!("bundle install")
|
19
|
+
|
20
|
+
system! "bundle binstubs --force bundler rubocop rspec-core vite_ruby rake"
|
21
|
+
|
22
|
+
puts "\n== Installing javascript dependencies =="
|
23
|
+
system! "yarn install"
|
18
24
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Run in single threaded mode
|
4
|
+
threads 0, 1
|
5
|
+
|
6
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is
|
7
|
+
# 3000.
|
8
|
+
port 3000
|
9
|
+
|
10
|
+
# Only use a pidfile when requested
|
11
|
+
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
|
data/site_template/lib/icon.rb
CHANGED
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
|
|
data/site_template/package.json
CHANGED
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.
|
4
|
+
version: 0.2.0
|
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-
|
11
|
+
date: 2024-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dry-container
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.11'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.11'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: dry-events
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,20 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: dry-inflector
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.1'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: dry-logger
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,21 +194,29 @@ files:
|
|
166
194
|
- Rakefile
|
167
195
|
- bin/staticky
|
168
196
|
- lib/staticky.rb
|
197
|
+
- lib/staticky/application.rb
|
169
198
|
- lib/staticky/builder.rb
|
170
199
|
- lib/staticky/cli.rb
|
171
|
-
- lib/staticky/
|
200
|
+
- lib/staticky/cli/commands.rb
|
201
|
+
- lib/staticky/cli/commands/build.rb
|
202
|
+
- lib/staticky/cli/commands/generate.rb
|
203
|
+
- lib/staticky/cli/commands/version.rb
|
172
204
|
- lib/staticky/deps.rb
|
173
205
|
- lib/staticky/environment.rb
|
174
206
|
- lib/staticky/error.rb
|
175
207
|
- lib/staticky/filesystem.rb
|
176
208
|
- lib/staticky/generator.rb
|
177
209
|
- lib/staticky/phlex/view_helpers.rb
|
210
|
+
- lib/staticky/pluggable.rb
|
178
211
|
- lib/staticky/resource.rb
|
212
|
+
- lib/staticky/resources/plugins.rb
|
213
|
+
- lib/staticky/resources/plugins/phlex.rb
|
214
|
+
- lib/staticky/resources/plugins/prelude.rb
|
179
215
|
- lib/staticky/router.rb
|
180
|
-
- lib/staticky/
|
216
|
+
- lib/staticky/routing/plugins.rb
|
217
|
+
- lib/staticky/routing/plugins/prelude.rb
|
181
218
|
- lib/staticky/server.rb
|
182
219
|
- lib/staticky/version.rb
|
183
|
-
- lib/staticky/view_context.rb
|
184
220
|
- site_template/.dockerignore
|
185
221
|
- site_template/.gitignore
|
186
222
|
- site_template/.prettierrc
|
@@ -203,12 +239,14 @@ files:
|
|
203
239
|
- site_template/app/views/ui/navbar.rb
|
204
240
|
- site_template/bin/console
|
205
241
|
- site_template/bin/dev
|
206
|
-
- site_template/bin/
|
242
|
+
- site_template/bin/setup
|
207
243
|
- site_template/bin/staticky
|
208
244
|
- site_template/config.ru
|
209
245
|
- site_template/config/boot.rb
|
246
|
+
- site_template/config/puma.rb
|
210
247
|
- site_template/config/routes.rb
|
211
248
|
- site_template/config/site.erb
|
249
|
+
- site_template/config/staticky.rb
|
212
250
|
- site_template/config/vite.json
|
213
251
|
- site_template/content/.keep
|
214
252
|
- site_template/content/demo.md
|
@@ -266,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
304
|
- !ruby/object:Gem::Version
|
267
305
|
version: '0'
|
268
306
|
requirements: []
|
269
|
-
rubygems_version: 3.5.
|
307
|
+
rubygems_version: 3.5.16
|
270
308
|
signing_key:
|
271
309
|
specification_version: 4
|
272
310
|
summary: Static site
|
data/lib/staticky/container.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Staticky
|
4
|
-
class Container < Dry::System::Container
|
5
|
-
use :env
|
6
|
-
use :zeitwerk
|
7
|
-
use :monitoring
|
8
|
-
|
9
|
-
configure do |config|
|
10
|
-
config.root = Pathname(__dir__).join("..").join("..")
|
11
|
-
config.inflector = Dry::Inflector.new do |inflections|
|
12
|
-
inflections.acronym("CLI")
|
13
|
-
end
|
14
|
-
config.component_dirs.add "lib" do |dir|
|
15
|
-
dir.add_to_load_path = false
|
16
|
-
dir.auto_register = false
|
17
|
-
dir.namespaces.add "staticky", key: nil
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
register(:files, Staticky::Filesystem.real)
|
22
|
-
register(:router, Staticky::Router.new)
|
23
|
-
register(:builder, Staticky::Builder.new)
|
24
|
-
register(:generator, Staticky::Generator.new)
|
25
|
-
end
|
26
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Staticky
|
4
|
-
class Router
|
5
|
-
class Definition
|
6
|
-
attr_reader :resources
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@routes_by_path = {}
|
10
|
-
@routes_by_component = {}
|
11
|
-
@resources = []
|
12
|
-
end
|
13
|
-
|
14
|
-
def match(path, to:)
|
15
|
-
component = to.then do |object|
|
16
|
-
object.is_a?(Class) ? object.new : object
|
17
|
-
end
|
18
|
-
|
19
|
-
@resources << resource = Resource.new(url: path, component:)
|
20
|
-
@routes_by_path[path] = resource
|
21
|
-
@routes_by_component[component.class] = resource
|
22
|
-
end
|
23
|
-
|
24
|
-
def root(to:)
|
25
|
-
match("/", to:)
|
26
|
-
end
|
27
|
-
|
28
|
-
def resolve(path)
|
29
|
-
@routes_by_path.fetch(path) { @routes_by_component.fetch(path) }
|
30
|
-
end
|
31
|
-
|
32
|
-
def delete(path)
|
33
|
-
@routes.delete(path)
|
34
|
-
end
|
35
|
-
|
36
|
-
def filepaths
|
37
|
-
@resources.map { |resource| rename_key(resource.url) }
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def rename_key(key)
|
43
|
-
return "index.html" if key == "/"
|
44
|
-
|
45
|
-
"#{key}.html"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|